ImboUnitTest\Http\Response\Formatter\JSONTest::testCanFormatAStatusModel PHP Method

testCanFormatAStatusModel() public method

    public function testCanFormatAStatusModel()
    {
        $formattedDate = 'Wed, 30 Jan 2013 10:53:11 GMT';
        $date = new DateTime($formattedDate);
        $model = $this->getMock('Imbo\\Model\\Status');
        $model->expects($this->once())->method('getDate')->will($this->returnValue($date));
        $model->expects($this->once())->method('getDatabaseStatus')->will($this->returnValue(true));
        $model->expects($this->once())->method('getStorageStatus')->will($this->returnValue(false));
        $this->dateFormatter->expects($this->once())->method('formatDate')->with($date)->will($this->returnValue($formattedDate));
        $json = $this->formatter->format($model);
        $data = json_decode($json, true);
        $this->assertSame($formattedDate, $data['date']);
        $this->assertTrue($data['database']);
        $this->assertFalse($data['storage']);
    }