Skip to content
Permalink
Browse files

Adding tests for CakeTestCase fixtures

  • Loading branch information...
lorenzo committed May 8, 2010
1 parent 5d041c5 commit 2b5cd26fc6faf3022a5180d6b0c7a35486983045
Showing with 26 additions and 6 deletions.
  1. +8 −6 cake/tests/cases/libs/cake_test_case.test.php
  2. +18 −0 cake/tests/fixtures/fixturized_test_case.php
@@ -119,13 +119,15 @@ function testBadAssertTags() {
*/
function testLoadFixtures() {
$test = new FixturizedTestCase('testFixturePresent');
$manager = $this->getMock('CakeFixtureManager');
$manager->fixturize($test);
$test->sharedFixture = $manager;
$manager->expects($this->once())->method('load');
$manager->expects($this->once())->method('unload');
$result = $test->run();
//$this->Case->fixtures = array('core.post');
//$this->Case->autoFixtures = false;
//$this->Case->before('start');
//$this->expectError();
//$this->Case->loadFixtures('Wrong!');
//$this->Case->end();
$this->assertEquals(0, $result->errorCount());
$this->assertTrue($result->wasSuccessful());
$this->assertEquals(0, $result->failureCount());
}
/**
@@ -0,0 +1,18 @@
<?php
/**
* This class helps in testing the life-cycle of fixtures inside a CakeTestCase
*
* @package cake
* @subpackage cake.tests.fixtures
*/
class FixturizedTestCase extends CakeTestCase {
public $name = 'FixturizedTestCase';
public $fixtures = array('core.category');
public function testFixturePresent() {
$this->assertType('CakeFixtureManager', $this->sharedFixture);
//debug($this->sharedFixture);
}
}

0 comments on commit 2b5cd26

Please sign in to comment.
You can’t perform that action at this time.