Commit 1a53b79f authored by Mark Harding's avatar Mark Harding

(fix): failing spec tests

1 merge request!221(refactor): support hydrating the first batch of entities
Pipeline #70058480 pending with stages
......@@ -20,6 +20,8 @@ use Minds\Traits\MagicAttributes;
* @method ScoredGuid setOwnerGuid(int|string $ownerGuid)
* @method int getTimestamp()
* @method ScoredGuid setTimestamp(int $timestamp)
* @method string getType()
* @method ScoredGuid setType(string $type)
*/
class ScoredGuid
{
......
......@@ -65,10 +65,22 @@ class ManagerSpec extends ObjectBehavior
->shouldBeCalled()
->willReturn(2);
$entity1->get('guid')
$scoredGuid1->getType()
->shouldBeCalled()
->willReturn('object:image');
$entity1->getGUID()
->shouldBeCalled()
->willReturn(5000);
$entity1->getOwnerGUID()
->shouldBeCalled()
->willReturn(1000);
$entity1->getUrn()
->shouldBeCalled()
->willReturn("urn:image:500");
$scoredGuid2->getGuid()
->shouldBeCalled()
->willReturn(5001);
......@@ -85,10 +97,22 @@ class ManagerSpec extends ObjectBehavior
->shouldBeCalled()
->willReturn(1);
$entity2->get('guid')
$scoredGuid2->getType()
->shouldBeCalled()
->willReturn('activity');
$entity2->getGUID()
->shouldBeCalled()
->willReturn(5001);
$entity2->getOwnerGUID()
->shouldBeCalled()
->willReturn(1001);
$entity2->getUrn()
->shouldBeCalled()
->willReturn("urn:activity:5001");
$this->repository->getList(Argument::withEntry('cache_key', 'phpspec'))
->shouldBeCalled()
->willReturn([$scoredGuid1, $scoredGuid2]);
......@@ -97,11 +121,14 @@ class ManagerSpec extends ObjectBehavior
->shouldBeCalled()
->willReturn([$entity1, $entity2]);
$this
$response = $this
->getList([
'cache_key' => 'phpspec',
])
->shouldBeAResponse([$entity2, $entity1]);
]);
$response[0]->getUrn()
->shouldBe('urn:image:500');
$response[1]->getUrn()
->shouldBe('urn:activity:5001');
}
public function it_should_get_list_by_query(
......@@ -127,10 +154,22 @@ class ManagerSpec extends ObjectBehavior
->shouldBeCalled()
->willReturn(2);
$entity1->get('guid')
$scoredGuid1->getType()
->shouldBeCalled()
->willReturn('activity');
$entity1->getGUID()
->shouldBeCalled()
->willReturn(5000);
$entity1->getOwnerGUID()
->shouldBeCalled()
->willReturn(1000);
$entity1->getUrn()
->shouldBeCalled()
->willReturn("urn:activity:5000");
$scoredGuid2->getGuid()
->shouldBeCalled()
->willReturn(5001);
......@@ -146,11 +185,23 @@ class ManagerSpec extends ObjectBehavior
$scoredGuid2->getTimestamp()
->shouldBeCalled()
->willReturn(1);
$scoredGuid2->getType()
->shouldBeCalled()
->willReturn('activity');
$entity2->get('guid')
$entity2->getGUID()
->shouldBeCalled()
->willReturn(5001);
$entity2->getOwnerGUID()
->shouldBeCalled()
->willReturn(1001);
$entity2->getUrn()
->shouldBeCalled()
->willReturn("urn:activity:5001");
$this->repository->getList(Argument::withEntry('query', 'activity with hashtags'))
->shouldBeCalled()
->willReturn([$scoredGuid1, $scoredGuid2]);
......@@ -159,11 +210,15 @@ class ManagerSpec extends ObjectBehavior
->shouldBeCalled()
->willReturn([$entity1, $entity2]);
$this
$response = $this
->getList([
'query' => 'Activity with #hashtags',
])
->shouldBeAResponse([$entity2, $entity1]);
]);
$response[0]->getUrn()
->shouldBe('urn:activity:5000');
$response[1]->getUrn()
->shouldBe('urn:activity:5001');
}
function getMatchers()
......
......@@ -56,7 +56,8 @@ class RepositorySpec extends ObjectBehavior
'time_created' => 1,
'@timestamp' => 1000,
],
'_score' => 100
'_score' => 100,
'_type' => 'activity',
],
[
'_source' => [
......@@ -65,7 +66,8 @@ class RepositorySpec extends ObjectBehavior
'time_created' => 1,
'@timestamp' => 1000,
],
'_score' => 50
'_score' => 50,
'_type' => 'activity',
],
]
]
......@@ -104,7 +106,8 @@ class RepositorySpec extends ObjectBehavior
'time_created' => 1,
'@timestamp' => 1000,
],
'_score' => 100
'_score' => 100,
'_type' => 'user',
],
[
'_source' => [
......@@ -113,7 +116,8 @@ class RepositorySpec extends ObjectBehavior
'time_created' => 2,
'@timestamp' => 2000,
],
'_score' => 50
'_score' => 50,
'_type' => 'user',
],
]
]
......@@ -153,7 +157,8 @@ class RepositorySpec extends ObjectBehavior
'@timestamp' => 1000,
'container_guid' => '1',
],
'_score' => 100
'_score' => 100,
'_type' => 'group',
],
[
'_source' => [
......@@ -163,7 +168,8 @@ class RepositorySpec extends ObjectBehavior
'@timestamp' => 2000,
'container_guid' => '2',
],
'_score' => 50
'_score' => 50,
'_type' => 'group',
],
]
]
......
Markdown is supported
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