Phue\Test\ClientTest::testGetSchedules PHP Method

testGetSchedules() public method

Test: Get schedules
public testGetSchedules ( )
    public function testGetSchedules()
    {
        // Mock transport
        $mockTransport = $this->getMock('\\Phue\\Transport\\TransportInterface', array('sendRequest'));
        // Mock results for sendRequest
        $mockResults = (object) array('1' => new \stdClass(), '2' => new \stdClass(), '3' => new \stdClass());
        // Stub transports sendRequest method
        $mockTransport->expects($this->once())->method('sendRequest')->will($this->returnValue($mockResults));
        // Set transport
        $this->client->setTransport($mockTransport);
        // Get schedules
        $schedules = $this->client->getSchedules();
        // Ensure three schedules
        $this->assertEquals(3, count($schedules));
        // Ensure return type is an array of schedules
        $this->assertContainsOnlyInstancesOf('\\Phue\\Schedule', $schedules);
    }