Loading Core/Boost/Network/Manager.php +5 −0 Original line number Diff line number Diff line Loading @@ -170,6 +170,11 @@ class Manager */ public function isBoostLimitExceededBy($boost) { //onchain boosts allowed if ($boost->isOnChain()) { return false; } //get offchain boosts $offchain = $this->getOffchainBoosts($boost); Loading Spec/Core/Boost/Network/ManagerSpec.php +24 −2 Original line number Diff line number Diff line Loading @@ -370,7 +370,25 @@ class ManagerSpec extends ObjectBehavior $this->isBoostLimitExceededBy($boost)->shouldReturn(true); } public function runThroughGetList($boost, $existingBoosts) public function it_should_allow_a_user_to_boost_onchain_when_offchain_limit_reached(Boost $boost) { $boostArray = []; for ($i = 0; $i < 2; $i++) { $newBoost = new Boost(); $newBoost->setCreatedTimestamp('9999999999999999'); $newBoost->setImpressions(5001); array_push($boostArray, $newBoost); } $boost->isOnChain() ->shouldBeCalled() ->willReturn(true); Di::_()->get('Config')->set('max_daily_boost_views', 20000); $this->isBoostLimitExceededBy($boost)->shouldReturn(false); } public function runThroughGetList($boost, $existingBoosts, $onchain = false) { $this->elasticRepository->getList([ "hydrate" => true, Loading @@ -393,6 +411,10 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->willReturn('newsfeed'); $boost->isOnChain() ->shouldBeCalled() ->willReturn($onchain); $boost->getOwnerGuid() ->shouldBeCalled() ->willReturn('123'); Loading Loading
Core/Boost/Network/Manager.php +5 −0 Original line number Diff line number Diff line Loading @@ -170,6 +170,11 @@ class Manager */ public function isBoostLimitExceededBy($boost) { //onchain boosts allowed if ($boost->isOnChain()) { return false; } //get offchain boosts $offchain = $this->getOffchainBoosts($boost); Loading
Spec/Core/Boost/Network/ManagerSpec.php +24 −2 Original line number Diff line number Diff line Loading @@ -370,7 +370,25 @@ class ManagerSpec extends ObjectBehavior $this->isBoostLimitExceededBy($boost)->shouldReturn(true); } public function runThroughGetList($boost, $existingBoosts) public function it_should_allow_a_user_to_boost_onchain_when_offchain_limit_reached(Boost $boost) { $boostArray = []; for ($i = 0; $i < 2; $i++) { $newBoost = new Boost(); $newBoost->setCreatedTimestamp('9999999999999999'); $newBoost->setImpressions(5001); array_push($boostArray, $newBoost); } $boost->isOnChain() ->shouldBeCalled() ->willReturn(true); Di::_()->get('Config')->set('max_daily_boost_views', 20000); $this->isBoostLimitExceededBy($boost)->shouldReturn(false); } public function runThroughGetList($boost, $existingBoosts, $onchain = false) { $this->elasticRepository->getList([ "hydrate" => true, Loading @@ -393,6 +411,10 @@ class ManagerSpec extends ObjectBehavior ->shouldBeCalled() ->willReturn('newsfeed'); $boost->isOnChain() ->shouldBeCalled() ->willReturn($onchain); $boost->getOwnerGuid() ->shouldBeCalled() ->willReturn('123'); Loading