예제 #1
0
 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;
 }
예제 #2
0
파일: testing.php 프로젝트: bermi/akelos
 public function __construct()
 {
     parent::__construct();
     if (!$this->skip_helper_instantation) {
         $this->Helper = $this->getHelperInstance();
     }
 }
예제 #3
0
    function test_AkActiveRecord_validators()
    {
        parent::UnitTestCase();
        $this->_createNewTestingModelDatabase('AkTestPerson');
        $this->_createNewTestingModel('AkTestPerson');

        $this->installAndIncludeModels(array('Picture', 'Landlord'));
    }
예제 #4
0
파일: config.php 프로젝트: bermi/admin
 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');
 }
예제 #5
0
파일: AkUnitTest.php 프로젝트: joeymetal/v1
 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'));
 }
예제 #6
0
파일: AkUnitTest.php 프로젝트: joeymetal/v1
 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');
 }
예제 #8
0
파일: config.php 프로젝트: bermi/akelos
 public function __destruct()
 {
     parent::__destruct();
 }
예제 #9
0
파일: controller.php 프로젝트: bermi/akelos
 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'));
 }
예제 #10
0
파일: config.php 프로젝트: bermi/akelos
 public function __destruct()
 {
     parent::__destruct();
     AkUnitTestSuite::cleanupTmpDir();
     $this->dropTables('all');
 }
예제 #11
0
파일: config.php 프로젝트: bermi/akelos
 public function __destruct()
 {
     parent::__destruct();
     AkUnitTestSuite::cleanupTmpDir();
 }
예제 #12
0
 function test_AkActiveRecord_actsAsNestedSet()
 {
     parent::UnitTestCase();
     $this->_createNewTestingModelDatabase('AkTestNestedCategory');
     $this->_createNewTestingModel('AkTestNestedCategory');
 }
예제 #13
0
 function test_AkActiveRecord_actsAsList()
 {
     parent::UnitTestCase();
     $this->_createNewTestingModelDatabase('AkTestTodoItem');
     $this->_createNewTestingModel('AkTestTodoItem');
 }
예제 #14
0
파일: unit_test.php 프로젝트: bermi/akelos
 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');
 }