ImboUnitTest\Http\Response\Formatter\XMLTest::testCanFormatAUserModel PHP Method

testCanFormatAUserModel() public method

    public function testCanFormatAUserModel()
    {
        $formattedDate = 'Wed, 30 Jan 2013 10:53:11 GMT';
        $date = new DateTime($formattedDate);
        $model = $this->getMock('Imbo\\Model\\User');
        $model->expects($this->once())->method('getLastModified')->will($this->returnValue($date));
        $model->expects($this->once())->method('getNumImages')->will($this->returnValue(123));
        $model->expects($this->once())->method('getUserId')->will($this->returnValue('christer'));
        $this->dateFormatter->expects($this->once())->method('formatDate')->with($date)->will($this->returnValue($formattedDate));
        $xml = $this->formatter->format($model);
        $this->assertXPathMatches('//user/user[.="christer"]', $xml, 'Missing user');
        $this->assertXPathMatches('//user/numImages[.="123"]', $xml, 'Missing num key');
        $this->assertXPathMatches('//user/lastModified[.="' . $formattedDate . '"]', $xml, 'Missing date');
    }