mock(AddressBookSynchronizer::class, function (MockInterface $mock) { $mock->shouldReceive('execute') ->once() ->withArgs(function ($sync, $force) { $this->assertFalse($force); return true; }); }); $subscription = AddressBookSubscription::factory()->create(); $request = [ 'account_id' => $subscription->account_id, 'addressbook_subscription_id' => $subscription->id, ]; (new SynchronizeAddressBook())->execute($request); } /** @test */ public function it_runs_sync_force() { $this->mock(AddressBookSynchronizer::class, function (MockInterface $mock) { $mock->shouldReceive('execute') ->once() ->withArgs(function ($sync, $force) { $this->assertTrue($force); return true; }); }); $subscription = AddressBookSubscription::factory()->create(); $request = [ 'account_id' => $subscription->account_id, 'addressbook_subscription_id' => $subscription->id, 'force' => true, ]; (new SynchronizeAddressBook())->execute($request); } }