Skip to content

Commit

Permalink
[Tests] Fixed mocking of serializeContentFieldValue in FieldTest
Browse files Browse the repository at this point in the history
  • Loading branch information
alongosz committed Mar 27, 2024
1 parent 9a50c44 commit 8b82650
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions tests/lib/Server/Output/ValueObjectVisitor/FieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -45,11 +44,7 @@ public function testVisit(): void
]
);

$this->mockFieldTypeSerializerSerializeContentFieldValue(
$generator,
$field,
'<value>foo</value>'
);
$this->fieldTypeSerializer->method('serializeContentFieldValue')->with($generator, $field);

$visitor->visit(
$this->getVisitorMock(),
Expand All @@ -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,
],
Expand Down

0 comments on commit 8b82650

Please sign in to comment.