Inheritance: extends Bake\Shell\Task\BakeTask
Exemplo n.º 1
0
 /**
  * test main with plugin.name
  *
  * @return void
  */
 public function testMainWithPluginDot()
 {
     $this->Task->connection = 'test';
     Plugin::load('ControllerTest', ['path' => APP . 'Plugin/ControllerTest/']);
     $path = APP . 'Plugin/ControllerTest/src/Controller/BakeArticlesController.php';
     $this->Task->expects($this->at(1))->method('createFile')->with($this->_normalizePath($path), $this->stringContains('BakeArticlesController extends AppController'))->will($this->returnValue(true));
     $this->Task->main('ControllerTest.BakeArticles');
 }
 /**
  * Compare bake table result with static comparison file
  *
  * @return void
  */
 protected function _compareBakeTableResult($name, $comparisonFile)
 {
     $table = $this->Task->getTable($name);
     $tableObject = $this->Task->getTableObject($name, $table);
     $data = $this->Task->getTableContext($tableObject, $table, $name);
     $result = $this->Task->bakeTable($tableObject, $data);
     $this->assertSameAsFile($comparisonFile . '.php', $result);
 }
Exemplo n.º 3
0
 /**
  * test finding referenced tables using constraints.
  *
  * @return void
  */
 public function testFindTableReferencedBy()
 {
     $invoices = TableRegistry::get('Invitations');
     $schema = $invoices->schema();
     $result = $this->Task->findTableReferencedBy($schema, 'not_there');
     $this->assertNull($result);
     $result = $this->Task->findTableReferencedBy($schema, 'sender_id');
     $this->assertEquals('users', $result);
     $result = $this->Task->findTableReferencedBy($schema, 'receiver_id');
     $this->assertEquals('users', $result);
 }
Exemplo n.º 4
0
 /**
  * test generating files into plugins.
  *
  * @return void
  */
 public function testGeneratePluginFixtureFile()
 {
     $this->_loadTestPlugin('TestBake');
     $root = Plugin::path('TestBake');
     $this->Task->connection = 'test';
     $this->Task->plugin = 'TestBake';
     $filename = $this->_normalizePath($root . 'tests/Fixture/ArticlesFixture.php');
     $this->Task->expects($this->at(0))->method('createFile')->with($filename, $this->stringContains('class Articles'));
     $result = $this->Task->generateFixtureFile('Articles', []);
     $this->assertContains('<?php', $result);
     $this->assertContains('namespace TestBake\\Test\\Fixture;', $result);
 }