Skip to content

Commit 980b1bc

Browse files
authored
chore: fix PHPUnit 10 compat (#489)
1 parent 23fb7be commit 980b1bc

14 files changed

+115
-106
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/.idea/
22
/.phpintel/
3+
/tests/.phpunit.cache/**
34
/tests/.phpunit.result.cache
45

56
# IntelliJ

composer.lock

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/PHPDraft/Model/Elements/Tests/ArrayStructureElementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testSuccessfulParse(string $object, ArrayStructureElement $expec
5353
*
5454
* @return array
5555
*/
56-
public function parseObjectProvider(): array
56+
public static function parseObjectProvider(): array
5757
{
5858
$return = [];
5959
$base1 = new ArrayStructureElement();

src/PHPDraft/Model/Elements/Tests/BasicStructureElementTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function testStringValue(mixed $value, mixed $string_value): void
7070
*
7171
* @return array
7272
*/
73-
public function stringValueProvider(): array
73+
public static function stringValueProvider(): array
7474
{
7575
$return = [];
7676

@@ -134,7 +134,7 @@ public function testParseCommon($value, BasicStructureElement $expected_value):
134134
$this->assertEquals([], $dep);
135135
}
136136

137-
public function parseValueProvider(): array
137+
public static function parseValueProvider(): array
138138
{
139139
$return = [];
140140

src/PHPDraft/Model/Elements/Tests/EnumStructureElementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function testSuccessfulParse(string $object, EnumStructureElement $expect
141141
*
142142
* @return array
143143
*/
144-
public function parseObjectProvider(): array
144+
public static function parseObjectProvider(): array
145145
{
146146
$value1 = new ElementStructureElement();
147147
$value1->value = 'item';

src/PHPDraft/Model/Elements/Tests/ObjectStructureElementTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function testNewInstance(): void
5757
*
5858
* @covers \PHPDraft\Model\Elements\ObjectStructureElement::parse
5959
*/
60-
public function testSuccesfulParse(string $object, ObjectStructureElement $expected): void
60+
public function testSuccessfulParse(string $object, ObjectStructureElement $expected): void
6161
{
6262
$dep = [];
6363
$res = $this->class->parse(json_decode($object), $dep);
@@ -73,7 +73,7 @@ public function testSuccesfulParse(string $object, ObjectStructureElement $expec
7373
*
7474
* @return array
7575
*/
76-
public function parseObjectProvider(): array
76+
public static function parseObjectProvider(): array
7777
{
7878
$return = [];
7979
$base1 = new ObjectStructureElement();

src/PHPDraft/Model/Elements/Tests/RequestBodyElementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function testSuccessfulParse(string $object, ObjectStructureElement $expe
135135
*
136136
* @return array
137137
*/
138-
public function parseObjectProvider(): array
138+
public static function parseObjectProvider(): array
139139
{
140140
$return = [];
141141
$base1 = new RequestBodyElement();

src/PHPDraft/Model/Tests/CategoryTest.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Class CategoryTest
1717
* @covers \PHPDraft\Model\Category
1818
*/
19-
class CategoryTest extends HierarchyElementChildTest
19+
class CategoryTest extends HierarchyElementChildTestBase
2020
{
2121
/**
2222
* Set up
@@ -38,6 +38,23 @@ public function tearDown(): void
3838
unset($this->reflection);
3939
}
4040

41+
/**
42+
* Test if the value the class is initialized with is correct
43+
* @covers \PHPDraft\Model\HierarchyElement
44+
*/
45+
public function testChildrenSetup(): void
46+
{
47+
$this->assertSame([], $this->class->children);
48+
}
49+
50+
/**
51+
* Test if the value the class is initialized with is correct
52+
*/
53+
public function testSetupCorrectly(): void
54+
{
55+
$this->assertPropertySame('parent', null);
56+
}
57+
4158
/**
4259
* Test if the value the class is initialized with is correct
4360
*/
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* This file contains the HierarchyElementChildTest.php
4+
* This file contains the HierarchyElementChildTestBase.php
55
*
66
* @package PHPDraft\Model
77
* @author Sean Molenaar<[email protected]>
@@ -17,7 +17,7 @@
1717
* Class HierarchyElementChildTest
1818
* @package PHPDraft\Model\Tests
1919
*/
20-
class HierarchyElementChildTest extends LunrBaseTest
20+
abstract class HierarchyElementChildTestBase extends LunrBaseTest
2121
{
2222
/**
2323
* Mock of the parent class
@@ -31,22 +31,4 @@ public function setUp(): void
3131
$this->parent = $this->getMockBuilder('\PHPDraft\Model\HierarchyElement')
3232
->getMock();
3333
}
34-
35-
/**
36-
* Test if the value the class is initialized with is correct
37-
*/
38-
public function testChildrenSetup(): void
39-
{
40-
$this->assertSame([], $this->class->children);
41-
}
42-
43-
/**
44-
* Test if the value the class is initialized with is correct
45-
*/
46-
public function testSetupCorrectly(): void
47-
{
48-
$property = $this->reflection->getProperty('parent');
49-
$property->setAccessible(true);
50-
$this->assertNull($property->getValue($this->class));
51-
}
5234
}

src/PHPDraft/Model/Tests/ObjectElementTest.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,57 @@
1616
*/
1717
class ObjectElementTest extends LunrBaseTest
1818
{
19+
/**
20+
* @covers \PHPDraft\Model\Elements\ObjectStructureElement
21+
*/
1922
public function testKeySetup(): void
2023
{
2124
$this->assertSame(null, $this->class->key);
2225
}
2326

27+
/**
28+
* @covers \PHPDraft\Model\Elements\ObjectStructureElement
29+
*/
2430
public function testTypeSetup(): void
2531
{
2632
$this->assertSame(null, $this->class->type);
2733
}
2834

35+
/**
36+
* @covers \PHPDraft\Model\Elements\ObjectStructureElement
37+
*/
2938
public function testDescriptionSetup(): void
3039
{
3140
$this->assertSame(null, $this->class->description);
3241
}
3342

43+
/**
44+
* @covers \PHPDraft\Model\Elements\ObjectStructureElement
45+
*/
3446
public function testElementSetup(): void
3547
{
3648
$this->assertSame(null, $this->class->element);
3749
}
3850

51+
/**
52+
* @covers \PHPDraft\Model\Elements\ObjectStructureElement
53+
*/
3954
public function testValueSetup(): void
4055
{
4156
$this->assertSame(null, $this->class->value);
4257
}
4358

59+
/**
60+
* @covers \PHPDraft\Model\Elements\ObjectStructureElement
61+
*/
4462
public function testStatusSetup(): void
4563
{
46-
$this->assertSame('', $this->class->status);
64+
$this->assertSame(null, $this->class->status);
4765
}
4866

67+
/**
68+
* @covers \PHPDraft\Model\Elements\ObjectStructureElement
69+
*/
4970
public function testDepsSetup(): void
5071
{
5172
$this->assertSame(null, $this->class->deps);

0 commit comments

Comments
 (0)