Example #1
0
 /**
  * test bake all
  *
  * @return void
  */
 public function testAllWithModelName()
 {
     $this->Shell->Model = $this->getMock('Bake\\Shell\\Task\\ModelTask');
     $this->Shell->Controller = $this->getMock('Bake\\Shell\\Task\\ControllerTask');
     $this->Shell->Template = $this->getMock('Bake\\Shell\\Task\\TemplateTask');
     $this->Shell->Model->expects($this->once())->method('main')->with('Comments')->will($this->returnValue(true));
     $this->Shell->Controller->expects($this->once())->method('main')->with('Comments')->will($this->returnValue(true));
     $this->Shell->Template->expects($this->once())->method('main')->with('Comments');
     $this->Shell->connection = '';
     $this->Shell->params = ['prefix' => 'account'];
     $this->Shell->all('Comments');
     $output = $this->out->messages();
     $expected = ['Bake All', '---------------------------------------------------------------', '<success>Bake All complete.</success>'];
     $this->assertSame($expected, $output);
 }
Example #2
0
 /**
  * test that skipTables changes how all() works.
  *
  * @return void
  */
 public function testSkipTablesAndAll()
 {
     if ($this->Task->listAll()[1] != 'bake_articles') {
         $this->markTestSkipped('Additional tables detected.');
     }
     $this->Task->connection = 'test';
     $this->Task->skipTables = ['articles_tags', 'bake_tags', 'counter_cache_posts'];
     $this->Task->Fixture->expects($this->atLeast(9))->method('bake');
     $this->Task->Test->expects($this->atLeast(9))->method('bake');
     $filename = $this->_normalizePath(APP . 'Model/Entity/BakeArticle.php');
     $this->Task->expects($this->at(1))->method('createFile')->with($filename);
     $filename = $this->_normalizePath(APP . 'Model/Entity/BakeArticlesBakeTag.php');
     $this->Task->expects($this->at(3))->method('createFile')->with($filename);
     $filename = $this->_normalizePath(APP . 'Model/Entity/BakeComment.php');
     $this->Task->expects($this->at(5))->method('createFile')->with($filename);
     $filename = $this->_normalizePath(APP . 'Model/Entity/CategoryThread.php');
     $this->Task->expects($this->at(7))->method('createFile')->with($filename);
     $filename = $this->_normalizePath(APP . 'Model/Entity/CounterCacheUser.php');
     $this->Task->expects($this->at(9))->method('createFile')->with($filename);
     $filename = $this->_normalizePath(APP . 'Model/Entity/Invitation.php');
     $this->Task->expects($this->at(11))->method('createFile')->with($filename);
     $filename = $this->_normalizePath(APP . 'Model/Entity/NumberTree.php');
     $this->Task->expects($this->at(13))->method('createFile')->with($filename);
     $this->Task->all();
 }
Example #3
0
 /**
  * test using all() with -schema
  *
  * @return void
  */
 public function testAllWithSchemaImport()
 {
     $this->Task->connection = 'test';
     $this->Task->params = ['schema' => true];
     $this->Task->Model->expects($this->any())->method('listUnskipped')->will($this->returnValue(['Articles', 'comments']));
     $filename = $this->_normalizePath(ROOT . DS . 'tests' . DS . 'Fixture/ArticlesFixture.php');
     $this->Task->expects($this->at(0))->method('createFile')->with($filename, $this->stringContains("public \$import = ['table' => 'articles'"));
     $filename = $this->_normalizePath(ROOT . DS . 'tests' . DS . 'Fixture/CommentsFixture.php');
     $this->Task->expects($this->at(1))->method('createFile')->with($filename, $this->stringContains("public \$import = ['table' => 'comments'"));
     $this->Task->expects($this->exactly(2))->method('createFile');
     $this->Task->all();
 }
Example #4
0
 /**
  * test that execute runs all when the first arg == all
  *
  * @return void
  */
 public function testMainIntoAll()
 {
     if ($this->Task->listAll()[0] != 'bake_articles') {
         $this->markTestSkipped('Additional tables detected.');
     }
     $this->Task->connection = 'test';
     $this->Task->params = ['helpers' => 'Time,Text'];
     $this->Task->Test->expects($this->atLeastOnce())->method('bake');
     $filename = $this->_normalizePath(APP . 'Controller/BakeArticlesController.php');
     $this->Task->expects($this->at(1))->method('createFile')->with($filename, $this->logicalAnd($this->stringContains('class BakeArticlesController'), $this->stringContains("\$helpers = ['Time', 'Text']")))->will($this->returnValue(true));
     $this->Task->all();
 }