WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ public function __construct(private StructureResolverInterface $inner)
/**
* @return mixed[]
*/
public function resolve(StructureInterface $structure, bool $loadExcerpt = true): array
public function resolve(StructureInterface $structure, bool $loadExcerpt = true/*, array $includedProperties = null*/): array
{
$data = $this->inner->resolve($structure, $loadExcerpt);
$includedProperties = (\func_num_args() > 2) ? \func_get_arg(2) : null;

/** @phpstan-ignore-next-line */
$data = $this->inner->resolve($structure, $loadExcerpt, $includedProperties);

if (!$structure instanceof ContentStructureBridge) {
return $data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function testResolveWithNonContentStructureBridge(): void
$structure = $this->prophesize(StructureInterface::class);
$expectedData = ['key' => 'value'];

$this->innerResolver->resolve($structure->reveal(), true)
$this->innerResolver->resolve($structure->reveal(), true, null)
->willReturn($expectedData);

$result = $this->decoratedResolver->resolve($structure->reveal());
Expand All @@ -68,7 +68,7 @@ public function testResolveWithContentStructureBridgeNonAuthorInterface(): void
$document->getContent()->willReturn($content);

$expectedData = ['key' => 'value'];
$this->innerResolver->resolve($structure->reveal(), true)
$this->innerResolver->resolve($structure->reveal(), true, null)
->willReturn($expectedData);

$result = $this->decoratedResolver->resolve($structure->reveal());
Expand All @@ -88,7 +88,7 @@ public function testResolveWithContentStructureBridgeAndAuthorInterface(): void
$document->getContent()->willReturn($content->reveal());

$expectedData = ['key' => 'value'];
$this->innerResolver->resolve($structure->reveal(), true)
$this->innerResolver->resolve($structure->reveal(), true, null)
->willReturn($expectedData);

$authDate = new \DateTimeImmutable();
Expand Down Expand Up @@ -117,7 +117,7 @@ public function testResolveWithContentStructureBridgeAndAuthorInterfaceNoAuthor(
$document->getContent()->willReturn($content->reveal());

$expectedData = ['key' => 'value'];
$this->innerResolver->resolve($structure->reveal(), true)
$this->innerResolver->resolve($structure->reveal(), true, null)
->willReturn($expectedData);

$content->getAuthored()->willReturn(null);
Expand All @@ -138,11 +138,25 @@ public function testResolveWithExcerptFlag(): void
$structure = $this->prophesize(StructureInterface::class);
$expectedData = ['key' => 'value'];

$this->innerResolver->resolve($structure->reveal(), false)
$this->innerResolver->resolve($structure->reveal(), false, null)
->willReturn($expectedData);

$result = $this->decoratedResolver->resolve($structure->reveal(), false);

$this->assertSame($expectedData, $result);
}

public function testResolveWithIncludedProperties(): void
{
$structure = $this->prophesize(StructureInterface::class);
$includedProperties = ['title' => 'title', 'url' => 'url'];
$expectedData = ['key' => 'value'];

$this->innerResolver->resolve($structure->reveal(), false, $includedProperties)
->willReturn($expectedData);

$result = $this->decoratedResolver->resolve($structure->reveal(), false, $includedProperties);

$this->assertSame($expectedData, $result);
}
}
Loading