-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add base feature for generating a new feature of the plugin (#317)
* Stubbing out the dream syntax * Adjusting the stub files * Adjusting the stub files0 * Finish the templates * Readme update * REVERT * Adjusting the stubs * Wrapping up the stubs * Update feature name * Remove bad file * Adjusting the stub files * Finishing new stubs * Wrap up feature for generating a plugin feature * Revert plugin deletiojn
- Loading branch information
Showing
4 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: create-wordpress-plugin@plugin-feature | ||
|
||
inputs: | ||
- name: featureName | ||
description: "Feature Name" | ||
type: string | ||
- name: tests | ||
description: "Include Tests?" | ||
type: boolean | ||
default: true | ||
|
||
files: | ||
- source: feature.php.hbs | ||
destination: src/features/{{ wpClassFilename inputs.featureName }} | ||
- source: test.php.hbs | ||
if: "{{ inputs.tests }}" | ||
destination: tests/Features/{{ psrClassFilename inputs.featureName suffix="Test.php" }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
/** | ||
* {{ wpClassName inputs.featureName }} class file | ||
* | ||
* @package Create_WordPress_Plugin | ||
*/ | ||
|
||
namespace Create_WordPress_Plugin\\{{ wpNamespace inputs.featureName prefix="Features" }}; | ||
|
||
use Alley\WP\Types\Feature; | ||
|
||
/** | ||
* {{ replace (wpClassName inputs.featureName) "_" " " }} Feature | ||
*/ | ||
final class {{ wpClassName inputs.featureName }} implements Feature { | ||
/** | ||
* Set up the feature. | ||
*/ | ||
public function __construct() {} | ||
|
||
/** | ||
* Boot the feature. | ||
*/ | ||
public function boot(): void { | ||
// Add any actions or filters here. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
/** | ||
* {{ psrClassName name }} test class file | ||
* | ||
* @package create-wordpress-plugin | ||
*/ | ||
|
||
namespace Create_WordPress_Plugin\\{{ wpNamespace inputs.featureName prefix="Tests\Features" }}; | ||
|
||
use Create_WordPress_Plugin\Tests\TestCase; | ||
use Create_WordPress_Plugin\\{{ wpNamespace inputs.featureName prefix="Features" }}\\{{ wpClassName inputs.featureName }}; | ||
|
||
/** | ||
* {{ replace (psrClassName inputs.featureName) "_" " " }} Test for the {{ wpClassName inputs.featureName }} class. | ||
* | ||
* @link https://mantle.alley.com/docs/testing | ||
*/ | ||
class {{ psrClassName inputs.featureName suffix="Test" }} extends TestCase { | ||
/** | ||
* An example test for the feature. | ||
*/ | ||
public function test_example() { | ||
$this->assertTrue( true ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters