From 8b82650404254b04a783b79872a5dcdfc0b60d22 Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Wed, 27 Mar 2024 13:49:01 +0100 Subject: [PATCH] [Tests] Fixed mocking of serializeContentFieldValue in FieldTest --- .../Output/ValueObjectVisitor/FieldTest.php | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/tests/lib/Server/Output/ValueObjectVisitor/FieldTest.php b/tests/lib/Server/Output/ValueObjectVisitor/FieldTest.php index 6de3d346..b6c6b257 100644 --- a/tests/lib/Server/Output/ValueObjectVisitor/FieldTest.php +++ b/tests/lib/Server/Output/ValueObjectVisitor/FieldTest.php @@ -9,7 +9,6 @@ namespace Ibexa\Tests\Rest\Server\Output\ValueObjectVisitor; use Ibexa\Contracts\Core\Repository\Values\Content\Field as ApiField; -use Ibexa\Contracts\Rest\Output\Generator; use Ibexa\Rest\Output\FieldTypeSerializer; use Ibexa\Rest\Server\Output\ValueObjectVisitor\Field; use Ibexa\Tests\Rest\Output\ValueObjectVisitorBaseTest; @@ -45,11 +44,7 @@ public function testVisit(): void ] ); - $this->mockFieldTypeSerializerSerializeContentFieldValue( - $generator, - $field, - 'foo' - ); + $this->fieldTypeSerializer->method('serializeContentFieldValue')->with($generator, $field); $visitor->visit( $this->getVisitorMock(), @@ -67,25 +62,11 @@ public function testVisit(): void $this->assertContainsTag('fieldTypeIdentifier', $result); } - private function mockFieldTypeSerializerSerializeContentFieldValue( - Generator $generator, - ApiField $field, - string $value - ): void { - $this->fieldTypeSerializer - ->method('serializeContentFieldValue') - ->with( - $generator, - $field - ) - ->willReturn($value); - } - private function assertContainsTag( string $tag, string $result ): void { - $this->assertXMLTag( + self::assertXMLTag( [ 'tag' => $tag, ],