diff --git a/composer.json b/composer.json index 1811e30..b502f3e 100644 --- a/composer.json +++ b/composer.json @@ -28,12 +28,12 @@ }, "autoload": { "psr-4": { - "Gumlet\\": "lib/" + "AJUR\\Toolkit\\": "src/" } }, "autoload-dev": { "psr-4": { - "Gumlet\\": "test/" + "AJUR\\Toolkit\\": "tests/" } }, "require-dev": { diff --git a/makefile b/makefile index dc15c70..dd98d3e 100644 --- a/makefile +++ b/makefile @@ -11,7 +11,7 @@ setup_env: ##@localhost Setup environment at localhost @echo Setting up local environment @composer install -phpunit: ##@localhost Make tests +test: ##@localhost Make tests @./vendor/bin/phpunit # ------------------------------------------------ diff --git a/lib/ImageResize.php b/src/ImageResize.php similarity index 99% rename from lib/ImageResize.php rename to src/ImageResize.php index 0f2dbeb..f07641f 100644 --- a/lib/ImageResize.php +++ b/src/ImageResize.php @@ -1,6 +1,6 @@ assertEquals("", $e->getMessage()); - $this->assertInstanceOf('\Gumlet\ImageResizeException', $e); + $this->assertInstanceOf('AJUR\Toolkit\ImageResizeException', $e); } public function testExceptionMessage() @@ -19,7 +18,7 @@ public function testExceptionMessage() $e = new ImageResizeException("General error"); $this->assertEquals("General error", $e->getMessage()); - $this->assertInstanceOf('\Gumlet\ImageResizeException', $e); + $this->assertInstanceOf('AJUR\Toolkit\ImageResizeException', $e); } public function testExceptionExtending() @@ -35,7 +34,7 @@ public function testExceptionThrown() throw new ImageResizeException("General error"); } catch (\Exception $e) { $this->assertEquals("General error", $e->getMessage()); - $this->assertInstanceOf('\Gumlet\ImageResizeException', $e); + $this->assertInstanceOf('AJUR\Toolkit\ImageResizeException', $e); return; } $this->fail(); diff --git a/tests/ImageResizeTest.php b/tests/ImageResizeTest.php index 861fb3d..1790ed6 100644 --- a/tests/ImageResizeTest.php +++ b/tests/ImageResizeTest.php @@ -1,7 +1,8 @@ assertEquals(IMAGETYPE_GIF, $resize->source_type); - $this->assertInstanceOf('\Gumlet\ImageResize', $resize); + $this->assertInstanceOf('\AJUR\Toolkit\ImageResize', $resize); } public function testLoadJpg() @@ -37,7 +38,7 @@ public function testLoadJpg() $resize = new ImageResize($image); $this->assertEquals(IMAGETYPE_JPEG, $resize->source_type); - $this->assertInstanceOf('\Gumlet\ImageResize', $resize); + $this->assertInstanceOf('\AJUR\Toolkit\ImageResize', $resize); } public function testLoadIgnoreXmpExifJpg() @@ -46,7 +47,7 @@ public function testLoadIgnoreXmpExifJpg() $resize = new ImageResize($image); $this->assertEquals(IMAGETYPE_JPEG, $resize->source_type); - $this->assertInstanceOf('\Gumlet\ImageResize', $resize); + $this->assertInstanceOf('\AJUR\Toolkit\ImageResize', $resize); } public function testLoadPng() @@ -55,7 +56,7 @@ public function testLoadPng() $resize = new ImageResize($image); $this->assertEquals(IMAGETYPE_PNG, $resize->source_type); - $this->assertInstanceOf('\Gumlet\ImageResize', $resize); + $this->assertInstanceOf('\AJUR\Toolkit\ImageResize', $resize); } public function testLoadWebp() @@ -64,7 +65,7 @@ public function testLoadWebp() $resize = new ImageResize($image); $this->assertEquals(IMAGETYPE_WEBP, $resize->source_type); - $this->assertInstanceOf('\Gumlet\ImageResize', $resize); + $this->assertInstanceOf('\AJUR\Toolkit\ImageResize', $resize); } public function testLoadString() @@ -72,7 +73,7 @@ public function testLoadString() $resize = ImageResize::createFromString(base64_decode($this->image_string)); $this->assertEquals(IMAGETYPE_GIF, $resize->source_type); - $this->assertInstanceOf('\Gumlet\ImageResize', $resize); + $this->assertInstanceOf('\AJUR\Toolkit\ImageResize', $resize); } public function testLoadRfc2397() @@ -80,7 +81,7 @@ public function testLoadRfc2397() $resize = new ImageResize($this->data_url); $this->assertEquals(IMAGETYPE_GIF, $resize->source_type); - $this->assertInstanceOf('\Gumlet\ImageResize', $resize); + $this->assertInstanceOf('\AJUR\Toolkit\ImageResize', $resize); } public function testAddFilter() @@ -89,7 +90,7 @@ public function testAddFilter() $resize = new ImageResize($image); $filename = $this->getTempFile(); - $this->assertInstanceOf('\Gumlet\ImageResize', $resize->addFilter('imagefilter')); + $this->assertInstanceOf('\AJUR\Toolkit\ImageResize', $resize->addFilter('imagefilter')); } public function testApplyFilter() @@ -99,7 +100,7 @@ public function testApplyFilter() $resize->addFilter('imagefilter'); $filename = $this->getTempFile(); - $this->assertInstanceOf('\Gumlet\ImageResize', $resize->save($filename)); + $this->assertInstanceOf('\AJUR\Toolkit\ImageResize', $resize->save($filename)); } /** @@ -109,29 +110,29 @@ public function testApplyFilter() public function testLoadNoFile() { $this->expectExceptionMessage("No filename given"); - $this->expectException(\Gumlet\ImageResizeException::class); + $this->expectException(ImageResizeException::class); new ImageResize(null); } public function testLoadUnsupportedFile() { - $this->expectExceptionMessage("Gumlet\ImageResize ERROR: Could not read file"); - $this->expectException(\Gumlet\ImageResizeException::class); + $this->expectExceptionMessage("AJUR\Toolkit\ImageResize ERROR: Could not read file"); + $this->expectException(ImageResizeException::class); new ImageResize(__FILE__); } public function testLoadUnsupportedFileString() { $this->expectExceptionMessage("image_data must not be empty"); - $this->expectException(\Gumlet\ImageResizeException::class); + $this->expectException(ImageResizeException::class); ImageResize::createFromString(''); } /*public function testLoadUnsupportedImage() { // хер его знает почему не работает тест... - // $this->expectExceptionMessage("Gumlet\ImageResize ERROR: Unsupported image type"); - // $this->expectException(\Gumlet\ImageResizeException::class); + $this->expectExceptionMessage("AJUR\Toolkit\ImageResize ERROR: Unsupported image type"); + $this->expectException(\AJUR\Toolkit\ImageResizeException::class); $filename = $this->getTempFile(); $image = fopen($filename, 'w'); @@ -143,8 +144,8 @@ public function testLoadUnsupportedFileString() /*public function testInvalidString() { - $this->expectExceptionMessage("Gumlet\ImageResize ERROR: Unsupported image type"); - $this->expectException(\Gumlet\ImageResizeException::class); + $this->expectExceptionMessage("AJUR\Toolkit\ImageResize ERROR: Unsupported image type"); + $this->expectException(\AJUR\Toolkit\ImageResizeException::class); ImageResize::createFromString(base64_decode($this->unsupported_image)); }*/ @@ -317,7 +318,7 @@ public function testCropPosition() $resize->crop(50, 50, false, $resize::CROPRIGHT); - $reflection_class = new ReflectionClass('\Gumlet\ImageResize'); + $reflection_class = new ReflectionClass('\AJUR\Toolkit\ImageResize'); $source_x = $reflection_class->getProperty('source_x'); $source_x->setAccessible(true); @@ -325,7 +326,7 @@ public function testCropPosition() $resize->crop(50, 50, false, $resize::CROPCENTRE); - $reflection_class = new ReflectionClass('\Gumlet\ImageResize'); + $reflection_class = new ReflectionClass('\AJUR\Toolkit\ImageResize'); $source_x = $reflection_class->getProperty('source_x'); $source_x->setAccessible(true); @@ -333,7 +334,7 @@ public function testCropPosition() $resize->crop(50, 50, false, $resize::CROPTOPCENTER); - $reflection_class = new ReflectionClass('\Gumlet\ImageResize'); + $reflection_class = new ReflectionClass('\AJUR\Toolkit\ImageResize'); $source_x = $reflection_class->getProperty('source_x'); $source_x->setAccessible(true);