pictcode / lib / Cake / Test / Fixture / FixturizedTestCase.php @ 1a69c38c
履歴 | 表示 | アノテート | ダウンロード (1.179 KB)
| 1 | 635eef61 | spyder1211 | <?php
 | 
      
|---|---|---|---|
| 2 | /**
 | 
      ||
| 3 |  * This class helps in testing the life-cycle of fixtures inside a CakeTestCase
 | 
      ||
| 4 |  *
 | 
      ||
| 5 |  * @package       Cake.Test.Fixture
 | 
      ||
| 6 |  */
 | 
      ||
| 7 | class FixturizedTestCase extends CakeTestCase {  | 
      ||
| 8 | |||
| 9 | /**
 | 
      ||
| 10 |  * Fixtures to use in this thes
 | 
      ||
| 11 |  * @var array
 | 
      ||
| 12 |  */
 | 
      ||
| 13 | public $fixtures = array('core.category');  | 
      ||
| 14 | |||
| 15 | /**
 | 
      ||
| 16 |  * test that the shared fixture is correctly set
 | 
      ||
| 17 |  *
 | 
      ||
| 18 |  * @return void
 | 
      ||
| 19 |  */
 | 
      ||
| 20 | public function testFixturePresent() {  | 
      ||
| 21 | $this->assertInstanceOf('CakeFixtureManager', $this->fixtureManager);  | 
      ||
| 22 | }  | 
      ||
| 23 | |||
| 24 | /**
 | 
      ||
| 25 |  * test that it is possible to load fixtures on demand
 | 
      ||
| 26 |  *
 | 
      ||
| 27 |  * @return void
 | 
      ||
| 28 |  */
 | 
      ||
| 29 | public function testFixtureLoadOnDemand() {  | 
      ||
| 30 | $this->loadFixtures('Category');  | 
      ||
| 31 | }  | 
      ||
| 32 | |||
| 33 | /**
 | 
      ||
| 34 |  * test that a test is marked as skipped using skipIf and its first parameter evaluates to true
 | 
      ||
| 35 |  *
 | 
      ||
| 36 |  * @return void
 | 
      ||
| 37 |  */
 | 
      ||
| 38 | public function testSkipIfTrue() {  | 
      ||
| 39 | $this->skipIf(true);  | 
      ||
| 40 | }  | 
      ||
| 41 | |||
| 42 | /**
 | 
      ||
| 43 |  * test that a test is not marked as skipped using skipIf and its first parameter evaluates to false
 | 
      ||
| 44 |  *
 | 
      ||
| 45 |  * @return void
 | 
      ||
| 46 |  */
 | 
      ||
| 47 | public function testSkipIfFalse() {  | 
      ||
| 48 | $this->skipIf(false);  | 
      ||
| 49 | }  | 
      ||
| 50 | |||
| 51 | /**
 | 
      ||
| 52 |  * test that a fixtures are unoaded even if the test throws exceptions
 | 
      ||
| 53 |  *
 | 
      ||
| 54 |  * @return void
 | 
      ||
| 55 |  * @throws Exception
 | 
      ||
| 56 |  */
 | 
      ||
| 57 | public function testThrowException() {  | 
      ||
| 58 | throw new Exception();  | 
      ||
| 59 | }  | 
      ||
| 60 | }  |