/** @test */ public function executeFollowRequestToPinterestApi() { $response = $this->createSuccessApiResponse(); $mock = $this->getHttpMock(); $mock->shouldReceive('execute')->once()->andReturn(json_encode($response)); $mock->shouldReceive('execute')->once()->andReturnNull(); $this->setProperty('http', $mock); $this->assertEquals($response, $this->request->followMethodCall(1, Request::BOARD_ENTITY_ID, 'ur')); $this->assertNull($this->request->followMethodCall(1, Request::INTEREST_ENTITY_ID, 'ur')); }
public function testFollowMethodCall() { $response = $this->createSuccessApiResponse(); $mock = $this->getMock(Http::class, ['setOptions', 'execute', 'close']); $mock->expects($this->at(1))->method('execute')->willReturn(json_encode($response)); $mock->expects($this->at(2))->method('execute')->willReturn(null); $this->setProperty('http', $mock); $this->assertEquals($response, $this->request->followMethodCall(1, Request::BOARD_ENTITY_ID, 'ur')); $this->assertNull($this->request->followMethodCall(1, Request::INTEREST_ENTITY_ID, 'ur')); }
public function testFollowMethodCall() { $response = ['body' => 'result']; $mock = $this->getMock(Http::class, ['setOptions', 'execute', 'close']); $mock->expects($this->at(1))->method('execute')->willReturn(json_encode($response)); $mock->expects($this->at(2))->method('execute')->willReturn(null); $this->setProperty('http', $mock); $this->assertTrue($this->request->followMethodCall(1, Request::BOARD_ENTITY_ID, 'ur')); $this->assertFalse($this->request->followMethodCall(1, Request::INTEREST_ENTITY_ID, 'ur')); }