Skip to content

Commit 01ec2c9

Browse files
committed
Use bundleted trait instead
1 parent 8436a48 commit 01ec2c9

10 files changed

+49
-10
lines changed

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
"json-schema/json-schema-test-suite": "1.2.0",
3737
"phpunit/phpunit": ">=4.8.36 <10",
3838
"sanmai/phpunit-legacy-adapter": "^6.4 || ^8.2.1",
39-
"phpspec/prophecy-phpunit": ">=1.0",
40-
"phpunitgoodpractices/polyfill": "^1.6"
39+
"phpspec/prophecy-phpunit": ">=1.0"
4140
},
4241
"extra": {
4342
"branch-alias": {

tests/ConstraintErrorTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
use JsonSchema\ConstraintError;
1313
use LegacyPHPUnit\TestCase;
14-
use PHPUnitGoodPractices\Polyfill\PolyfillTrait;
1514

1615
class ConstraintErrorTest extends TestCase
1716
{

tests/Constraints/FactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
use JsonSchema\Constraints\Constraint;
1313
use JsonSchema\Constraints\Factory;
1414
use JsonSchema\Entity\JsonPointer;
15+
use JsonSchema\Tests\PolyfillTrait;
1516
use LegacyPHPUnit\TestCase;
16-
use PHPUnitGoodPractices\Polyfill\PolyfillTrait;
1717

1818
/**
1919
* Class MyBadConstraint

tests/Constraints/SchemaValidationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
namespace JsonSchema\Tests\Constraints;
1111

1212
use JsonSchema\Constraints\Constraint;
13+
use JsonSchema\Tests\PolyfillTrait;
1314
use JsonSchema\Validator;
1415
use LegacyPHPUnit\TestCase;
15-
use PHPUnitGoodPractices\Polyfill\PolyfillTrait;
1616

1717
class SchemaValidationTest extends TestCase
1818
{

tests/Constraints/SelfDefinedSchemaTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
namespace JsonSchema\Tests\Constraints;
1111

12+
use JsonSchema\Tests\PolyfillTrait;
1213
use JsonSchema\Validator;
13-
use PHPUnitGoodPractices\Polyfill\PolyfillTrait;
1414

1515
class SelfDefinedSchemaTest extends BaseTestCase
1616
{

tests/Constraints/TypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
1313
use JsonSchema\Constraints\TypeConstraint;
14+
use JsonSchema\Tests\PolyfillTrait;
1415
use LegacyPHPUnit\TestCase;
15-
use PHPUnitGoodPractices\Polyfill\PolyfillTrait;
1616

1717
/**
1818
* Class TypeTest

tests/Constraints/ValidationExceptionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
use JsonSchema\Constraints\Constraint;
1313
use JsonSchema\Exception\ValidationException;
14+
use JsonSchema\Tests\PolyfillTrait;
1415
use JsonSchema\Validator;
1516
use LegacyPHPUnit\TestCase;
16-
use PHPUnitGoodPractices\Polyfill\PolyfillTrait;
1717

1818
class ValidationExceptionTest extends TestCase
1919
{

tests/Entity/JsonPointerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
namespace JsonSchema\Tests\Entity;
1111

1212
use JsonSchema\Entity\JsonPointer;
13+
use JsonSchema\Tests\PolyfillTrait;
1314
use LegacyPHPUnit\TestCase;
14-
use PHPUnitGoodPractices\Polyfill\PolyfillTrait;
1515

1616
/**
1717
* @package JsonSchema\Tests\Entity

tests/PolyfillTrait.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the JsonSchema package.
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
10+
namespace JsonSchema\Tests;
11+
12+
if (version_compare(\PHPUnit\Runner\Version::id(), '6.0.0') < 0) {
13+
/**
14+
* Inspired by https://github.com/PHPUnitGoodPractices/polyfill
15+
*
16+
* @license MIT
17+
*/
18+
trait PolyfillTrait
19+
{
20+
public function expectException($exception)
21+
{
22+
if (\is_callable(array(parent::class, 'expectException'))) {
23+
parent::expectException($exception);
24+
} else {
25+
$this->setExpectedException($exception);
26+
}
27+
}
28+
29+
public static function assertIsArray($actual, $message = '')
30+
{
31+
if (\is_callable(array(parent::class, 'assertIsArray'))) {
32+
parent::assertIsArray($actual, $message);
33+
} else {
34+
static::assertInternalType('array', $actual, $message);
35+
}
36+
}
37+
}
38+
} else {
39+
trait PolyfillTrait
40+
{
41+
}
42+
}

tests/RefTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
use JsonSchema\Validator;
1313
use LegacyPHPUnit\TestCase;
14-
use PHPUnitGoodPractices\Polyfill\PolyfillTrait;
1514

1615
class RefTest extends TestCase
1716
{

0 commit comments

Comments
 (0)