Upgrade framework

This commit is contained in:
2023-11-14 16:54:35 +01:00
parent 1648a5cd42
commit 4fcf6fffcc
10548 changed files with 693138 additions and 466698 deletions

View File

@@ -1,10 +1,12 @@
<?php
namespace Hamcrest;
use PHPUnit\Framework\TestCase;
class UnknownType {
}
abstract class AbstractMatcherTest extends \PHPUnit_Framework_TestCase
abstract class AbstractMatcherTest extends TestCase
{
const ARGUMENT_IGNORED = "ignored";

View File

@@ -34,6 +34,10 @@ class IsArrayContainingInOrderTest extends AbstractMatcherTest
public function testMismatchesItemsInAnyOrder()
{
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('Broken on HHVM.');
}
$matcher = arrayContaining(array(1, 2, 3));
$this->assertMismatchDescription('was null', $matcher, null);
$this->assertMismatchDescription('No item matched: <1>', $matcher, array());

View File

@@ -7,7 +7,7 @@ class CombinableMatcherTest extends \Hamcrest\AbstractMatcherTest
private $_either_3_or_4;
private $_not_3_and_not_4;
public function setUp()
protected function setUp()
{
$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)));

View File

@@ -7,7 +7,7 @@ class IsInstanceOfTest extends \Hamcrest\AbstractMatcherTest
private $_baseClassInstance;
private $_subClassInstance;
public function setUp()
protected function setUp()
{
$this->_baseClassInstance = new \Hamcrest\Core\SampleBaseClass('good');
$this->_subClassInstance = new \Hamcrest\Core\SampleSubClass('good');

View File

@@ -34,7 +34,7 @@ class FeatureMatcherTest extends \Hamcrest\AbstractMatcherTest
private $_resultMatcher;
public function setUp()
protected function setUp()
{
$this->_resultMatcher = $this->_resultMatcher();
}

View File

@@ -0,0 +1,31 @@
<?php
namespace Hamcrest;
use PHPUnit\Framework\TestCase;
class SampleInvokeMatcher extends BaseMatcherTest
{
private $matchAgainst;
public function __construct($matchAgainst)
{
$this->matchAgainst = $matchAgainst;
}
public function matches($item)
{
return $item == $this->matchAgainst;
}
}
class InvokedMatcherTest extends TestCase
{
public function testInvokedMatchersCallMatches()
{
$sampleMatcher = new SampleInvokeMatcher('foo');
$this->assertTrue($sampleMatcher('foo'));
$this->assertFalse($sampleMatcher('bar'));
}
}

View File

@@ -1,7 +1,9 @@
<?php
namespace Hamcrest;
class MatcherAssertTest extends \PhpUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;
class MatcherAssertTest extends TestCase
{
protected function setUp()

View File

@@ -1,6 +1,8 @@
<?php
namespace Hamcrest;
use PHPUnit\Framework\TestCase;
class SampleSelfDescriber implements \Hamcrest\SelfDescribing
{
private $_text;
@@ -16,12 +18,12 @@ class SampleSelfDescriber implements \Hamcrest\SelfDescribing
}
}
class StringDescriptionTest extends \PhpUnit_Framework_TestCase
class StringDescriptionTest extends TestCase
{
private $_description;
public function setUp()
protected function setUp()
{
$this->_description = new \Hamcrest\StringDescription();
}

View File

@@ -6,7 +6,7 @@ class IsEqualIgnoringWhiteSpaceTest extends \Hamcrest\AbstractMatcherTest
private $_matcher;
public function setUp()
protected function setUp()
{
$this->_matcher = \Hamcrest\Text\IsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace(
"Hello World how\n are we? "

View File

@@ -8,7 +8,7 @@ class StringContainsIgnoringCaseTest extends \Hamcrest\AbstractMatcherTest
private $_stringContains;
public function setUp()
protected function setUp()
{
$this->_stringContains = \Hamcrest\Text\StringContainsIgnoringCase::containsStringIgnoringCase(
strtolower(self::EXCERPT)

View File

@@ -6,7 +6,7 @@ class StringContainsInOrderTest extends \Hamcrest\AbstractMatcherTest
private $_m;
public function setUp()
protected function setUp()
{
$this->_m = \Hamcrest\Text\StringContainsInOrder::stringContainsInOrder(array('a', 'b', 'c'));
}

View File

@@ -8,7 +8,7 @@ class StringContainsTest extends \Hamcrest\AbstractMatcherTest
private $_stringContains;
public function setUp()
protected function setUp()
{
$this->_stringContains = \Hamcrest\Text\StringContains::containsString(self::EXCERPT);
}

View File

@@ -8,7 +8,7 @@ class StringEndsWithTest extends \Hamcrest\AbstractMatcherTest
private $_stringEndsWith;
public function setUp()
protected function setUp()
{
$this->_stringEndsWith = \Hamcrest\Text\StringEndsWith::endsWith(self::EXCERPT);
}

View File

@@ -8,7 +8,7 @@ class StringStartsWithTest extends \Hamcrest\AbstractMatcherTest
private $_stringStartsWith;
public function setUp()
protected function setUp()
{
$this->_stringStartsWith = \Hamcrest\Text\StringStartsWith::startsWith(self::EXCERPT);
}

View File

@@ -25,6 +25,7 @@ class IsNumericTest extends \Hamcrest\AbstractMatcherTest
assertThat('0.053e-2', numericValue());
assertThat('-53.253e+25', numericValue());
assertThat('+53.253e+25', numericValue());
assertThat(0x4F2a04, numericValue());
assertThat('0x4F2a04', numericValue());
}
@@ -34,6 +35,9 @@ class IsNumericTest extends \Hamcrest\AbstractMatcherTest
assertThat('foo', not(numericValue()));
assertThat('foo5', not(numericValue()));
assertThat('5foo', not(numericValue()));
assertThat('0x42A04G', not(numericValue())); // G is not in the hexadecimal range.
assertThat('1x42A04', not(numericValue())); // 1x is not a valid hexadecimal sequence.
assertThat('0x', not(numericValue()));
}
public function testHasAReadableDescription()

View File

@@ -1,7 +1,9 @@
<?php
namespace Hamcrest;
class UtilTest extends \PhpUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;
class UtilTest extends TestCase
{
public function testWrapValueWithIsEqualLeavesMatchersUntouched()

View File

@@ -1,18 +1,11 @@
<?php
error_reporting(E_ALL | E_STRICT);
require __DIR__ . '/../vendor/autoload.php';
if (defined('E_DEPRECATED')) {
error_reporting(error_reporting() | E_DEPRECATED);
}
define('HAMCREST_TEST_BASE', realpath(dirname(__FILE__)));
define('HAMCREST_BASE', realpath(dirname(dirname(__FILE__))));
set_include_path(implode(PATH_SEPARATOR, array(
HAMCREST_TEST_BASE,
HAMCREST_BASE . '/hamcrest',
get_include_path()
)));
require_once 'Hamcrest.php';
Hamcrest\Util::registerGlobalFunctions();

View File

@@ -6,8 +6,7 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
stopOnFailure="false">
<testsuites>
<testsuite name="hamcrest-php">
<directory suffix="Test.php">.</directory>