Commit 96ff14bb authored by Guy Thouret's avatar Guy Thouret

(chore) Fix failing Boost Spec tests - #1118

1 merge request!235WIP: Boost Campaigns (&24)
Pipeline #95496157 passed with stages
in 6 minutes and 40 seconds
......@@ -140,7 +140,7 @@ class ElasticRepository
->setCreatedTimestamp(((int) $doc['_source']['@timestamp']) ?: null);
break;
default:
continue;
continue 2;
}
$data[] = $entity;
......
......@@ -8,6 +8,7 @@ use Minds\Core\Boost\Network\Iterator;
use Minds\Core\Data\cache\abstractCacher;
use Minds\Core\Entities\Resolver;
use Minds\Core\Feeds\FeedSyncEntity;
use Minds\Core\Time;
use Minds\Entities\Entity;
use Minds\Entities\User;
use PhpSpec\ObjectBehavior;
......@@ -45,12 +46,19 @@ class BoostSpec extends ObjectBehavior
'quality' => 0
];
$this->user->getGUID()->shouldBeCalled()->willReturn(1234);
$this->user->get('guid')->shouldBeCalled()->willReturn(1234);
$this->user->getTimeCreated()->shouldBeCalled()->willReturn(time() - Time::TWO_HOUR);
$this->user->getBoostRating()->shouldBeCalled()->willReturn(0);
$this->iterator->setLimit(10)->shouldBeCalled()->willReturn($this->iterator);
$this->iterator->setOffset(10)->shouldBeCalled()->willReturn($this->iterator);
$this->iterator->setRating(0)->shouldBeCalled()->willReturn($this->iterator);
$this->iterator->setQuality(0)->shouldBeCalled()->willReturn($this->iterator);
$this->iterator->setType('newsfeed')->shouldBeCalled()->willReturn($this->iterator);
$this->iterator->setHydrate(false)->shouldBeCalled()->willReturn($this->iterator);
$this->iterator->setUserGuid(1234)->shouldBeCalled()->willReturn($this->iterator);
$this->iterator->rewind()->shouldBeCalled();
$this->iterator->valid()->shouldBeCalled()->willReturn(true, true, false);
$this->iterator->current()->shouldBeCalled()->willReturn($boost1, $boost2);
......
......@@ -62,7 +62,6 @@ class ManagerSpec extends ObjectBehavior
$this->elasticRepository->getList([
'state' => 'review',
'hydrate' => true,
'useElastic' => true,
])
->shouldBeCalled()
......@@ -70,7 +69,6 @@ class ManagerSpec extends ObjectBehavior
$this->repository->getList([
'state' => 'review',
'hydrate' => true,
'useElastic' => true,
'guids' => [1, 2],
])
......@@ -109,7 +107,6 @@ class ManagerSpec extends ObjectBehavior
]);
$this->elasticRepository->getList([
'state' => 'approved',
'hydrate' => true,
'useElastic' => true,
])
->shouldBeCalled()
......@@ -150,7 +147,6 @@ class ManagerSpec extends ObjectBehavior
$this->repository->getList([
'state' => null,
'guids' => [123, 456],
'hydrate' => true,
'useElastic' => false,
])
->shouldBeCalled()
......@@ -205,7 +201,6 @@ class ManagerSpec extends ObjectBehavior
public function it_should_check_if_the_entity_was_already_boosted(Boost $boost, Response $response)
{
$params = [
'hydrate' => true,
'useElastic' => true,
'state' => 'review',
'type' => 'newsfeed',
......@@ -245,7 +240,6 @@ class ManagerSpec extends ObjectBehavior
public function it_should_request_offchain_boosts(Boost $boost, Response $response)
{
$params = [
'hydrate' => true,
'useElastic' => true,
'state' => 'active',
'type' => 'newsfeed',
......@@ -345,7 +339,6 @@ class ManagerSpec extends ObjectBehavior
public function runThroughGetList($boost, $existingBoosts, $onchain = false)
{
$this->elasticRepository->getList([
"hydrate" => true,
"useElastic" => true,
"state" => "active",
"type" => "newsfeed",
......
Please register or to comment