/** * Test create(). * * @covers ::create * @covers ::post * @test */ public function testCreateCallsPost() { // Test values $responseArray = array('test' => 'response'); $postResponse = json_encode($responseArray); $parameters = array(); // Create the used mock objects $client = $this->getMockBuilder('Redmine\\Client')->disableOriginalConstructor()->getMock(); $client->expects($this->once())->method('post')->with('/issues/1/relations.json', array('relation' => array('relation_type' => 'relates')))->willReturn($postResponse); // Create the object under test $api = new IssueRelation($client); // Perform the tests $this->assertSame($responseArray, $api->create(1, $parameters)); }
/** * Test remove() * * @covers ::delete * @covers ::remove * @test * * @return void */ public function testRemoveCallsDelete() { // Test values $getResponse = 'API Response'; // Create the used mock objects $client = $this->getMockBuilder('Redmine\\Client')->disableOriginalConstructor()->getMock(); $client->expects($this->once())->method('delete')->with($this->logicalAnd($this->stringStartsWith('/relations/5'), $this->logicalXor($this->stringEndsWith('.json'), $this->stringEndsWith('.xml'))))->willReturn($getResponse); // Create the object under test $api = new IssueRelation($client); // Perform the tests $this->assertSame($getResponse, $api->remove(5)); }