Example #1
0
 /**
  * Test listing()
  *
  * @covers ::listing
  * @test
  *
  * @return void
  */
 public function testListingCallsGetEveryTimeWithForceUpdate()
 {
     // Test values
     $getResponse = array('users' => array(array('id' => 1, 'login' => 'User 1'), array('id' => 5, 'login' => 'User 5')));
     $expectedReturn = array('User 1' => 1, 'User 5' => 5);
     // Create the used mock objects
     $client = $this->getMockBuilder('Redmine\\Client')->disableOriginalConstructor()->getMock();
     $client->expects($this->exactly(2))->method('get')->with($this->stringStartsWith('/users.json'))->willReturn($getResponse);
     // Create the object under test
     $api = new User($client);
     // Perform the tests
     $this->assertSame($expectedReturn, $api->listing(true));
     $this->assertSame($expectedReturn, $api->listing(true));
 }