Contao\CoreBundle\Test\Contao\ImageTest::testConstruct PHP Method

testConstruct() public method

Tests the object instantiation.
public testConstruct ( )
    public function testConstruct()
    {
        /** @var File|\PHPUnit_Framework_MockObject_MockObject $fileMock */
        $fileMock = $this->getMockBuilder('Contao\\File')->setMethods(['__get', 'exists'])->setConstructorArgs(['dummy.jpg'])->getMock();
        $fileMock->expects($this->any())->method('exists')->will($this->returnValue(true));
        $fileMock->expects($this->any())->method('__get')->will($this->returnCallback(function ($key) {
            switch ($key) {
                case 'extension':
                    return 'jpg';
                case 'path':
                    return 'dummy.jpg';
                default:
                    return null;
            }
        }));
        $this->assertInstanceOf('Contao\\Image', new Image($fileMock));
    }