Skip to content

Commit 76901c8

Browse files
Added code to test for pruning of invalid cusips.
1 parent f95136f commit 76901c8

2 files changed

Lines changed: 38 additions & 4 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
/.gitignore
22
/vendor/
33
/composer.lock
4+
/.coveralls.yml
5+
/Gemfile
6+
/.env

tests/ClientDailyPriceFixedIncomeTest.php

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,50 @@
88

99
class ClientDailyPriceFixedIncomeTest extends TestCase {
1010

11+
protected $invalidUser = 'user';
12+
13+
protected $invalidPass = 'pass';
14+
15+
protected $validDate = '2017-07-31';
16+
17+
protected $invalidDate = 'this is not a date';
18+
19+
protected $validCusips = [ '38259P508' ]; // Google
20+
21+
protected $invalidCusips = [ '123456789' ];
22+
23+
/**
24+
*
25+
*/
1126
public function testConstructor() {
12-
$client = new ClientDailyPriceFixedIncome( 'user', 'pass', '2017-07-31', [ '38259P508' ], FALSE );
27+
$client = new ClientDailyPriceFixedIncome( $this->invalidUser, $this->invalidPass, $this->validDate, $this->validCusips, FALSE );
1328
$this->assertInstanceOf( ClientDailyPriceFixedIncome::class, $client );
29+
$this->assertAttributeCount( 1, 'cusips', $client );
1430
}
1531

32+
/**
33+
*
34+
*/
1635
public function testConstructorWithUnparsableDate() {
1736
$this->expectException( UnparsableDateSentToConstructor::class );
18-
new ClientDailyPriceFixedIncome( 'user', 'pass', 'this is not a date', [ '38259P508' ], FALSE );
37+
new ClientDailyPriceFixedIncome( $this->invalidUser, $this->invalidPass, $this->invalidDate, $this->validCusips, FALSE );
38+
}
39+
40+
/**
41+
*
42+
*/
43+
public function testConstructorWithInvalidCusip() {
44+
$client = new ClientDailyPriceFixedIncome( $this->invalidUser, $this->invalidPass, $this->validDate, $this->invalidCusips, FALSE );
45+
$this->assertAttributeCount( 0, 'cusips', $client );
46+
$this->assertAttributeCount( 1, 'invalidCusips', $client );
1947
}
2048

49+
/**
50+
*
51+
*/
2152
public function testRunWithInvalidCredentials() {
2253
$this->expectException( ClientException::class );
23-
$client = new ClientDailyPriceFixedIncome( 'user', 'pass', '2017-07-31', [ '38259P508' ], FALSE );
24-
$response = $client->run();
54+
$client = new ClientDailyPriceFixedIncome( $this->invalidUser, $this->invalidPass, $this->validDate, $this->validCusips, FALSE );
55+
$client->run();
2556
}
2657
}

0 commit comments

Comments
 (0)