Loading Core/Feeds/Top/ScoredGuid.php +2 −0 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,8 @@ use Minds\Traits\MagicAttributes; * @method ScoredGuid setOwnerGuid(int|string $ownerGuid) * @method ScoredGuid setOwnerGuid(int|string $ownerGuid) * @method int getTimestamp() * @method int getTimestamp() * @method ScoredGuid setTimestamp(int $timestamp) * @method ScoredGuid setTimestamp(int $timestamp) * @method string getType() * @method ScoredGuid setType(string $type) */ */ class ScoredGuid class ScoredGuid { { Loading Spec/Core/Feeds/Top/ManagerSpec.php +65 −10 Original line number Original line Diff line number Diff line Loading @@ -65,10 +65,22 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn(2); ->willReturn(2); $entity1->get('guid') $scoredGuid1->getType() ->shouldBeCalled() ->willReturn('object:image'); $entity1->getGUID() ->shouldBeCalled() ->shouldBeCalled() ->willReturn(5000); ->willReturn(5000); $entity1->getOwnerGUID() ->shouldBeCalled() ->willReturn(1000); $entity1->getUrn() ->shouldBeCalled() ->willReturn("urn:image:500"); $scoredGuid2->getGuid() $scoredGuid2->getGuid() ->shouldBeCalled() ->shouldBeCalled() ->willReturn(5001); ->willReturn(5001); Loading @@ -85,10 +97,22 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn(1); ->willReturn(1); $entity2->get('guid') $scoredGuid2->getType() ->shouldBeCalled() ->willReturn('activity'); $entity2->getGUID() ->shouldBeCalled() ->shouldBeCalled() ->willReturn(5001); ->willReturn(5001); $entity2->getOwnerGUID() ->shouldBeCalled() ->willReturn(1001); $entity2->getUrn() ->shouldBeCalled() ->willReturn("urn:activity:5001"); $this->repository->getList(Argument::withEntry('cache_key', 'phpspec')) $this->repository->getList(Argument::withEntry('cache_key', 'phpspec')) ->shouldBeCalled() ->shouldBeCalled() ->willReturn([$scoredGuid1, $scoredGuid2]); ->willReturn([$scoredGuid1, $scoredGuid2]); Loading @@ -97,11 +121,14 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn([$entity1, $entity2]); ->willReturn([$entity1, $entity2]); $this $response = $this ->getList([ ->getList([ 'cache_key' => 'phpspec', '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( public function it_should_get_list_by_query( Loading @@ -127,10 +154,22 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn(2); ->willReturn(2); $entity1->get('guid') $scoredGuid1->getType() ->shouldBeCalled() ->willReturn('activity'); $entity1->getGUID() ->shouldBeCalled() ->shouldBeCalled() ->willReturn(5000); ->willReturn(5000); $entity1->getOwnerGUID() ->shouldBeCalled() ->willReturn(1000); $entity1->getUrn() ->shouldBeCalled() ->willReturn("urn:activity:5000"); $scoredGuid2->getGuid() $scoredGuid2->getGuid() ->shouldBeCalled() ->shouldBeCalled() ->willReturn(5001); ->willReturn(5001); Loading @@ -147,10 +186,22 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn(1); ->willReturn(1); $entity2->get('guid') $scoredGuid2->getType() ->shouldBeCalled() ->willReturn('activity'); $entity2->getGUID() ->shouldBeCalled() ->shouldBeCalled() ->willReturn(5001); ->willReturn(5001); $entity2->getOwnerGUID() ->shouldBeCalled() ->willReturn(1001); $entity2->getUrn() ->shouldBeCalled() ->willReturn("urn:activity:5001"); $this->repository->getList(Argument::withEntry('query', 'activity with hashtags')) $this->repository->getList(Argument::withEntry('query', 'activity with hashtags')) ->shouldBeCalled() ->shouldBeCalled() ->willReturn([$scoredGuid1, $scoredGuid2]); ->willReturn([$scoredGuid1, $scoredGuid2]); Loading @@ -159,11 +210,15 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn([$entity1, $entity2]); ->willReturn([$entity1, $entity2]); $this $response = $this ->getList([ ->getList([ 'query' => 'Activity with #hashtags', 'query' => 'Activity with #hashtags', ]) ]); ->shouldBeAResponse([$entity2, $entity1]); $response[0]->getUrn() ->shouldBe('urn:activity:5000'); $response[1]->getUrn() ->shouldBe('urn:activity:5001'); } } function getMatchers() function getMatchers() Loading Spec/Core/Feeds/Top/RepositorySpec.php +12 −6 Original line number Original line Diff line number Diff line Loading @@ -56,7 +56,8 @@ class RepositorySpec extends ObjectBehavior 'time_created' => 1, 'time_created' => 1, '@timestamp' => 1000, '@timestamp' => 1000, ], ], '_score' => 100 '_score' => 100, '_type' => 'activity', ], ], [ [ '_source' => [ '_source' => [ Loading @@ -65,7 +66,8 @@ class RepositorySpec extends ObjectBehavior 'time_created' => 1, 'time_created' => 1, '@timestamp' => 1000, '@timestamp' => 1000, ], ], '_score' => 50 '_score' => 50, '_type' => 'activity', ], ], ] ] ] ] Loading Loading @@ -104,7 +106,8 @@ class RepositorySpec extends ObjectBehavior 'time_created' => 1, 'time_created' => 1, '@timestamp' => 1000, '@timestamp' => 1000, ], ], '_score' => 100 '_score' => 100, '_type' => 'user', ], ], [ [ '_source' => [ '_source' => [ Loading @@ -113,7 +116,8 @@ class RepositorySpec extends ObjectBehavior 'time_created' => 2, 'time_created' => 2, '@timestamp' => 2000, '@timestamp' => 2000, ], ], '_score' => 50 '_score' => 50, '_type' => 'user', ], ], ] ] ] ] Loading Loading @@ -153,7 +157,8 @@ class RepositorySpec extends ObjectBehavior '@timestamp' => 1000, '@timestamp' => 1000, 'container_guid' => '1', 'container_guid' => '1', ], ], '_score' => 100 '_score' => 100, '_type' => 'group', ], ], [ [ '_source' => [ '_source' => [ Loading @@ -163,7 +168,8 @@ class RepositorySpec extends ObjectBehavior '@timestamp' => 2000, '@timestamp' => 2000, 'container_guid' => '2', 'container_guid' => '2', ], ], '_score' => 50 '_score' => 50, '_type' => 'group', ], ], ] ] ] ] Loading Loading
Core/Feeds/Top/ScoredGuid.php +2 −0 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,8 @@ use Minds\Traits\MagicAttributes; * @method ScoredGuid setOwnerGuid(int|string $ownerGuid) * @method ScoredGuid setOwnerGuid(int|string $ownerGuid) * @method int getTimestamp() * @method int getTimestamp() * @method ScoredGuid setTimestamp(int $timestamp) * @method ScoredGuid setTimestamp(int $timestamp) * @method string getType() * @method ScoredGuid setType(string $type) */ */ class ScoredGuid class ScoredGuid { { Loading
Spec/Core/Feeds/Top/ManagerSpec.php +65 −10 Original line number Original line Diff line number Diff line Loading @@ -65,10 +65,22 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn(2); ->willReturn(2); $entity1->get('guid') $scoredGuid1->getType() ->shouldBeCalled() ->willReturn('object:image'); $entity1->getGUID() ->shouldBeCalled() ->shouldBeCalled() ->willReturn(5000); ->willReturn(5000); $entity1->getOwnerGUID() ->shouldBeCalled() ->willReturn(1000); $entity1->getUrn() ->shouldBeCalled() ->willReturn("urn:image:500"); $scoredGuid2->getGuid() $scoredGuid2->getGuid() ->shouldBeCalled() ->shouldBeCalled() ->willReturn(5001); ->willReturn(5001); Loading @@ -85,10 +97,22 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn(1); ->willReturn(1); $entity2->get('guid') $scoredGuid2->getType() ->shouldBeCalled() ->willReturn('activity'); $entity2->getGUID() ->shouldBeCalled() ->shouldBeCalled() ->willReturn(5001); ->willReturn(5001); $entity2->getOwnerGUID() ->shouldBeCalled() ->willReturn(1001); $entity2->getUrn() ->shouldBeCalled() ->willReturn("urn:activity:5001"); $this->repository->getList(Argument::withEntry('cache_key', 'phpspec')) $this->repository->getList(Argument::withEntry('cache_key', 'phpspec')) ->shouldBeCalled() ->shouldBeCalled() ->willReturn([$scoredGuid1, $scoredGuid2]); ->willReturn([$scoredGuid1, $scoredGuid2]); Loading @@ -97,11 +121,14 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn([$entity1, $entity2]); ->willReturn([$entity1, $entity2]); $this $response = $this ->getList([ ->getList([ 'cache_key' => 'phpspec', '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( public function it_should_get_list_by_query( Loading @@ -127,10 +154,22 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn(2); ->willReturn(2); $entity1->get('guid') $scoredGuid1->getType() ->shouldBeCalled() ->willReturn('activity'); $entity1->getGUID() ->shouldBeCalled() ->shouldBeCalled() ->willReturn(5000); ->willReturn(5000); $entity1->getOwnerGUID() ->shouldBeCalled() ->willReturn(1000); $entity1->getUrn() ->shouldBeCalled() ->willReturn("urn:activity:5000"); $scoredGuid2->getGuid() $scoredGuid2->getGuid() ->shouldBeCalled() ->shouldBeCalled() ->willReturn(5001); ->willReturn(5001); Loading @@ -147,10 +186,22 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn(1); ->willReturn(1); $entity2->get('guid') $scoredGuid2->getType() ->shouldBeCalled() ->willReturn('activity'); $entity2->getGUID() ->shouldBeCalled() ->shouldBeCalled() ->willReturn(5001); ->willReturn(5001); $entity2->getOwnerGUID() ->shouldBeCalled() ->willReturn(1001); $entity2->getUrn() ->shouldBeCalled() ->willReturn("urn:activity:5001"); $this->repository->getList(Argument::withEntry('query', 'activity with hashtags')) $this->repository->getList(Argument::withEntry('query', 'activity with hashtags')) ->shouldBeCalled() ->shouldBeCalled() ->willReturn([$scoredGuid1, $scoredGuid2]); ->willReturn([$scoredGuid1, $scoredGuid2]); Loading @@ -159,11 +210,15 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->shouldBeCalled() ->willReturn([$entity1, $entity2]); ->willReturn([$entity1, $entity2]); $this $response = $this ->getList([ ->getList([ 'query' => 'Activity with #hashtags', 'query' => 'Activity with #hashtags', ]) ]); ->shouldBeAResponse([$entity2, $entity1]); $response[0]->getUrn() ->shouldBe('urn:activity:5000'); $response[1]->getUrn() ->shouldBe('urn:activity:5001'); } } function getMatchers() function getMatchers() Loading
Spec/Core/Feeds/Top/RepositorySpec.php +12 −6 Original line number Original line Diff line number Diff line Loading @@ -56,7 +56,8 @@ class RepositorySpec extends ObjectBehavior 'time_created' => 1, 'time_created' => 1, '@timestamp' => 1000, '@timestamp' => 1000, ], ], '_score' => 100 '_score' => 100, '_type' => 'activity', ], ], [ [ '_source' => [ '_source' => [ Loading @@ -65,7 +66,8 @@ class RepositorySpec extends ObjectBehavior 'time_created' => 1, 'time_created' => 1, '@timestamp' => 1000, '@timestamp' => 1000, ], ], '_score' => 50 '_score' => 50, '_type' => 'activity', ], ], ] ] ] ] Loading Loading @@ -104,7 +106,8 @@ class RepositorySpec extends ObjectBehavior 'time_created' => 1, 'time_created' => 1, '@timestamp' => 1000, '@timestamp' => 1000, ], ], '_score' => 100 '_score' => 100, '_type' => 'user', ], ], [ [ '_source' => [ '_source' => [ Loading @@ -113,7 +116,8 @@ class RepositorySpec extends ObjectBehavior 'time_created' => 2, 'time_created' => 2, '@timestamp' => 2000, '@timestamp' => 2000, ], ], '_score' => 50 '_score' => 50, '_type' => 'user', ], ], ] ] ] ] Loading Loading @@ -153,7 +157,8 @@ class RepositorySpec extends ObjectBehavior '@timestamp' => 1000, '@timestamp' => 1000, 'container_guid' => '1', 'container_guid' => '1', ], ], '_score' => 100 '_score' => 100, '_type' => 'group', ], ], [ [ '_source' => [ '_source' => [ Loading @@ -163,7 +168,8 @@ class RepositorySpec extends ObjectBehavior '@timestamp' => 2000, '@timestamp' => 2000, 'container_guid' => '2', 'container_guid' => '2', ], ], '_score' => 50 '_score' => 50, '_type' => 'group', ], ], ] ] ] ] Loading