public function test_setup() { $TestSetup = new AkUnitTest(); $TestSetup->installAndIncludeModels(array('Post', 'Comment', 'Tag')); $Post =& $TestSetup->Post->create(array('title' => 'One', 'body' => 'First post')); foreach (range(1, 5) as $n) { $Post->comment->add(new Comment(array('body' => AkInflector::ordinalize($n) . ' post'))); } $Post->save(); $Post->reload(); $Post->comment->load(); $this->assertEqual($Post->comment->count(), 5); $this->post_id = $Post->id; }
public function __construct() { parent::__construct(); if (!$this->skip_helper_instantation) { $this->Helper = $this->getHelperInstance(); } }
function test_AkActiveRecord_validators() { parent::UnitTestCase(); $this->_createNewTestingModelDatabase('AkTestPerson'); $this->_createNewTestingModel('AkTestPerson'); $this->installAndIncludeModels(array('Picture', 'Landlord')); }
public function __destruct() { if (!ADMIN_PLUGIN_RUNNING_ON_APPLICATION_SCOPE) { AdminPluginInstaller::setTokenKey('some long and random secret value to avoid being hacked, used for login urls and API calls'); } parent::__destruct(); AkUnitTestSuite::cleanupTmpDir(); $this->dropTables('all'); }
public function test_should_run_migration_up_and_down() { $unit_tester = new AkUnitTest(); $unit_tester->includeAndInstatiateModels('Picture'); $this->assertTrue($unit_tester->Picture->create(array('title' => __FUNCTION__))); $this->assertTrue($unit_tester->Picture->find('first', array('title' => __FUNCTION__))); $unit_tester->uninstallAndInstallMigration('Picture'); $this->assertNoErrors(); $this->assertFalse($unit_tester->Picture->find('all')); }
function test_should_fill_the_table_with_yaml_data() { $unit_tester = new AkUnitTest(); $unit_tester->installAndIncludeModels(array('TheModel' => 'id,name')); $TheModel =& $unit_tester->TheModel; $TheModel->create(array('name' => 'eins')); $TheModel->create(array('name' => 'zwei')); $TheModel->create(array('name' => 'drei')); $TheModel->create(array('name' => 'vier')); $this->assertEqual($TheModel->count(), 4); $this->assertTrue($AllRecords = $TheModel->find()); $yaml = $TheModel->toYaml($AllRecords); $this->assertFalse(file_exists(AK_TEST_DIR . DS . 'fixtures' . DS . 'data' . DS . 'the_models.yaml')); Ak::file_put_contents(AK_TEST_DIR . DS . 'fixtures' . DS . 'data' . DS . 'the_models.yaml', $yaml); $unit_tester->installAndIncludeModels(array('TheModel' => 'id,name')); $this->assertFalse($TheModel->find()); $this->assertEqual($TheModel->count(), 0); $unit_tester->installAndIncludeModels(array('TheModel' => 'id,name'), array('populate' => true)); $this->assertEqual($TheModel->count(), 4); unlink(AK_TEST_DIR . DS . 'fixtures' . DS . 'data' . DS . 'the_models.yaml'); }
public function __destruct() { $TestSetup = new AkUnitTest(); $TestSetup->dropTables('all'); }
public function __destruct() { parent::__destruct(); }
protected function _enableAssertions() { parent::_enableAssertions(); $this->extendClassLazily('AkRoutingAssertions', array('methods' => array('assertRecognizes', 'assertGenerates', 'assertRouting', 'nextAssertionUsingRouter', 'recognizeRouteForPath'), 'autoload_path' => dirname(__FILE__) . DS . 'assertions' . DS . 'routing_assertions.php')); }
public function __destruct() { parent::__destruct(); AkUnitTestSuite::cleanupTmpDir(); $this->dropTables('all'); }
public function __destruct() { parent::__destruct(); AkUnitTestSuite::cleanupTmpDir(); }
function test_AkActiveRecord_actsAsNestedSet() { parent::UnitTestCase(); $this->_createNewTestingModelDatabase('AkTestNestedCategory'); $this->_createNewTestingModel('AkTestNestedCategory'); }
function test_AkActiveRecord_actsAsList() { parent::UnitTestCase(); $this->_createNewTestingModelDatabase('AkTestTodoItem'); $this->_createNewTestingModel('AkTestTodoItem'); }
public function test_should_run_migration_up_and_down() { $unit_tester = new AkUnitTest(); $unit_tester->includeAndInstatiateModels('DummyPicture'); $this->assertTrue($unit_tester->DummyPicture->create(array('title' => __FUNCTION__))); $this->assertTrue($unit_tester->DummyPicture->find('first', array('title' => __FUNCTION__))); $unit_tester->uninstallAndInstallMigration('DummyPicture'); $this->expectException('RecordNotFoundException'); $unit_tester->DummyPicture->find('all'); }