Skip to content

Commit

Permalink
Adding tests for CakeTestCase fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed May 8, 2010
1 parent 5d041c5 commit 2b5cd26
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cake/tests/cases/libs/cake_test_case.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

/**
Expand Down
18 changes: 18 additions & 0 deletions cake/tests/fixtures/fixturized_test_case.php
Original file line number Diff line number Diff line change
@@ -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.