Example #1
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 #2
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');
 }
Example #3
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);
 }