88
99class 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