Skip to content

Commit d595140

Browse files
committed
Fix tests and phpstan check
1 parent 7d66077 commit d595140

33 files changed

+97
-29
lines changed

tests/BC/AccessableTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public function getKeys()
5959
}
6060
};
6161

62+
/** @phpstan-ignore-next-line */
6263
$this->assertInstanceOf(Accessable::class, $class);
6364
}
6465
}

tests/BC/ElementTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public function testBcForElementInterface(): void
3838
public function __construct($data, Manager $manager, Accessable $parent) {}
3939
};
4040

41+
/** @phpstan-ignore-next-line */
4142
$this->assertInstanceOf(Element::class, $class);
4243
}
4344
}

tests/BC/Exception/ExceptionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function testBcForExceptionInterface(): void
2525
*/
2626
$class = new class implements Exception {};
2727

28+
/** @phpstan-ignore-next-line */
2829
$this->assertInstanceOf(Exception::class, $class);
2930
}
3031
}

tests/BC/FactoryTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public function make($name, array $args = [])
3838
}
3939
};
4040

41+
/** @phpstan-ignore-next-line */
4142
$this->assertInstanceOf(Factory::class, $class);
4243
}
4344
}

tests/BC/Input/InputTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ public function testBcForInputInterface(): void
3030
* This should be a native PH stdClass object, so Manager could
3131
* iterate over all public attributes
3232
*
33-
* @throws \Art4\JsonApiClient\Exception\InputException if something went wrong with the input
34-
*
3533
* @return \stdClass
3634
*/
3735
public function getAsObject()
@@ -40,6 +38,7 @@ public function getAsObject()
4038
}
4139
};
4240

41+
/** @phpstan-ignore-next-line */
4342
$this->assertInstanceOf(Input::class, $class);
4443
}
4544
}

tests/BC/Input/RequestInputTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function testBcForRequestInputInterface(): void
2525
*/
2626
$class = new class implements RequestInput {};
2727

28+
/** @phpstan-ignore-next-line */
2829
$this->assertInstanceOf(RequestInput::class, $class);
2930
}
3031
}

tests/BC/ManagerTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ public function testBcForManagerInterface(): void
3030
*
3131
* @param \Art4\JsonApiClient\Input\Input $input
3232
*
33-
* @throws \Art4\JsonApiClient\Exception\InputException If $input contains invalid JSON API
34-
* @throws \Art4\JsonApiClient\Exception\ValidationException If $input contains invalid JSON API
35-
*
3633
* @return \Art4\JsonApiClient\Accessable
3734
*/
3835
public function parse(Input $input)
@@ -64,6 +61,7 @@ public function getParam($key, $default)
6461
}
6562
};
6663

64+
/** @phpstan-ignore-next-line */
6765
$this->assertInstanceOf(Manager::class, $class);
6866
}
6967
}

tests/BC/Serializer/SerializerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public function serialize(Accessable $data)
3838
}
3939
};
4040

41+
/** @phpstan-ignore-next-line */
4142
$this->assertInstanceOf(Serializer::class, $class);
4243
}
4344
}

tests/Fixtures/HelperTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public function setUpManagerMock(): void
166166

167167
$this->manager->expects($this->any())
168168
->method('getFactory')
169-
->will($this->returnValue($factory));
169+
->willReturn($factory);
170170

171171
$this->manager->expects($this->any())
172172
->method('getParam')
@@ -177,7 +177,7 @@ public function setUpManagerMock(): void
177177
/**
178178
* returns a json string from a file
179179
*/
180-
protected function getJsonString(mixed $filename): string
180+
protected function getJsonString(string $filename): string
181181
{
182182
return strval(file_get_contents(__DIR__ . '/../files/' . $filename));
183183
}

tests/Fixtures/V1Factory.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace Art4\JsonApiClient\Tests\Fixtures;
1010

1111
use Art4\JsonApiClient\Factory as FactoryInterface;
12+
use PHPUnit\Framework\MockObject\MockBuilder;
1213
use PHPUnit\Framework\TestCase;
1314

1415
final class V1Factory implements FactoryInterface
@@ -33,11 +34,9 @@ public function __construct(TestCase $testcase)
3334
*/
3435
public function make($name, array $args = [])
3536
{
36-
return $this->testcase->getMockBuilder(AccessableElement::class)
37+
return (new MockBuilder($this->testcase, AccessableElement::class))
3738
->disableOriginalConstructor()
3839
->disableOriginalClone()
39-
->disableArgumentCloning()
40-
->disallowMockingUnknownTypes()
4140
->getMock();
4241
}
4342
}

0 commit comments

Comments
 (0)