PHP Classes

File: tests/Jaguar/Tests/CoordinateTest.php

Recommend this page to a friend!
  Classes of Hyyan Abo Fakher   Jaguar   tests/Jaguar/Tests/CoordinateTest.php   Download  
File: tests/Jaguar/Tests/CoordinateTest.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/CoordinateTest.php
Date: 5 months ago
Size: 1,393 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;

use
Jaguar\Coordinate;

class
CoordinateTest extends JaguarTestCase
{
    public function
testEqualsThrowInvalidArgumentException()
    {
       
$this->setExpectedException('\InvalidArgumentException');
       
$c = new Coordinate();
       
$c->equals('invalid');
    }

    public function
testEquals()
    {
       
$c = new Coordinate();
       
$this->assertTrue($c->equals(clone $c));
       
$this->assertFalse($c->equals(new Coordinate(10, 10)));
    }

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

    public function
testTranslate()
    {
       
$c = new Coordinate();
       
$c->translate(50, 50);

       
$this->assertTrue($c->equals(new Coordinate(50, 50)));
    }

    public function
testLocation()
    {
       
$c = new Coordinate();
       
$newLocation = new Coordinate(50, 50);

       
$c->setLocation($newLocation);
       
$getNewLocation = $c->getLocation(); // new coordinate object

       
$this->assertNotSame($getNewLocation, $newLocation);
       
$this->assertTrue($getNewLocation->equals($newLocation));
    }

}