Skip to content
Snippets Groups Projects
Commit 08f584f8 authored by Anja Leichsenring's avatar Anja Leichsenring Committed by Georg Ringer
Browse files

[BUGFIX] Fix tests with phpunit 8.3.2

The new minor version of phpunit comes with a (probably) bug in their
mock API that causes errors in reflection and ClassSchema construction.
Also, partial mock with a function that does not exist, will now throw
a warning.

Resolves: #88910
Releases: master
Change-Id: Ic43fc0f72f2f5cab97a7907f4f66ffe82516300b
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61433


Reviewed-by: default avatarSusanne Moog <look@susi.dev>
Reviewed-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
parent 87837b5a
Branches
Tags
No related merge requests found
......@@ -115,13 +115,28 @@ class JsonViewTest extends UnitTestCase
$output[] = [$object, $configuration, $expected, 'array of objects should be serialized'];
$properties = ['foo' => 'bar', 'prohibited' => 'xxx'];
$nestedObject = $this->getMockBuilder($this->getUniqueId('Test'))
->setMethods(['getName', 'getPath', 'getProperties', 'getOther'])
->getMock();
$nestedObject->expects($this->any())->method('getName')->will($this->returnValue('name'));
$nestedObject->expects($this->any())->method('getPath')->will($this->returnValue('path'));
$nestedObject->expects($this->any())->method('getProperties')->will($this->returnValue($properties));
$nestedObject->expects($this->never())->method('getOther');
$nestedObject = new class($properties) {
private $properties;
private $prohibited;
public function __construct($properties)
{
$this->properties = $properties;
}
public function getName()
{
return 'name';
}
public function getPath()
{
return 'path';
}
public function getProperties()
{
return $this->properties;
}
};
$object = $nestedObject;
$configuration = [
'_only' => ['name', 'path', 'properties'],
......
......@@ -351,7 +351,7 @@ class DataMapperTest extends UnitTestCase
public function getPlainValueReturnsCorrectDateTimeFormat()
{
/** @var DataMapper $subject */
$subject = $this->createPartialMock(DataMapper::class, ['dummy']);
$subject = $this->createPartialMock(DataMapper::class, []);
$columnMap = new ColumnMap('column_name', 'propertyName');
$columnMap->setDateTimeStorageFormat('datetime');
......@@ -369,7 +369,7 @@ class DataMapperTest extends UnitTestCase
public function getPlainValueReturnsExpectedValues($expectedValue, $input)
{
/** @var DataMapper $dataMapper */
$dataMapper = $this->createPartialMock(DataMapper::class, ['dummy']);
$dataMapper = $this->createPartialMock(DataMapper::class, []);
$this->assertSame($expectedValue, $dataMapper->getPlainValue($input));
}
......@@ -407,7 +407,7 @@ class DataMapperTest extends UnitTestCase
$this->expectExceptionCode(1274799934);
/** @var DataMapper $dataMapper */
$dataMapper = $this->createPartialMock(DataMapper::class, ['dummy']);
$dataMapper = $this->createPartialMock(DataMapper::class, []);
$input = $this->createMock(\TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy::class);
$input->expects($this->once())->method('_loadRealInstance')->will($this->returnValue($dataMapper));
$dataMapper->getPlainValue($input);
......@@ -419,7 +419,7 @@ class DataMapperTest extends UnitTestCase
public function getPlainValueCallsGetUidOnDomainObjectInterfaceInput()
{
/** @var DataMapper $dataMapper */
$dataMapper = $this->createPartialMock(DataMapper::class, ['dummy']);
$dataMapper = $this->createPartialMock(DataMapper::class, []);
$input = $this->createMock(\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface::class);
$input->expects($this->once())->method('getUid')->will($this->returnValue(23));
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment