public function testShouldCreateNewImage() { $resource = $this->getMockBuilder('Imanee\\ImageResource\\GDResource')->setMethods(['createNew'])->getMock(); $resource->expects($this->once())->method('createNew')->with(200, 200); $this->model->setResource($resource); $this->model->newImage(200, 200); }
/** * Convenient method for generating text-only images * * @param string $text * @param Drawer $drawer * @param string $format * @param string $background * @return Imanee */ public static function textGen($text, Drawer $drawer = null, $format = 'png', $background = 'transparent', ImageResourceInterface $resource = null) { $imanee = new Imanee(null, $resource); if ($drawer !== null) { $imanee->setDrawer($drawer); } $size = $imanee->resource->getTextGeometry($text, $imanee->getDrawer()); $imanee->newImage($size['width'], $size['height'], $background); $imanee->setFormat($format); $imanee->placeText($text, Imanee::IM_POS_TOP_LEFT); return $imanee; }