HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/topswtw.komma.pro/vendor/intervention/image/tests/PolygonShapeTest.php
<?php

use Intervention\Image\Gd\Shapes\PolygonShape as PolygonGd;
use Intervention\Image\Imagick\Shapes\PolygonShape as PolygonImagick;

class PolygonShapeTest extends PHPUnit_Framework_TestCase
{
    public function tearDown()
    {
        Mockery::close();
    }
    
    public function testGdConstructor()
    {
        $polygon = new PolygonGd(array(1, 2, 3, 4, 5, 6));
        $this->assertInstanceOf('Intervention\Image\Gd\Shapes\PolygonShape', $polygon);
        $this->assertEquals(array(1, 2, 3, 4, 5, 6), $polygon->points);
        
    }

    public function testGdApplyToImage()
    {
        $core = imagecreatetruecolor(300, 200);
        $image = Mockery::mock('\Intervention\Image\Image');
        $image->shouldReceive('getCore')->once()->andReturn($core);
        $polygon = new PolygonGd(array(1, 2, 3, 4, 5, 6));
        $result = $polygon->applyToImage($image);
        $this->assertInstanceOf('Intervention\Image\Gd\Shapes\PolygonShape', $polygon);
        $this->assertTrue($result);
    }

    public function testImagickConstructor()
    {
        $polygon = new PolygonImagick(array(1, 2, 3, 4, 5, 6));
        $this->assertInstanceOf('Intervention\Image\Imagick\Shapes\PolygonShape', $polygon);
        $this->assertEquals(array(
            array('x' => 1, 'y' => 2), 
            array('x' => 3, 'y' => 4), 
            array('x' => 5, 'y' => 6)), 
        $polygon->points);
        
    }

    public function testImagickApplyToImage()
    {
        $core = Mockery::mock('\Imagick');
        $core->shouldReceive('drawimage')->once();
        $image = Mockery::mock('\Intervention\Image\Image');
        $image->shouldReceive('getCore')->once()->andReturn($core);
        $polygon = new PolygonImagick(array(1, 2, 3, 4, 5, 6));
        $result = $polygon->applyToImage($image);
        $this->assertInstanceOf('Intervention\Image\Imagick\Shapes\PolygonShape', $polygon);
        $this->assertTrue($result);
    }

}