diff --git a/docs/en/usage.rst b/docs/en/usage.rst index e25b3f02..29da6dcb 100644 --- a/docs/en/usage.rst +++ b/docs/en/usage.rst @@ -31,9 +31,11 @@ You can get the list of available bake command by running ``bin/cake bake --help - bake behavior - bake cell - bake command + - bake command_helper - bake component - bake controller - bake controller all + - bake enum - bake fixture - bake fixture all - bake form diff --git a/src/Command/EnumCommand.php b/src/Command/EnumCommand.php new file mode 100644 index 00000000..793aff44 --- /dev/null +++ b/src/Command/EnumCommand.php @@ -0,0 +1,54 @@ +name); + } +} diff --git a/tests/TestCase/Command/EnumCommandTest.php b/tests/TestCase/Command/EnumCommandTest.php new file mode 100644 index 00000000..df9d8dd2 --- /dev/null +++ b/tests/TestCase/Command/EnumCommandTest.php @@ -0,0 +1,55 @@ +_compareBasePath = Plugin::path('Bake') . 'tests' . DS . 'comparisons' . DS . 'Model' . DS; + $this->setAppNamespace('Bake\Test\App'); + } + + /** + * test baking an enum + * + * @return void + */ + public function testBakeEnum() + { + $this->generatedFile = APP . 'Model/Enum/FooBar.php'; + $this->exec('bake enum FooBar', ['y']); + + $this->assertExitCode(CommandInterface::CODE_SUCCESS); + $this->assertFileExists($this->generatedFile); + $result = file_get_contents($this->generatedFile); + $this->assertSameAsFile(__FUNCTION__ . '.php', $result); + } +} diff --git a/tests/TestCase/Command/ModelCommandTest.php b/tests/TestCase/Command/ModelCommandTest.php index 3e5f8bd9..fc33029f 100644 --- a/tests/TestCase/Command/ModelCommandTest.php +++ b/tests/TestCase/Command/ModelCommandTest.php @@ -1709,7 +1709,7 @@ public function testBakeTableConfig() * * @return void */ - public function testBakeEntitySimple() + public function testBakeEnum() { $this->generatedFile = APP . 'Model/Entity/User.php'; $this->exec('bake model --no-test --no-fixture --no-table --no-fields --no-hidden users'); diff --git a/tests/comparisons/Model/testBakeEnum.php b/tests/comparisons/Model/testBakeEnum.php new file mode 100644 index 00000000..85e7e34b --- /dev/null +++ b/tests/comparisons/Model/testBakeEnum.php @@ -0,0 +1,18 @@ +name); + } +}