PHP Classes

File: tests/Jaguar/Tests/Drawable/AbstractDrawableTest.php

Recommend this page to a friend!
  Classes of Hyyan Abo Fakher   Jaguar   tests/Jaguar/Tests/Drawable/AbstractDrawableTest.php   Download  
File: tests/Jaguar/Tests/Drawable/AbstractDrawableTest.php
Role: Unit test script
Content type: text/plain
Description: Class source
Class: Jaguar
Draw graphics and manipulate images
Author: By
Last change: Update of tests/Jaguar/Tests/Drawable/AbstractDrawableTest.php
Date: 5 months ago
Size: 1,822 bytes
 

Contents

Class file image Download
<?php

/*
 * This file is part of the Jaguar package.
 *
 * (c) Hyyan Abo Fakher <tiribthea4hyyan@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Jaguar\Tests\Drawable;

use
Jaguar\Tests\JaguarTestCase;
use
Jaguar\Canvas;
use
Jaguar\Dimension;

abstract class
AbstractDrawableTest extends JaguarTestCase
{
   
/**
     * Get drawabale object
     *
     * @return \Jaguar\Drawable\DrawableInterface
     */
   
abstract public function getDrawable();

   
/**
     * Get canvas object
     *
     * @return \Jaguar\Drawable\DrawableInterface
     */
   
public function getCanvas()
    {
        return new
Canvas(new Dimension(100, 100));
    }

   
/**
     * @expectedException \Jaguar\Exception\CanvasEmptyException
     */
   
public function testDrawThrowCanvasEmptyException()
    {
       
$canvas = new \Jaguar\Tests\Mock\EmptyCanvasMock();
       
$canvas->draw($this->getDrawable());
    }

   
/**
     * @expectedException \Jaguar\Exception\DrawableException
     */
   
public function testDrawThrowDrawableException()
    {
       
$canvas = new \Jaguar\Tests\Mock\CanvasMock();
       
$canvas->draw($this->getDrawable());
    }

   
/**
     * @expectedException \InvalidArgumentException
     */
   
public function testEqualsThrowInvalidArgumnetException()
    {
       
$this->getDrawable()->equals('invalid');
    }

    public function
testDraw()
    {
       
$canvas = $this->getCanvas();
       
$drawable = $this->getDrawable();
       
$this->assertSame($canvas, $canvas->draw($drawable));
       
$this->assertSame($drawable, $drawable->draw($canvas));
    }

    public function
testToString()
    {
       
$this->assertInternalType('string', (string) $this->getDrawable());
    }

}