Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tests/Hamcrest/AbstractMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ abstract class AbstractMatcherTest extends TestCase
const ARGUMENT_IGNORED = "ignored";
const ANY_NON_NULL_ARGUMENT = "notnull";

/**
* @before
*/
protected function setUpTest()
{
MatcherAssert::resetCount();
}

abstract protected function createMatcher();

public function assertMatches(\Hamcrest\Matcher $matcher, $arg, $message)
Expand Down Expand Up @@ -46,6 +54,9 @@ public function assertMismatchDescription($expected, \Hamcrest\Matcher $matcher,
);
}

/**
* @doesNotPerformAssertions
*/
public function testIsNullSafe()
{
//Should not generate any notices
Expand All @@ -56,6 +67,9 @@ public function testIsNullSafe()
);
}

/**
* @doesNotPerformAssertions
*/
public function testCopesWithUnknownTypes()
{
//Should not generate any notices
Expand All @@ -65,4 +79,12 @@ public function testCopesWithUnknownTypes()
new NullDescription()
);
}

/**
* @after
*/
protected function tearDownTest()
{
$this->addToAssertionCount(MatcherAssert::getCount());
}
}
2 changes: 2 additions & 0 deletions tests/Hamcrest/Core/CombinableMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class CombinableMatcherTest extends \Hamcrest\AbstractMatcherTest
*/
protected function setUpTest()
{
parent::setUpTest();

$this->_either_3_or_4 = \Hamcrest\Core\CombinableMatcher::either(equalTo(3))->orElse(equalTo(4));
$this->_not_3_and_not_4 = \Hamcrest\Core\CombinableMatcher::both(not(equalTo(3)))->andAlso(not(equalTo(4)));
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Hamcrest/Core/IsInstanceOfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class IsInstanceOfTest extends \Hamcrest\AbstractMatcherTest
*/
protected function setUpTest()
{
parent::setUpTest();

$this->_baseClassInstance = new \Hamcrest\Core\SampleBaseClass('good');
$this->_subClassInstance = new \Hamcrest\Core\SampleSubClass('good');
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Hamcrest/Core/SetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class SetTest extends \Hamcrest\AbstractMatcherTest
*/
protected function setUpTest()
{
parent::setUpTest();

self::$_classProperty = null;
unset($this->_instanceProperty);
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Hamcrest/FeatureMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class FeatureMatcherTest extends \Hamcrest\AbstractMatcherTest
*/
protected function setUpTest()
{
parent::setUpTest();

$this->_resultMatcher = $this->_resultMatcher();
}

Expand Down
2 changes: 2 additions & 0 deletions tests/Hamcrest/Text/IsEqualIgnoringWhiteSpaceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class IsEqualIgnoringWhiteSpaceTest extends \Hamcrest\AbstractMatcherTest
*/
protected function setUpTest()
{
parent::setUpTest();

$this->_matcher = \Hamcrest\Text\IsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace(
"Hello World how\n are we? "
);
Expand Down
2 changes: 2 additions & 0 deletions tests/Hamcrest/Text/StringContainsIgnoringCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class StringContainsIgnoringCaseTest extends \Hamcrest\AbstractMatcherTest
*/
protected function setUpTest()
{
parent::setUpTest();

$this->_stringContains = \Hamcrest\Text\StringContainsIgnoringCase::containsStringIgnoringCase(
strtolower(self::EXCERPT)
);
Expand Down
2 changes: 2 additions & 0 deletions tests/Hamcrest/Text/StringContainsInOrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class StringContainsInOrderTest extends \Hamcrest\AbstractMatcherTest
*/
protected function setUpTest()
{
parent::setUpTest();

$this->_m = \Hamcrest\Text\StringContainsInOrder::stringContainsInOrder(array('a', 'b', 'c'));
}

Expand Down
2 changes: 2 additions & 0 deletions tests/Hamcrest/Text/StringContainsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class StringContainsTest extends \Hamcrest\AbstractMatcherTest
*/
protected function setUpTest()
{
parent::setUpTest();

$this->_stringContains = \Hamcrest\Text\StringContains::containsString(self::EXCERPT);
}

Expand Down
2 changes: 2 additions & 0 deletions tests/Hamcrest/Text/StringEndsWithTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class StringEndsWithTest extends \Hamcrest\AbstractMatcherTest
*/
protected function setUpTest()
{
parent::setUpTest();

$this->_stringEndsWith = \Hamcrest\Text\StringEndsWith::endsWith(self::EXCERPT);
}

Expand Down
2 changes: 2 additions & 0 deletions tests/Hamcrest/Text/StringStartsWithTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class StringStartsWithTest extends \Hamcrest\AbstractMatcherTest
*/
protected function setUpTest()
{
parent::setUpTest();

$this->_stringStartsWith = \Hamcrest\Text\StringStartsWith::startsWith(self::EXCERPT);
}

Expand Down
3 changes: 3 additions & 0 deletions tests/Hamcrest/UtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public function testWrapValueWithIsEqualWrapsPrimitive()
$this->assertTrue($matcher->matches('foo'));
}

/**
* @doesNotPerformAssertions
*/
public function testCheckAllAreMatchersAcceptsMatchers()
{
\Hamcrest\Util::checkAllAreMatchers(array(
Expand Down