public function testGettingSubscribedAccountsForSpecifiedAccount() { $account = factory(Account::class)->create([]); $mock = m::mock('Modules\\Account\\AccountManager'); $mock->shouldNotReceive('account'); $base = factory(Account::class)->create([]); $repo = m::mock('Modules\\Account\\AccountRepositoryInterface'); $repo->shouldReceive('baseAccount')->andReturn($base); //if we dont provide account, it should use the environment one. $manager = new GammaSubscriptionManager($mock, $repo); $response = $manager->subscribedAccounts($account); $this->assertInstanceOf(Collection::class, $response); $this->assertSameSize($response, [$base, $account]); $this->assertSame($base->id, $response->get(0)->id); $this->assertSame($account->id, $response->get(1)->id); }
/** * @param GammaSubscriptionManager $subscriptions * @return string */ protected function indexesToUse(GammaSubscriptionManager $subscriptions) { $accounts = $subscriptions->subscribedAccounts(); $aliases = $accounts->lists('alias')->toArray(); return implode(',', $aliases); }