Esempio n. 1
0
 /**
  * Test show()
  *
  * @covers ::get
  * @covers ::show
  * @test
  *
  * @return void
  */
 public function testShowReturnsClientGetResponse()
 {
     // Test values
     $getResponse = 'API Response';
     // Create the used mock objects
     $client = $this->getMockBuilder('Redmine\\Client')->disableOriginalConstructor()->getMock();
     $client->expects($this->once())->method('get')->with('/users/5.json?include=memberships,groups')->willReturn($getResponse);
     // Create the object under test
     $api = new User($client);
     // Perform the tests
     $this->assertSame($getResponse, $api->show(5));
 }
Esempio n. 2
0
 /**
  * Test show().
  *
  * @covers ::get
  * @covers ::show
  * @test
  */
 public function testShowReturnsClientGetResponseWithUniqueParameters()
 {
     // Test values
     $parameters = array('include' => array('parameter1', 'parameter2', 'memberships'));
     $getResponse = 'API Response';
     // Create the used mock objects
     $client = $this->getMockBuilder('Redmine\\Client')->disableOriginalConstructor()->getMock();
     $client->expects($this->once())->method('get')->with($this->logicalAnd($this->stringStartsWith('/users/5.json'), $this->stringContains(urlencode('parameter1,parameter2,memberships,groups'))))->willReturn($getResponse);
     // Create the object under test
     $api = new User($client);
     // Perform the tests
     $this->assertSame($getResponse, $api->show(5, $parameters));
 }