Skip to content

Commit 662d2eb

Browse files
Switch to Yoast PHP Polyfill (#235)
* Switch to Yoast PHP Polyfill * Polyfill and use newer assertions
1 parent 5932bbf commit 662d2eb

16 files changed

+70
-69
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
}
1919
},
2020
"require-dev": {
21-
"phpunit/phpunit": "^5.7",
2221
"mf2/tests": "dev-master#e9e2b905821ba0a5b59dab1a8eaf40634ce9cd49",
2322
"squizlabs/php_codesniffer": "^3.6.2",
2423
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
25-
"phpcompatibility/php-compatibility": "^9.3"
24+
"phpcompatibility/php-compatibility": "^9.3",
25+
"yoast/phpunit-polyfills": "^1.0"
2626
},
2727
"scripts": {
2828
"cs-check": "phpcs",

tests/Mf2/ClassicMicroformatsTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
use Mf2\Parser;
1010
use Mf2;
11-
use PHPUnit_Framework_TestCase;
11+
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
1212

1313
/**
1414
* Classic Microformats Test
@@ -17,8 +17,8 @@
1717
*
1818
* Mainly based off BC tables on http://microformats.org/wiki/microformats2#v2_vocabularies
1919
*/
20-
class ClassicMicroformatsTest extends PHPUnit_Framework_TestCase {
21-
public function setUp() {
20+
class ClassicMicroformatsTest extends TestCase {
21+
protected function set_up() {
2222
date_default_timezone_set('Europe/London');
2323
}
2424

tests/Mf2/CombinedMicroformatsTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
use Mf2\Parser;
66
use Mf2;
7-
use PHPUnit_Framework_TestCase;
7+
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
8+
use Yoast\PHPUnitPolyfills\Polyfills\AssertIsType;
89

910
/**
1011
* Combined Microformats Test
@@ -14,9 +15,10 @@
1415
*
1516
* @todo implement
1617
*/
17-
class CombinedMicroformatsTest extends PHPUnit_Framework_TestCase {
18+
class CombinedMicroformatsTest extends TestCase {
19+
use AssertIsType;
1820

19-
public function setUp() {
21+
protected function set_up() {
2022
date_default_timezone_set('Europe/London');
2123
}
2224

@@ -430,7 +432,7 @@ public function testEmptyPropertiesObjectInJSONMode() {
430432
// Repeat in non-JSON-mode: expect the raw PHP to be an array. Check that its serialization is not what we need for mf2 JSON.
431433
$parser = new Parser($input, null, false);
432434
$output = $parser->parse();
433-
$this->assertInternalType('array', $output['items'][0]['properties']);
435+
$this->assertIsArray($output['items'][0]['properties']);
434436
$this->assertSame('[]', json_encode($output['items'][0]['properties']));
435437
}
436438

tests/Mf2/MicroformatsTestSuiteTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Mf2\Parser\Test;
44

5+
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
6+
57
final class TestSuiteParser extends \Mf2\Parser
68
{
79
/** Actually textContent from before the whitespace normalisation merge (e8da04f93d548d26287a8980eca4216639cbc61d) */
@@ -49,7 +51,7 @@ private function _resolveChildUrls(\DOMElement $element) {
4951
}
5052
}
5153

52-
class MicroformatsTestSuiteTest extends \PHPUnit_Framework_TestCase
54+
class MicroformatsTestSuiteTest extends TestCase
5355
{
5456
/**
5557
* @dataProvider mf1TestsProvider

tests/Mf2/MicroformatsWikiExamplesTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace Mf2\Parser\Test;
88

99
use Mf2\Parser;
10-
use PHPUnit_Framework_TestCase;
10+
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
1111

1212
/**
1313
* Microformats Wiki Examples
@@ -19,9 +19,8 @@
1919
*
2020
* @author Barnaby Walters waterpigs.co.uk <barnaby@waterpigs.co.uk>
2121
*/
22-
class MicroformatsWikiExamplesTest extends PHPUnit_Framework_TestCase {
23-
24-
public function setUp() {
22+
class MicroformatsWikiExamplesTest extends TestCase {
23+
protected function set_up() {
2524
date_default_timezone_set('Europe/London');
2625
}
2726

@@ -179,7 +178,7 @@ public function testMoreDetailedPerson() {
179178
"type": ["h-card"],
180179
"properties": {
181180
"photo": [
182-
{
181+
{
183182
"value": "https://webfwd.org/content/about-experts/300.mitchellbaker/mentor_mbaker.jpg",
184183
"alt": "photo of Mitchell"
185184
}

tests/Mf2/ParseDTTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
namespace Mf2\Parser\Test;
88

99
use Mf2\Parser;
10-
use PHPUnit_Framework_TestCase;
10+
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
1111

12-
class ParseDTTest extends PHPUnit_Framework_TestCase {
13-
14-
public function setUp() {
12+
class ParseDTTest extends TestCase {
13+
protected function set_up() {
1514
date_default_timezone_set('Europe/London');
1615
}
1716

tests/Mf2/ParseHtmlIdTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77

88
use Mf2;
99
use Mf2\Parser;
10-
use PHPUnit_Framework_TestCase;
10+
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
1111

1212
/**
13-
*
13+
*
1414
*/
15-
class ParseHtmlIdTest extends PHPUnit_Framework_TestCase {
16-
public function setUp() {
15+
class ParseHtmlIdTest extends TestCase {
16+
protected function set_up() {
1717
date_default_timezone_set('Europe/London');
1818
}
1919

tests/Mf2/ParseImpliedTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@
77

88
use Mf2;
99
use Mf2\Parser;
10-
use PHPUnit_Framework_TestCase;
10+
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
1111

1212
/**
1313
* @todo some of these can be made into single tests with dataProviders
1414
*/
15-
class ParseImpliedTest extends PHPUnit_Framework_TestCase {
16-
public function setUp() {
15+
class ParseImpliedTest extends TestCase {
16+
protected function set_up() {
1717
date_default_timezone_set('Europe/London');
1818
}
1919

20-
2120
public function testParsesImpliedPNameFromNodeValue() {
2221
$input = '<span class="h-card">The Name</span>';
2322
$parser = new Parser($input);

tests/Mf2/ParseLanguageTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88

99
use Mf2\Parser;
1010
use Mf2;
11-
use PHPUnit_Framework_TestCase;
11+
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
1212

13-
class ParseLanguageTest extends PHPUnit_Framework_TestCase {
14-
15-
public function setUp() {
13+
class ParseLanguageTest extends TestCase {
14+
protected function set_up() {
1615
date_default_timezone_set('Europe/London');
1716
}
1817

tests/Mf2/ParsePTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88

99
use Mf2;
1010
use Mf2\Parser;
11-
use PHPUnit_Framework_TestCase;
11+
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
1212

1313

14-
class ParsePTest extends PHPUnit_Framework_TestCase {
15-
16-
public function setUp() {
14+
class ParsePTest extends TestCase {
15+
protected function set_up() {
1716
date_default_timezone_set('Europe/London');
1817
}
1918

0 commit comments

Comments
 (0)