Skip to content

Commit

Permalink
Merge 9d19035 into 75e03f6
Browse files Browse the repository at this point in the history
  • Loading branch information
peter279k committed Aug 27, 2018
2 parents 75e03f6 + 9d19035 commit 4f57ded
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"guzzlehttp/guzzle": "^6.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"phpunit/phpunit": "^5.7 || ^6.5",
"satooshi/php-coveralls": "^1.0"
},
"autoload": {
Expand Down
23 changes: 22 additions & 1 deletion tests/ApiClientIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
use Scheb\YahooFinanceApi\Results\HistoricalData;
use Scheb\YahooFinanceApi\Results\Quote;
use Scheb\YahooFinanceApi\Results\SearchResult;
use PHPUnit\Framework\TestCase;

class ApiClientIntegrationTest extends \PHPUnit_Framework_TestCase
class ApiClientIntegrationTest extends TestCase
{
const APPLE_NAME = 'Apple';
const APPLE_SYMBOL = 'AAPL';
Expand Down Expand Up @@ -92,6 +93,26 @@ public function getHistoricalData_valuesForInterval_returnHistoricalData($interv
$this->assertInternalType('int', $historicalData->getVolume());
}

/**
* @test
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Interval must be one of: 1d, 1wk, 1mo
*/
public function getHistoricalData_valuesForInvalidInterval_throwInvalidArgumentException()
{
$this->client->getHistoricalData(self::APPLE_SYMBOL, 'invalid_interval', new \DateTime('-7 days'), new \DateTime('today'));
}

/**
* @test
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Start date must be before end date
*/
public function getHistoricalData_startDateIsGreaterThanEndDate_throwInvalidArgumentException()
{
$this->client->getHistoricalData(self::APPLE_SYMBOL, ApiClient::INTERVAL_1_DAY, new \DateTime('7 days'), new \DateTime('today'));
}

public function getTestDataForHistoricalData()
{
return [
Expand Down
3 changes: 2 additions & 1 deletion tests/ResultDecoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
use Scheb\YahooFinanceApi\Results\HistoricalData;
use Scheb\YahooFinanceApi\Results\Quote;
use Scheb\YahooFinanceApi\Results\SearchResult;
use PHPUnit\Framework\TestCase;

class ResultDecoderTest extends \PHPUnit_Framework_TestCase
class ResultDecoderTest extends TestCase
{
/**
* @var ResultDecoder
Expand Down

0 comments on commit 4f57ded

Please sign in to comment.