示例#1
0
 /**
  * Bake All the controllers at once. Will only bake controllers for models that exist.
  *
  * @return void
  */
 public function all()
 {
     foreach ($this->listAll() as $table) {
         TableRegistry::clear();
         $this->main($table);
     }
 }
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     unset($this->NotificationQueue);
     unset($this->NotificationContents);
     TableRegistry::clear();
     parent::tearDown();
 }
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     $this->Articles = TableRegistry::get('ArticlesTable', ['className' => 'ModelHistoryTestApp\\Model\\Table\\ArticlesTable']);
     $this->ModelHistory = TableRegistry::get('ModelHistory', ['className' => 'ModelHistory\\Model\\Table\\ModelHistoryTable']);
     parent::setUp();
     TableRegistry::clear();
 }
 /**
  * tear down
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     $this->Noticias->removeBehavior("CakePtbr.AjusteData");
     unset($this->Noticias, $this->Noticias);
     TableRegistry::clear();
 }
 /**
  * reset environment.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     Plugin::load(array('TestPlugin', 'TestPluginTwo'));
     $this->Case = $this->getMockForAbstractClass('Cake\\TestSuite\\ControllerTestCase');
     $this->Case->loadRoutes = false;
     DispatcherFactory::add('Routing');
     DispatcherFactory::add('ControllerFactory');
     Router::scope('/', function ($routes) {
         $routes->fallbacks();
     });
     Router::prefix('admin', function ($routes) {
         $routes->plugin('TestPlugin', function ($routes) {
             $routes->fallbacks();
         });
         $routes->fallbacks();
     });
     Router::plugin('TestPlugin', function ($routes) {
         $routes->fallbacks();
     });
     Router::plugin('TestPluginTwo', function ($routes) {
         $routes->fallbacks();
     });
     TableRegistry::clear();
 }
示例#6
0
 public function tearDown()
 {
     TableRegistry::clear();
     Type::clear();
     Type::map($this->_map);
     parent::tearDown();
 }
 /**
  * endTest
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->Articles);
     unset($this->Posts);
     TableRegistry::clear();
 }
示例#8
0
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     unset($this->Task);
     TableRegistry::clear();
     parent::tearDown();
     Plugin::unload('ControllerTest');
 }
 /**
  * endTest
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->FileStorage);
     unset($this->FileStorageBehavior);
     TableRegistry::clear();
 }
 /**
  * End a test
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->Article);
     TableRegistry::clear();
     DebugTimer::clear();
 }
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     unset($this->Posts);
     unset($this->Behavior);
     ResolvableAuthorizationInstance::reset();
     TableRegistry::clear();
     parent::tearDown();
 }
示例#12
0
 /**
  * tearDown
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->Model);
     TableRegistry::clear();
     $folder = new Folder(WWW_ROOT . 'upload');
     $folder->delete(WWW_ROOT . 'upload');
 }
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     unset($this->SeoBehavior);
     unset($this->Articles);
     unset($this->router);
     parent::tearDown();
     TableRegistry::clear();
 }
 /**
  * setup
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     TableRegistry::clear();
     $this->Users = TableRegistry::get('Users', ['className' => 'TestApp\\Model\\Table\\UsersTable']);
     $this->UserBehavior = $this->getMockBuilder('\\Burzum\\UserTools\\Model\\Behavior\\UserBehavior')->setConstructorArgs([$this->Users])->setMethods(['getMailer'])->getMock();
     $this->MockMailer = $this->getMockBuilder('Burzum\\UserTools\\Mailer\\UsersMailer')->setMethods(['send'])->getMock();
 }
 /**
  * setup
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->Collection = $this->getMock('Cake\\Controller\\ComponentRegistry');
     $this->auth = new OAuthAuthenticate($this->Collection, ['userModel' => 'Users']);
     TableRegistry::clear();
     $this->response = $this->getMock('Cake\\Network\\Response');
 }
 /**
  * setup
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     TableRegistry::clear();
     $this->Articles = TableRegistry::get('Articles');
     Cache::config('default', ['className' => 'File', 'path' => CACHE, 'duration' => '+10 days']);
     Cache::delete('Related.attachedTables');
     Cache::delete('Related.indexedTables');
 }
 /**
  * reset environment.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     Plugin::load(array('TestPlugin', 'TestPluginTwo'));
     $this->Case = $this->getMockForAbstractClass('Cake\\TestSuite\\ControllerTestCase');
     Router::reload();
     TableRegistry::clear();
 }
示例#18
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $io = $this->getMock('Cake\\Console\\ConsoleIo', [], [], '', false);
     $this->Task = $this->getMock('Cake\\Console\\Command\\Task\\ModelTask', array('in', 'err', 'createFile', '_stop', '_checkUnitTest'), array($io));
     $this->Task->connection = 'test';
     $this->_setupOtherMocks();
     TableRegistry::clear();
 }
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     TableRegistry::clear();
     $this->ModelHistory = TableRegistry::get('ModelHistory', ['className' => 'ModelHistory\\Model\\Table\\ModelHistoryTable']);
     $this->Articles = TableRegistry::get('ArticlesTable', ['className' => 'ModelHistoryTestApp\\Model\\Table\\ArticlesTable']);
     if ($this->Articles->hasBehavior('Historizable')) {
         $this->Articles->removeBehavior('Historizable');
     }
 }
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->_compareBasePath = Plugin::path('Bake') . 'tests' . DS . 'comparisons' . DS . 'Model' . DS;
     $io = $this->getMock('Cake\\Console\\ConsoleIo', [], [], '', false);
     $this->Task = $this->getMock('Bake\\Shell\\Task\\ModelTask', ['in', 'err', 'createFile', '_stop', '_checkUnitTest'], [$io]);
     $this->Task->connection = 'default';
     $this->_setupOtherMocks();
     TableRegistry::clear();
 }
 /**
  * setup
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->Collection = $this->getMock('Cake\\Controller\\ComponentRegistry');
     $this->auth = new FormAuthenticate($this->Collection, ['userModel' => 'Users']);
     $password = password_hash('password', PASSWORD_DEFAULT);
     TableRegistry::clear();
     $Users = TableRegistry::get('Users');
     $Users->updateAll(['password' => $password], []);
     $this->response = $this->getMock('Cake\\Network\\Response');
 }
示例#22
0
 /**
  * setup
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->Collection = $this->getMockBuilder(ComponentRegistry::class)->getMock();
     $this->auth = new FormAuthenticate($this->Collection, ['userModel' => 'Users']);
     $password = password_hash('password', PASSWORD_DEFAULT);
     TableRegistry::clear();
     $Users = TableRegistry::get('Users');
     $Users->updateAll(['password' => $password], []);
     $AuthUsers = TableRegistry::get('AuthUsers', ['className' => 'TestApp\\Model\\Table\\AuthUsersTable']);
     $AuthUsers->updateAll(['password' => $password], []);
     $this->response = $this->getMockBuilder(Response::class)->getMock();
 }
 /**
  * test that schema is created on-demand.
  *
  * @return void
  */
 public function testInitializeCreatesSchema()
 {
     $connection = ConnectionManager::get('test');
     $this->skipIf($connection->driver() instanceof Sqlite, 'Schema insertion/removal breaks SQLite');
     TableRegistry::clear();
     $stmt = $connection->execute('DROP TABLE IF EXISTS panels');
     $stmt->closeCursor();
     $stmt = $connection->execute('DROP TABLE IF EXISTS requests');
     $stmt->closeCursor();
     TableRegistry::get('DebugKit.Requests');
     TableRegistry::get('DebugKit.Panels');
     $schema = $connection->schemaCollection();
     $this->assertContains('requests', $schema->listTables());
     $this->assertContains('panels', $schema->listTables());
 }
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->request = new Request();
     $this->response = new Response();
     $this->Controller = new AuthTestController($this->request, $this->response);
     $this->protectedMethodCall($this->Controller->Auth, '_setDefaults');
     $this->ComponentRegistry = new ComponentRegistry($this->Controller);
     $this->auth = new FormAuthenticate($this->ComponentRegistry);
     $password = password_hash('password', PASSWORD_DEFAULT);
     TableRegistry::clear();
     $Users = TableRegistry::get('Users');
     $Users->updateAll(['password' => $password], []);
     $AuthUsers = TableRegistry::get('AuthUsers', ['className' => 'TwoFactorAuth\\Test\\App\\Model\\Table\\AuthUsersTable']);
     $AuthUsers->updateAll(['password' => $password], []);
 }
示例#25
0
 /**
  * teardown
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     unset($this->Addresses, $this->Addresses);
     TableRegistry::clear();
 }
示例#26
0
 /**
  * Tear down
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     TableRegistry::clear();
 }
 /**
  * endTest method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     $this->session->destroy();
     unset($this->Controller);
     TableRegistry::clear();
 }
示例#28
0
 /**
  * Teardown
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     TableRegistry::clear();
     unset($this->articles, $this->comments);
 }
示例#29
0
 /**
  * Bake a table class.
  *
  * @param \Cake\ORM\Table $model Model name or object
  * @param array $data An array to use to generate the Table
  * @return string
  */
 public function bakeTable($model, array $data = [])
 {
     if (!empty($this->params['no-table'])) {
         return;
     }
     $namespace = Configure::read('App.namespace');
     $pluginPath = '';
     if ($this->plugin) {
         $namespace = $this->_pluginNamespace($this->plugin);
     }
     $name = $model->alias();
     $entity = $this->_entityName($model->alias());
     $data += ['plugin' => $this->plugin, 'pluginPath' => $pluginPath, 'namespace' => $namespace, 'name' => $name, 'entity' => $entity, 'associations' => [], 'primaryKey' => 'id', 'displayField' => null, 'table' => null, 'validation' => [], 'rulesChecker' => [], 'behaviors' => [], 'connection' => $this->connection];
     $this->BakeTemplate->set($data);
     $out = $this->BakeTemplate->generate('Model/table');
     $path = $this->getPath();
     $filename = $path . 'Table' . DS . $name . 'Table.php';
     $this->out("\n" . sprintf('Baking table class for %s...', $name), 1, Shell::QUIET);
     $this->createFile($filename, $out);
     // Work around composer caching that classes/files do not exist.
     // Check for the file as it might not exist in tests.
     if (file_exists($filename)) {
         require_once $filename;
     }
     TableRegistry::clear();
     $emptyFile = $path . 'Table' . DS . 'empty';
     $this->_deleteEmptyFile($emptyFile);
     return $out;
 }
示例#30
0
 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     TableRegistry::clear();
     unset($this->Behavior, $this->Songs);
 }