Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementing REDIRECTTEST: Add section class and test
- Loading branch information
zoe slattery
committed
May 20, 2012
1 parent
06ec4c5
commit fd9a5da
Showing
9 changed files
with
71 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,31 @@ | |||
<?php | |||
class rtIsNotRedirected implements rtTestPreCondition | |||
{ | |||
|
|||
/** Return the message associated with a redirected test section | |||
* | |||
* @return text | |||
*/ | |||
public function getMessage() | |||
{ | |||
return rtText::get('isRedirected'); | |||
} | |||
|
|||
/** | |||
* Check whether there is a REDIRECT section | |||
* | |||
* @param array $testCaseContents, array $sectionHeaders | |||
* @return boolean | |||
*/ | |||
public function isMet(array $testContents, array $sectionHeaders) | |||
{ | |||
foreach ($sectionHeaders as $section) { | |||
|
|||
if ($section == "REDIRECTTEST") { | |||
return false; | |||
} | |||
} | |||
return true; | |||
} | |||
} | |||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
This test has a REDIRECTTEST section |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,23 @@ | |||
<?php | |||
require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; | |||
|
|||
class rtIsNotRedirectedTest extends PHPUnit_Framework_TestCase | |||
{ | |||
public function testIs() | |||
{ | |||
$precondition = new rtIsNotRedirected(); | |||
$test = array('TEST', 'FILE', 'EXPECT'); | |||
|
|||
$this->assertTrue($precondition->isMet(array(), $test)); | |||
} | |||
|
|||
public function testIsNot() | |||
{ | |||
$precondition = new rtIsNotRedirected(); | |||
$test = array('UEXPECT', 'REDIRECTTEST'); | |||
|
|||
$this->assertEquals("This test has a REDIRECTTEST section", trim($precondition->getMessage())); | |||
$this->assertFalse($precondition->isMet(array(), $test)); | |||
} | |||
} | |||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters