Skip to content

Commit

Permalink
Merge pull request #15 from kokspflanze/tests-update
Browse files Browse the repository at this point in the history
tests updated
  • Loading branch information
kokspflanze authored Dec 28, 2019
2 parents 56fe7e6 + 159e2a9 commit 109c09f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions tests/Api/AbstractApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function testGetApiUrl()
$result = $this->getMethod('getApiUri', $this->class)
->invokeArgs($this->class, []);

$this->assertInternalType('string', $result);
$this->assertIsString($result);
$this->assertSame('https://www.alphavantage.co/query?', $result);
}

Expand Down Expand Up @@ -84,6 +84,9 @@ public function testGetExceptionMessage()
true,
['getContents']
);
$response->expects($this->exactly(1))
->method('getStatusCode')
->willReturn(505);
$response->expects($this->exactly(1))
->method('getBody')
->willReturn($stream);
Expand All @@ -99,6 +102,7 @@ public function testGetExceptionMessage()
->willReturn($response);

$this->expectException(RuntimeException::class);
$this->expectExceptionCode(505);
$this->expectExceptionMessage(
'the parameter apikey is missing. Please claim your free API key on (https://www.alphavantage.co/support/#api-key). It should take less than 20 seconds, and is free permanently.'
);
Expand Down Expand Up @@ -157,7 +161,7 @@ public function testGetInformationMessage()
]
);

$this->assertInternalType('array', $result);
$this->assertIsArray($result);
$this->assertSame(
[
'Information' => 'Please consider optimizing your API call frequency'
Expand Down
2 changes: 1 addition & 1 deletion tests/Api/ForeignExchangeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ForeignExchangeTest extends TestCase
public function testCurrencyExchangeRate()
{
$actual = (new ForeignExchange($this->option))->currencyExchangeRate('BTC', 'CNY');
$this->assertInternalType('array', $actual);
$this->assertIsArray($actual);
$this->assertCount(1, $actual);
$this->assertArrayHasKey('Realtime Currency Exchange Rate', $actual);
$this->assertNotEmpty($actual['Realtime Currency Exchange Rate']);
Expand Down
2 changes: 1 addition & 1 deletion tests/Api/PerformanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public function testGetGlobalQuote()
$actual = (new Performance($this->option))->section();

$this->assertNotEmpty($actual);
$this->assertInternalType('array', $actual);
$this->assertIsArray($actual);
}
}

0 comments on commit 109c09f

Please sign in to comment.