bake() публичный Метод

Completes final steps for generating data to create test case.
public bake ( string $type, string $className ) : string | boolean
$type string Type of object to bake test case for ie. Model, Controller
$className string the 'cake name' for the class ie. Posts for the PostsController
Результат string | boolean
Пример #1
0
 /**
  * Test baking within a plugin.
  *
  * @return void
  */
 public function testBakePlugin()
 {
     $this->_loadTestPlugin('TestBake');
     $path = Plugin::path('TestBake');
     $this->Task->plugin = 'TestBake';
     $this->Task->expects($this->at(0))->method('createFile')->with($this->_normalizePath($path . 'src/Template/Cell/Example/display.ctp'), '');
     $this->Task->expects($this->at(1))->method('createFile')->with($this->_normalizePath($path . 'src/View/Cell/ExampleCell.php'), $this->stringContains('class ExampleCell extends Cell'));
     $result = $this->Task->bake('Example');
     $this->assertSameAsFile(__FUNCTION__ . '.php', $result);
 }
Пример #2
0
 /**
  * test bake() with a -plugin param
  *
  * @return void
  */
 public function testBakeWithPlugin()
 {
     $this->Task->plugin = 'TestTest';
     Plugin::load('TestTest', ['path' => APP . 'Plugin' . DS . 'TestTest' . DS]);
     $path = APP . 'Plugin/TestTest/tests/TestCase/View/Helper/FormHelperTest.php';
     $path = str_replace('/', DS, $path);
     $this->Task->expects($this->once())->method('createFile')->with($path, $this->anything());
     $this->Task->bake('Helper', 'Form');
 }