Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-rath committed Feb 17, 2020
1 parent 989f9bd commit 5877b97
Showing 1 changed file with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function testGetObject(int $id = 1, string $locale = 'de'): void
return func_get_arg(\func_num_args() - 2);
})->shouldBeCalledTimes(1);

$queryBuilder->setParameter(Argument::type('string'), Argument::type('string'))->will(function () {
$queryBuilder->setParameter(Argument::type('string'), Argument::any())->will(function () {
return func_get_arg(\func_num_args() - 2);
})->shouldBeCalledTimes(1);

Expand Down Expand Up @@ -135,23 +135,23 @@ public function testSetValues(
'excerptCategories' => [1, 2],
]
): void {
$this->tagFactory->create(Argument::type('array'))->will(function (array $tags) {
return array_map(function ($name) {
$tag = new Tag();
$tag->setName($name);
$tags = array_map(function (string $name) {
$tag = new Tag();
$tag->setName($name);

return $tag;
}, $tags);
});
return $tag;
}, $data['excerptTags']);

$this->categoryFactory->create(Argument::type('array'))->will(function (array $categories) {
return array_map(function ($id) {
$category = new Category();
$category->setId($id);
$this->tagFactory->create($data['excerptTags'])->willReturn($tags);

return $category;
}, $categories);
});
$categories = array_map(function (int $id) {
$category = new Category();
$category->setId($id);

return $category;
}, $data['excerptCategories']);

$this->categoryFactory->create($data['excerptCategories'])->willReturn($categories);

$projection = (new class() implements ContentProjectionInterface, TemplateInterface, SeoInterface, ExcerptInterface {
use ContentProjectionTrait;
Expand All @@ -176,8 +176,10 @@ public function getTemplateType(): string
$this->assertSame('Title', $projection->getTemplateData()['title']);
$this->assertSame('Seo Title', $projection->getSeoTitle());
$this->assertSame('Excerpt Title', $projection->getExcerptTitle());
$this->assertSame($data['excerptTags'], $projection->getExcerptTagNames());
$this->assertSame($data['excerptCategories'], $projection->getExcerptCategoryIds());
$this->assertEquals($data['excerptTags'], $projection->getExcerptTagNames());
$this->assertEquals($tags, $projection->getExcerptTags());
$this->assertEquals($data['excerptCategories'], $projection->getExcerptCategoryIds());
$this->assertEquals($categories, $projection->getExcerptCategories());
}

/**
Expand Down Expand Up @@ -212,7 +214,7 @@ public function testSerialize(): void

$result = $this->contentObjectProvider->serialize($object);

$this->assertSame($serializedObject, $result);
$this->assertEquals($serializedObject, $result);
}

public function testDeserialize(): void
Expand All @@ -222,6 +224,6 @@ public function testDeserialize(): void

$deserializedObject = $this->contentObjectProvider->deserialize($serializedObject, \get_class($object));

$this->assertSame($deserializedObject, $object);
$this->assertEquals($deserializedObject, $object);
}
}

0 comments on commit 5877b97

Please sign in to comment.