Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function test_exchange_rate()
- {
- $cryptoExternalApi = $this->createMock(CryptoExternalApi::class);
- $map = [
- [Asset::BTC, Asset::BTC, Asset::ETH],
- ['1', '1', '2']
- ];
- $cryptoExternalApi->method('getExchangeRate')
- ->willReturn(1);
- // ->will($this->returnValueMap($map));
- $user = factory(User::class)->create();
- $asset = Asset::firstOrCreate(
- [
- 'storage' => 'testStorage',
- 'currency' => Asset::BTC,
- 'value' => 1,
- 'user_id' => $user->id
- ]
- );
- $asset->save();
- $asset2 = Asset::firstOrCreate(
- [
- 'storage' => 'testStorage',
- 'currency' => Asset::BTC,
- 'value' => 2,
- 'user_id' => $user->id
- ]
- );
- $asset2->save();
- $asset3 = Asset::firstOrCreate(
- [
- 'storage' => 'testStorage',
- 'currency' => Asset::ETH,
- 'value' => 3,
- 'user_id' => $user->id
- ]
- );
- $asset3->save();
- $response = $this->actingAs($user)->json('GET', route('asset.exchangeRate', $user->id));
- $response
- ->assertStatus(204);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement