Skip to content

Commit 268fbbc

Browse files
committedSep 23, 2019
WIP
1 parent 1df9e66 commit 268fbbc

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed
 

‎tests/CurrencylayerTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function testRateWithSingleTarget()
7676

7777
$rate = $this->service->rate('USD', Carbon::today(), 'AED');
7878

79-
$this->assertSame(3.673103, $rate);
79+
$this->assertSame(3.67266, $rate);
8080
}
8181

8282
public function testRateWithMultipleTargets()
@@ -87,8 +87,8 @@ public function testRateWithMultipleTargets()
8787
$rates = $this->service->rate('USD', Carbon::today()->format('Y-m-d'), 'AED', 'AMD');
8888

8989
$this->assertTrue(is_array($rates));
90-
$this->assertSame(3.673103, $rates['AED']);
91-
$this->assertSame(476.340291, $rates['AMD']);
90+
$this->assertSame(3.67266, $rates['AED']);
91+
$this->assertSame(475.798293, $rates['AMD']);
9292
$this->assertSame(3, Currency::count());
9393
$this->assertSame(2, Rate::count());
9494
}

‎tests/FakeClient.php

+11
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010

1111
class FakeClient implements Client
1212
{
13+
/**
14+
* @var \DateTimeImmutable|string
15+
*/
16+
private $date;
17+
1318
/**
1419
* @param string $fileName
1520
*
@@ -47,6 +52,8 @@ public function currencies($currencies): Client
4752
*/
4853
public function date($date): Client
4954
{
55+
$this->date = $date;
56+
5057
return $this;
5158
}
5259

@@ -75,6 +82,10 @@ public function endDate($date): Client
7582
*/
7683
public function quotes(): Quotes
7784
{
85+
if ($this->date) {
86+
return new Quotes($this->jsonFixture('historical'));
87+
}
88+
7889
return new Quotes($this->jsonFixture('live'));
7990
}
8091

0 commit comments

Comments
 (0)
Please sign in to comment.