Skip to content

Commit

Permalink
Adding tests for skipIf
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed May 8, 2010
1 parent 4d3a6e8 commit fb09adc
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cake/tests/cases/libs/cake_test_case.test.php
Expand Up @@ -4,7 +4,7 @@
*
* Test Case for CakeTestCase class
*
* PHP versions 4 and 5
* PHP version 5
*
* CakePHP : Rapid Development Framework (http://cakephp.org)
* Copyright 2006-2010, Cake Software Foundation, Inc.
Expand Down Expand Up @@ -153,9 +153,13 @@ function testLoadFixturesOnDemand() {
* @return void
*/
function testSkipIf() {
//$this->Case = new SubjectCakeTestCase;
//$this->assertTrue($this->Case->skipIf(true));
//$this->assertFalse($this->Case->skipIf(false));
$test = new FixturizedTestCase('testSkipIfTrue');
$result = $test->run();
$this->assertEquals(1, $result->skippedCount());

$test = new FixturizedTestCase('testSkipIfFalse');
$result = $test->run();
$this->assertEquals(0, $result->skippedCount());
}
}
?>
3 changes: 3 additions & 0 deletions cake/tests/fixtures/assert_tags_test_case.php
@@ -1,4 +1,7 @@
<?php

PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'DEFAULT');

/**
* This class helpes in indirectly testing the functionaliteies of CakeTestCase::assertTags
*
Expand Down
35 changes: 35 additions & 0 deletions cake/tests/fixtures/fixturized_test_case.php
@@ -1,4 +1,7 @@
<?php

PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'DEFAULT');

/**
* This class helps in testing the life-cycle of fixtures inside a CakeTestCase
*
Expand All @@ -7,13 +10,45 @@
*/
class FixturizedTestCase extends CakeTestCase {

/**
* Fixtures to use in this thes
* @var array
*/
public $fixtures = array('core.category');

/**
* test that the shared fixture is correctly set
*
* @return void
*/
public function testFixturePresent() {
$this->assertType('CakeFixtureManager', $this->sharedFixture);
}

/**
* test that it is possible to load fixtures on demand
*
* @return void
*/
public function testFixtureLoadOnDemand() {
$this->loadFixtures('Category');
}

/**
* test that a test is marked as skipped using skipIf and its first parameter evaluates to true
*
* @return void
*/
public function testSkipIfTrue() {
$this->skipIf(true);
}

/**
* test that a test is not marked as skipped using skipIf and its first parameter evaluates to false
*
* @return void
*/
public function testSkipIfFalse() {
$this->skipIf(false);
}
}

0 comments on commit fb09adc

Please sign in to comment.