Skip to content
Snippets Groups Projects
Commit c5d15298 authored by David Prévot's avatar David Prévot
Browse files

New upstream version 2.4.0

parent ec6a00a8
No related branches found
No related tags found
No related merge requests found
Pipeline #830864 failed
......@@ -13,6 +13,7 @@ jobs:
strategy:
matrix:
php-version:
- '8.4'
- '8.3'
- '8.2'
- '8.1'
......
......@@ -23,10 +23,10 @@
"require": {
"php": ">=5.6",
"php-mock/php-mock": "^2.5",
"phpunit/php-text-template": "^1 || ^2 || ^3 || ^4"
"phpunit/php-text-template": "^1 || ^2 || ^3 || ^4 || ^5"
},
"require-dev": {
"phpunit/phpunit": "^5.7.27 || ^6 || ^7 || ^8 || ^9 || ^10 || ^11"
"phpunit/phpunit": "^5.7.27 || ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12"
},
"archive": {
"exclude": ["/tests"]
......
......@@ -71,6 +71,9 @@ class MockDelegateFunctionBuilderTest extends TestCase
*
* @doesNotPerformAssertions
*/
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
#[\PHPUnit\Framework\Attributes\DataProvider('provideTestBackupStaticAttributes')]
#[\PHPUnit\Framework\Attributes\BackupStaticProperties(true)]
public function testBackupStaticAttributes()
{
$builder = new MockDelegateFunctionBuilder();
......@@ -97,12 +100,14 @@ class MockDelegateFunctionBuilderTest extends TestCase
*
* @doesNotPerformAssertions
*/
#[\PHPUnit\Framework\Attributes\RunInSeparateProcess]
#[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions]
public function testDeserializationInNewProcess()
{
$builder = new MockDelegateFunctionBuilder();
$builder->build("min");
$data = serialize($this->getMockForAbstractClass($builder->getFullyQualifiedClassName()));
$data = serialize($this->getMockBuilder($builder->getFullyQualifiedClassName())->getMock());
unserialize($data);
}
......
......@@ -35,11 +35,21 @@ class MockDelegateFunctionTest extends TestCase
*
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function testDelegateReturnsMockResult()
{
$expected = 3;
$mock = $this->getMockForAbstractClass($this->className);
$expected = 3;
$mockBuilder = $this->getMockBuilder($this->className);
// `setMethods` is gone from phpunit 10, alternative is `onlyMethods`
if (method_exists($mockBuilder, 'onlyMethods')) {
$mockBuilder->onlyMethods([MockDelegateFunctionBuilder::METHOD]);
} else {
$mockBuilder->setMethods([MockDelegateFunctionBuilder::METHOD]);
}
$mock = $mockBuilder->getMock();
$mock->expects($this->once())
->method(MockDelegateFunctionBuilder::METHOD)
->willReturn($expected);
......@@ -53,14 +63,24 @@ class MockDelegateFunctionTest extends TestCase
*
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function testDelegateForwardsArguments()
{
$mock = $this->getMockForAbstractClass($this->className);
$mockBuilder = $this->getMockBuilder($this->className);
// `setMethods` is gone from phpunit 10, alternative is `onlyMethods`
if (method_exists($mockBuilder, 'onlyMethods')) {
$mockBuilder->onlyMethods([MockDelegateFunctionBuilder::METHOD]);
} else {
$mockBuilder->setMethods([MockDelegateFunctionBuilder::METHOD]);
}
$mock = $mockBuilder->getMock();
$mock->expects($this->once())
->method(MockDelegateFunctionBuilder::METHOD)
->with(1, 2);
call_user_func($mock->getCallable(), 1, 2);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment