Doctrine\Tests\ODM\CouchDB\AttachmentTest::testTriggerStubLazyLoad PHP Метод

testTriggerStubLazyLoad() публичный Метод

    public function testTriggerStubLazyLoad()
    {
        $path = '/';
        $response = new \Doctrine\CouchDB\HTTP\Response(200, array(), 'Hello i am a string', true);
        $httpClient = $this->getMock('Doctrine\\CouchDB\\HTTP\\Client');
        $httpClient->expects($this->once())->method('request')->with($this->equalTo('GET'), $this->equalTo($path))->will($this->returnValue($response));
        $attachment = Attachment::createStub('plain/text', 28, 2, $httpClient, $path);
        $this->assertFalse($attachment->isLoaded());
        $this->assertEquals('Hello i am a string', $attachment->getRawData());
        $this->assertEquals('SGVsbG8gaSBhbSBhIHN0cmluZw==', $attachment->getBase64EncodedData());
        $this->assertTrue($attachment->isLoaded());
    }