for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Graze\CiffRenderer\Test\Field\Renderer;
use \Mockery as m;
use Graze\CiffRenderer\Field\Renderer\GraphicPrimitive\OutlineBoxRenderer;
use Intervention\Image\ImageManager;
use Intervention\Image\Image;
class OutlineBoxRendererTest extends \PHPUnit_Framework_TestCase
{
public function testRender()
$width = 20;
$height = 22;
$lineWeight = 10;
$tracerColour = '#ccc';
$canvas = m::mock(Image::class)
->shouldReceive('rectangle')
->with(0, 0, 10, 12, m::type('callable'))
->getMock();
$imageManager = m::mock(ImageManager::class)
->shouldReceive('canvas')
->with($width, $height, $tracerColour)
->andReturn($canvas)
$renderer = m::mock(OutlineBoxRenderer::class)
->shouldAllowMockingProtectedMethods()
->shouldReceive('getWidth')
->andReturn($width)
->shouldReceive('getHeight')
->andReturn($height)
->shouldReceive('getTracerColour')
->andReturn($tracerColour)
->shouldReceive('getLineWeight')
->andReturn($lineWeight)
->shouldReceive('getImageManager')
->andReturn($imageManager)
->getMock()
->makePartial();
$this->assertEquals($canvas, $renderer->render());
}