public function testKnownRatio() { $adapter = $this->getMock('\\mm\\tests\\mocks\\Media\\Info\\Adapter\\GenericMock', ['get'], [null]); $media = new Image(['source' => "{$this->_files}/image_png.png", 'adapters' => [$adapter]]); $adapter->expects($this->at(0))->method('get')->with($this->equalTo('width'))->will($this->returnValue(500)); $adapter->expects($this->at(1))->method('get')->with($this->equalTo('height'))->will($this->returnValue(700)); $result = $media->get('knownRatio'); $this->assertEquals('1:√2', $result); }
public function testColors() { if (!extension_loaded('imagick')) { $this->markTestSkipped('The `imagick` extension is not available.'); } $media = new Image(['source' => "{$this->_files}/image_png.png", 'adapters' => ['Imagick']]); $expected = array([103, 103, 103, 1], [209, 210, 202, 1]); $result = $media->colors(2); $this->assertEquals($expected, $result); }