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