@@ -51,9 +51,9 @@ public function testCreate() {
5151 once ()->
5252 with (Mockery::type ('string ' ), 'POST ' , Mockery::type ('array ' ), json_encode ($ testInput ))->
5353 andReturn ($ responseMock );
54+ $ responseMock ->shouldReceive ('getStatusCode ' )->andReturn (200 );
5455 $ responseMock ->shouldReceive ('getBody->getContents ' )->andReturn (json_encode ($ testBody ));
5556
56-
5757 $ this ->assertEquals ($ testBody , $ this ->resource ->create ($ testInput ));
5858 }
5959
@@ -65,6 +65,7 @@ public function testUpdate() {
6565 once ()->
6666 with ('/.*\/test/ ' , 'PUT ' , Mockery::type ('array ' ), json_encode ($ testInput ))->
6767 andReturn ($ responseMock );
68+ $ responseMock ->shouldReceive ('getStatusCode ' )->andReturn (200 );
6869 $ responseMock ->shouldReceive ('getBody->getContents ' )->andReturn (json_encode ($ testBody ));
6970
7071 $ this ->assertEquals ($ testBody , $ this ->resource ->update ('test ' , $ testInput ));
@@ -77,6 +78,7 @@ public function testGet() {
7778 once ()->
7879 with ('/.*\/test/ ' , 'GET ' , Mockery::type ('array ' ), null )->
7980 andReturn ($ responseMock );
81+ $ responseMock ->shouldReceive ('getStatusCode ' )->andReturn (200 );
8082 $ responseMock ->shouldReceive ('getBody->getContents ' )->andReturn (json_encode ($ testBody ));
8183
8284 $ this ->assertEquals ($ testBody , $ this ->resource ->get ('test ' ));
@@ -88,16 +90,19 @@ public function testDelete() {
8890 once ()->
8991 with ('/.*\/test/ ' , 'DELETE ' , Mockery::type ('array ' ), null )->
9092 andReturn ($ responseMock );
93+ $ responseMock ->shouldReceive ('getStatusCode ' )->andReturn (200 );
9194 $ responseMock ->shouldReceive ('getBody->getContents ' )->andReturn ('' );
9295
9396 $ this ->assertEquals (null , $ this ->resource ->delete ('test ' ));
9497 }
9598
9699 public function testAdapter404Exception () {
97100 try {
101+ $ responseMock = Mockery::mock ();
98102 $ this ->sparkPostMock ->httpAdapter ->shouldReceive ('send ' )->
99103 once ()->
100- andThrow ($ this ->getExceptionMock (404 ));
104+ andReturn ($ responseMock );
105+ $ responseMock ->shouldReceive ('getStatusCode ' )->andReturn (404 );
101106
102107 $ this ->resource ->get ('test ' );
103108 }
@@ -108,9 +113,11 @@ public function testAdapter404Exception() {
108113
109114 public function testAdapter4XXException () {
110115 try {
116+ $ responseMock = Mockery::mock ();
111117 $ this ->sparkPostMock ->httpAdapter ->shouldReceive ('send ' )->
112118 once ()->
113- andThrow ($ this ->getExceptionMock (400 ));
119+ andReturn ($ responseMock );
120+ $ responseMock ->shouldReceive ('getStatusCode ' )->andReturn (400 );
114121
115122 $ this ->resource ->get ('test ' );
116123 }
0 commit comments