Permalink
Browse files

Upgrade to PHPUnit 3.6

  • Loading branch information...
1 parent a66d937 commit ddcd4afc234f94c31de25b42ba2f6827b15dec2c @CloCkWeRX CloCkWeRX committed Nov 7, 2011
View
73 package.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
-<package packagerversion="1.9.0" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
+<package packagerversion="1.9.4" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>Image_Color2</name>
<channel>pear.php.net</channel>
<summary>Color conversion and mixing for PHP5</summary>
@@ -18,10 +18,10 @@ Currently supported color models:
<email>drewish@katherinehouse.com</email>
<active>yes</active>
</lead>
- <date>2010-09-20</date>
- <time>10:01:10</time>
+ <date>2011-11-08</date>
+ <time>08:55:12</time>
<version>
- <release>0.1.5</release>
+ <release>0.1.6</release>
<api>0.1.4</api>
</version>
<stability>
@@ -30,31 +30,30 @@ Currently supported color models:
</stability>
<license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
<notes>
-QA release
-Package 2.0
-Bug #6395 install directory
+Updated to PHPUnit 3.6
</notes>
<contents>
<dir baseinstalldir="/" name="/">
- <file baseinstalldir="/" md5sum="0271823c768a72450bdc35ebfd32947b" name="Image/Color2.php" role="php" />
- <file baseinstalldir="/" md5sum="e85cca25993ef0d3bb8d25b121308a24" name="Image/Color2/Model.php" role="php" />
- <file baseinstalldir="/" md5sum="6e5e40e33fad9fbd5da43b475bceb837" name="Image/Color2/Model/Cmyk.php" role="php" />
- <file baseinstalldir="/" md5sum="c5e2b75eac147c61af476dfbf70ec1a2" name="Image/Color2/Model/Grayscale.php" role="php" />
- <file baseinstalldir="/" md5sum="8b0cb263235c9c32152ef51b40af573e" name="Image/Color2/Model/Hex.php" role="php" />
- <file baseinstalldir="/" md5sum="fdd54be8b802a29a7a9edfa483ee7760" name="Image/Color2/Model/Hsl.php" role="php" />
- <file baseinstalldir="/" md5sum="fdae63537504d57aa699a40b27da155c" name="Image/Color2/Model/Hsv.php" role="php" />
- <file baseinstalldir="/" md5sum="1ad4ebc9db3b136844f111a0c95cc4f3" name="Image/Color2/Model/Named.php" role="php" />
- <file baseinstalldir="/" md5sum="def2cf0d42179790d4559eca7da92097" name="Image/Color2/Model/WebsafeHex.php" role="php" />
- <file baseinstalldir="/" md5sum="50bfece53cbd88c1cb64f0370041c6f3" name="tests/AllTests.php" role="test" />
- <file baseinstalldir="/" md5sum="b57fe08164352f470105a33163547ab1" name="tests/Color2.php" role="test" />
- <file baseinstalldir="/" md5sum="50648a219b76051d406c2a80dfbf4969" name="tests/Model/AllTests.php" role="test" />
- <file baseinstalldir="/" md5sum="4cbabd653e5eeb5493c5293a4273561c" name="tests/Model/Cmyk.php" role="test" />
- <file baseinstalldir="/" md5sum="e8ca404e4796f896d06321124d6889a4" name="tests/Model/Grayscale.php" role="test" />
- <file baseinstalldir="/" md5sum="929095b624ac3e4a26ea327dd7533ee2" name="tests/Model/Hex.php" role="test" />
- <file baseinstalldir="/" md5sum="d9c4a237f6d7a69b8308618218c738d3" name="tests/Model/Hsl.php" role="test" />
- <file baseinstalldir="/" md5sum="5f4e349007e1100522645c47e85cf435" name="tests/Model/Hsv.php" role="test" />
- <file baseinstalldir="/" md5sum="9889282496d04309a5576347c6b9e84b" name="tests/Model/Named.php" role="test" />
- <file baseinstalldir="/" md5sum="02a9b18c895bf81e37553b057ae33409" name="tests/Model/WebsafeHex.php" role="test" />
+ <file baseinstalldir="/" md5sum="5b77539e7123b8074837d0e28511f602" name="/Image/Color2.php" role="php" />
+ <file baseinstalldir="/" md5sum="b848e5a8757c5d3269eda8cc310113b5" name="/Image/Color2/Model.php" role="php" />
+ <file baseinstalldir="/" md5sum="8e844ee70754799ea769d893b41dce78" name="/Image/Color2/Model/Cmyk.php" role="php" />
+ <file baseinstalldir="/" md5sum="b563f2c5048f9109db63dc1d30a2179a" name="/Image/Color2/Model/Grayscale.php" role="php" />
+ <file baseinstalldir="/" md5sum="728e1265bb28587a3d675fc68d5454ab" name="/Image/Color2/Model/Hex.php" role="php" />
+ <file baseinstalldir="/" md5sum="313cb8ee6c9db088df0676981d0525a3" name="/Image/Color2/Model/Hsl.php" role="php" />
+ <file baseinstalldir="/" md5sum="f12f11296c53b6f7748644ad12748b78" name="/Image/Color2/Model/Hsv.php" role="php" />
+ <file baseinstalldir="/" md5sum="5ff78ff477dad812a6fa87007283d8f3" name="/Image/Color2/Model/Named.php" role="php" />
+ <file baseinstalldir="/" md5sum="b4eb1a290b28be7217e551d7eb5ce8b4" name="/Image/Color2/Model/WebsafeHex.php" role="php" />
+ <file baseinstalldir="/" md5sum="7ec55623580f3c32cfc3e922e5629c37" name="/tests/AllTests.php" role="php" />
+ <file baseinstalldir="/" md5sum="4c91ba49a796e897f0522b75dbf70d83" name="/tests/Color2.php" role="php" />
+ <file baseinstalldir="/" md5sum="312f6bb922034a43153b2ff1599f5f3a" name="/tests/Model/AllTests.php" role="php" />
+ <file baseinstalldir="/" md5sum="ff58de29e55c3f407cd60a1236259a2e" name="/tests/Model/Cmyk.php" role="php" />
+ <file baseinstalldir="/" md5sum="cf8dae231a2daf898e280e06bd93d340" name="/tests/Model/Grayscale.php" role="php" />
+ <file baseinstalldir="/" md5sum="7ccfd465c7b02a72b8380065d29fa05b" name="/tests/Model/Hex.php" role="php" />
+ <file baseinstalldir="/" md5sum="4978db739d01cbd3bdd9bc9abe497ca1" name="/tests/Model/Hsl.php" role="php" />
+ <file baseinstalldir="/" md5sum="bd78fc926b423afb4516ce58c5fb7509" name="/tests/Model/Hsv.php" role="php" />
+ <file baseinstalldir="/" md5sum="868221879e6838a6f684288a1e6bd5dc" name="/tests/Model/Named.php" role="php" />
+ <file baseinstalldir="/" md5sum="6c531fbd09781bbf9654688a3c693ddf" name="/tests/Model/WebsafeHex.php" role="php" />
+ <file baseinstalldir="/" md5sum="c3aadc497ab2a0a619c46306c9605202" name="README" role="data" />
</dir>
</contents>
<dependencies>
@@ -66,6 +65,13 @@ Bug #6395 install directory
<min>1.4.0a1</min>
</pearinstaller>
</required>
+ <optional>
+ <package>
+ <name>PHPUnit</name>
+ <channel>pear.phpunit.de</channel>
+ <min>3.6.0</min>
+ </package>
+ </optional>
</dependencies>
<phprelease />
<changelog>
@@ -188,5 +194,20 @@ Package 2.0
Bug #6395 install directory
</notes>
</release>
+ <release>
+ <version>
+ <release>0.1.6</release>
+ <api>0.1.4</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <date>2011-11-08</date>
+ <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
+ <notes>
+Updated to PHPUnit 3.6
+ </notes>
+ </release>
</changelog>
</package>
View
2 tests/AllTests.php
@@ -11,7 +11,7 @@
define('PHPUnit_MAIN_METHOD', 'Image_Color2_Tests_AllTests::main');
}
-require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Framework/TestCase.php';
set_include_path(realpath('../') . PATH_SEPARATOR . get_include_path());
View
24 tests/Color2.php
@@ -9,7 +9,7 @@
define('COLOR2_BASEDIR', realpath(dirname(__FILE__) . '/..'));
-require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Framework/TestCase.php';
require_once 'Image/Color2.php';
require_once 'Image/Color2/Model/Hex.php';
require_once 'Image/Color2/Model/Hsv.php';
@@ -97,14 +97,14 @@ function testConstruct_FromColorModel_Bad() {
function testGetHex() {
$color = new Image_Color2('white');
$result = $color->getHex();
- $this->assertType('string', $result);
+ $this->assertInternalType('string', $result);
$this->assertEquals('#ffffff', $result);
}
function testGetRgb() {
$color = new Image_Color2(array(0,128,255));
$result = $color->getRgb();
- $this->assertType('array', $result);
+ $this->assertInternalType('array', $result);
$this->assertEquals(array(0,128,255,'type'=>'rgb'), $result);
}
function testGetRgb_UseIndex() {
@@ -123,19 +123,19 @@ function testGetRgb_UseIndex() {
function testGetArray_Rgb() {
$color = new Image_Color2(array(0,128,255));
$result = $color->getArray();
- $this->assertType('array', $result);
+ $this->assertInternalType('array', $result);
$this->assertEquals(array(0,128,255,'type'=>'rgb'), $result);
}
function testGetArray_Hex() {
$color = new Image_Color2(array(0x0, 0x77, 0xFF,'type'=>'hex'));
$result = $color->getArray();
- $this->assertType('array', $result);
+ $this->assertInternalType('array', $result);
$this->assertEquals(array(0x0, 0x77, 0xFF,'type'=>'rgb'), $result);
}
function testGetArray_Hsv() {
$color = new Image_Color2(array(210, 0.28, 0.94, 'type'=>'hsv'));
$result = $color->getArray();
- $this->assertType('array', $result);
+ $this->assertInternalType('array', $result);
$this->assertEquals(array(210, 0.28, 0.94, 'type'=>'hsv'), $result);
}
function testGetArray_UseIndex() {
@@ -154,14 +154,14 @@ function testGetArray_UseIndex() {
function testConvertTo_NamedToHex() {
$color = new Image_Color2('orange');
$color2 = $color->convertTo('hex');
- $this->assertType('Image_Color2', $color2);
+ $this->assertSame('Image_Color2', get_class($color2));
$result = $color2->getString();
$this->assertEquals('#ffa500', $result);
}
function testConvertTo_RgbToNamed() {
$color = new Image_Color2(array(128,128,128));
$color2 = $color->convertTo('named');
- $this->assertType('Image_Color2', $color2);
+ $this->assertSame('Image_Color2', get_class($color2));
$result = $color2->getString();
$this->assertEquals('gray', $result);
}
@@ -188,7 +188,7 @@ function testAverage_Rgb() {
$red = new Image_Color2('red');
$blue = new Image_Color2('blue');
$result = Image_Color2::average($red, $blue);
- $this->assertType('Image_Color2', $result);
+ $this->assertSame('Image_Color2', get_class($result));
$this->assertEquals('#800080', $result->getHex());
$this->assertEquals('purple', $result->convertTo('named')->getString());
}
@@ -197,10 +197,8 @@ function testAverage_Rgba() {
$red = new Image_Color2(array(255,0,0,255));
$blue = new Image_Color2(array(0,0,255,0));
$result = Image_Color2::average($red, $blue);
- $this->assertType('Image_Color2', $result);
+ $this->assertSame('Image_Color2', get_class($result));
$this->assertEquals(array(128,0,128,128,'type'=>'rgb'), $result->getArray());
}
-}
-
-?>
+}
View
2 tests/Model/AllTests.php
@@ -11,7 +11,7 @@
define('PHPUnit_MAIN_METHOD', 'Image_Color2_Tests_Model_AllTests::main');
}
-require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Framework/TestCase.php';
require_once dirname(__FILE__) . '/Cmyk.php';
require_once dirname(__FILE__) . '/Grayscale.php';
View
20 tests/Model/Cmyk.php
@@ -8,29 +8,29 @@
* @link http://www.december.com/html/spec/colorsafecodes.html
*/
-require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Framework/TestCase.php';
require_once 'Image/Color2/Model/Cmyk.php';
class Image_Color2_Tests_Model_Cmyk extends PHPUnit_Framework_TestCase {
function testFromRgb_CCFF00() {
$expected = '20%, 0%, 100%, 0%';
$model = Image_Color2_Model_Cmyk::fromRgb(array(204, 255, 0));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Cmyk', $model);
+ $this->assertSame('Image_Color2_Model_Cmyk', get_class($model));
$this->assertEquals($expected, $model->getString());
}
function testFromRgb_9900CC() {
$expected = '25%, 100%, 0%, 20%';
$model = Image_Color2_Model_Cmyk::fromRgb(array(153, 0, 204));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Cmyk', $model);
+ $this->assertSame('Image_Color2_Model_Cmyk', get_class($model));
$this->assertEquals($expected, $model->getString());
}
function testFromRgb_FF9933() {
$expected = '0%, 40%, 80%, 0%';
$model = Image_Color2_Model_Cmyk::fromRgb(array(255, 153, 51));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Cmyk', $model);
+ $this->assertSame('Image_Color2_Model_Cmyk', get_class($model));
$this->assertEquals($expected, $model->getString());
}
@@ -39,14 +39,14 @@ function testFromArray_Color() {
$expected = array(0.99, 0.10, 0.25, 0.50, 'type'=>'cmyk');
$model = Image_Color2_Model_Cmyk::fromArray(array(.99, .1, .25, .5));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Cmyk', $model);
+ $this->assertSame('Image_Color2_Model_Cmyk', get_class($model));
$this->assertEquals($expected, $model->getArray());
}
function testFromArray_Black() {
$expected = array(.0, .0, .0, 1.0, 'type'=>'cmyk');
$model = Image_Color2_Model_Cmyk::fromArray(array(.99, .1, .25, 1));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Cmyk', $model);
+ $this->assertSame('Image_Color2_Model_Cmyk', get_class($model));
$this->assertEquals($expected, $model->getArray());
}
@@ -55,28 +55,28 @@ function testFromString_Percents_Black() {
$expected = '0%, 0%, 0%, 100%';
$model = Image_Color2_Model_Cmyk::fromString('0% 33% 80% 100%');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Cmyk', $model);
+ $this->assertSame('Image_Color2_Model_Cmyk', get_class($model));
$this->assertEquals($expected, $model->getString());
}
function testFromString_Percent_NotBlack() {
$expected = '100%, 33%, 80%, 0%';
$model = Image_Color2_Model_Cmyk::fromString($expected);
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Cmyk', $model);
+ $this->assertSame('Image_Color2_Model_Cmyk', get_class($model));
$this->assertEquals($expected, $model->getString());
}
function testFromString_Floats_Black() {
$expected = '0%, 0%, 0%, 100%';
$model = Image_Color2_Model_Cmyk::fromString('0% 33% 80% 100%');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Cmyk', $model);
+ $this->assertSame('Image_Color2_Model_Cmyk', get_class($model));
$this->assertEquals($expected, $model->getString());
}
function testFromString_Floats_NotBlack() {
$expected = '100%, 33%, 80%, 0%';
$model = Image_Color2_Model_Cmyk::fromString('1 .33 .8 0');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Cmyk', $model);
+ $this->assertSame('Image_Color2_Model_Cmyk', get_class($model));
$this->assertEquals($expected, $model->getString());
}
View
26 tests/Model/Grayscale.php
@@ -7,85 +7,85 @@
* @copyright 2005
*/
-require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Framework/TestCase.php';
require_once 'Image/Color2/Model/Grayscale.php';
class Image_Color2_Tests_Model_Grayscale extends PHPUnit_Framework_TestCase {
function testFromRgb_Black() {
$model = Image_Color2_Model_Grayscale::fromRgb(array(0, 0, 0));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Grayscale', $model);
+ $this->assertSame('Image_Color2_Model_Grayscale', get_class($model));
$this->assertEquals('0%', $model->getString());
}
function testFromRgb_Color() {
$model = Image_Color2_Model_Grayscale::fromRgb(array(171, 205, 239));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Grayscale', $model);
+ $this->assertSame('Image_Color2_Model_Grayscale', get_class($model));
$this->assertEquals('77.86%', $model->getString());
}
function testFromRgb_Gray() {
$model = Image_Color2_Model_Grayscale::fromRgb(array(128, 128, 128));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Grayscale', $model);
+ $this->assertSame('Image_Color2_Model_Grayscale', get_class($model));
$this->assertEquals('50.2%', $model->getString());
}
function testFromArray_Float() {
$model = Image_Color2_Model_Grayscale::fromArray(array(0.1235));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Grayscale', $model);
+ $this->assertSame('Image_Color2_Model_Grayscale', get_class($model));
$this->assertEquals('12.35%', $model->getString());
}
function testFromString_Float_TooSmall() {
$model = Image_Color2_Model_Grayscale::fromString('-1');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Grayscale', $model);
+ $this->assertSame('Image_Color2_Model_Grayscale', get_class($model));
$this->assertEquals('0%', $model->getString());
}
function testFromString_Float_TooBig() {
$model = Image_Color2_Model_Grayscale::fromString('1.1');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Grayscale', $model);
+ $this->assertSame('Image_Color2_Model_Grayscale', get_class($model));
$this->assertEquals('100%', $model->getString());
}
function testFromString_Float_White() {
$model = Image_Color2_Model_Grayscale::fromString('1');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Grayscale', $model);
+ $this->assertSame('Image_Color2_Model_Grayscale', get_class($model));
$this->assertEquals('100%', $model->getString());
}
function testFromString_Float_75Gray() {
$model = Image_Color2_Model_Grayscale::fromString('0.75');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Grayscale', $model);
+ $this->assertSame('Image_Color2_Model_Grayscale', get_class($model));
$this->assertEquals('75%', $model->getString());
}
function testFromString_Float_Black() {
$model = Image_Color2_Model_Grayscale::fromString('.0');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Grayscale', $model);
+ $this->assertSame('Image_Color2_Model_Grayscale', get_class($model));
$this->assertEquals('0%', $model->getString());
}
function testFromString_Percent_White() {
$model = Image_Color2_Model_Grayscale::fromString('101%');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Grayscale', $model);
+ $this->assertSame('Image_Color2_Model_Grayscale', get_class($model));
$this->assertEquals('100%', $model->getString());
}
function testFromString_Percent_75Gray() {
$model = Image_Color2_Model_Grayscale::fromString('75%');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Grayscale', $model);
+ $this->assertSame('Image_Color2_Model_Grayscale', get_class($model));
$this->assertEquals('75%', $model->getString());
}
function testFromString_Percent_Black() {
$model = Image_Color2_Model_Grayscale::fromString('-1%');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Grayscale', $model);
+ $this->assertSame('Image_Color2_Model_Grayscale', get_class($model));
$this->assertEquals('0%', $model->getString());
}
View
12 tests/Model/Hex.php
@@ -7,40 +7,40 @@
* @copyright 2005
*/
-require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Framework/TestCase.php';
require_once 'Image/Color2/Model/Hex.php';
class Image_Color2_Tests_Model_Hex extends PHPUnit_Framework_TestCase {
function testFromRgb() {
$model = Image_Color2_Model_Hex::fromRgb(array(171, 205, 239));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Hex', $model);
+ $this->assertSame('Image_Color2_Model_Hex', get_class($model));
$this->assertEquals('#abcdef', $model->getString());
}
function testFromArray() {
$model = Image_Color2_Model_Hex::fromArray(array(0xAB,0xcd,0xEF));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Hex', $model);
+ $this->assertSame('Image_Color2_Model_Hex', get_class($model));
$this->assertEquals('#abcdef', $model->getString());
}
function testFromString() {
$model = Image_Color2_Model_Hex::fromString('#abCDef');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Hex', $model);
+ $this->assertSame('Image_Color2_Model_Hex', get_class($model));
$this->assertEquals('#abcdef', $model->getString());
}
function testFromString_Shortform() {
$model = Image_Color2_Model_Hex::fromString('#abc');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Hex', $model);
+ $this->assertSame('Image_Color2_Model_Hex', get_class($model));
$this->assertEquals('#aabbcc', $model->getString());
}
function testFromString_Black() {
$model = Image_Color2_Model_Hex::fromString('#000000');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Hex', $model);
+ $this->assertSame('Image_Color2_Model_Hex', get_class($model));
$this->assertEquals('#000000', $model->getString());
}
View
11 tests/Model/Hsl.php
@@ -8,23 +8,22 @@
* @link http://www.december.com/html/spec/colorsafecodes.html
*/
-require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Framework/TestCase.php';
require_once 'Image/Color2/Model/Hsl.php';
class Image_Color2_Tests_Model_Hsl extends PHPUnit_Framework_TestCase {
function testFromRgb() {
$model = Image_Color2_Model_Hsl::fromRgb(array(128, 255, 128));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Hsl', $model);
-
+ $this->assertSame('Image_Color2_Model_Hsl', get_class($model));
$expected = '120, 50%, 75%';
$this->assertEquals($expected, $model->getString());
}
function testFromArray() {
$model = Image_Color2_Model_Hsl::fromArray(array(240, .50, .25));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Hsl', $model);
+ $this->assertSame('Image_Color2_Model_Hsl', get_class($model));
$expected = array(240, .50, .25, 'type'=>'hsl');
$this->assertEquals($expected, $model->getArray());
@@ -34,14 +33,14 @@ function testFromString_Black() {
$expected = '0, 0%, 0%';
$model = Image_Color2_Model_Hsl::fromString($expected);
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Hsl', $model);
+ $this->assertSame('Image_Color2_Model_Hsl', get_class($model));
$this->assertEquals($expected, $model->getString());
}
function testFromString_Colored() {
$expected = '210, 20%, 90%';
$model = Image_Color2_Model_Hsl::fromString($expected);
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Hsl', $model);
+ $this->assertSame('Image_Color2_Model_Hsl', get_class($model));
$this->assertEquals($expected, $model->getString());
}
View
10 tests/Model/Hsv.php
@@ -7,14 +7,14 @@
* @copyright 2005
*/
-require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Framework/TestCase.php';
require_once 'Image/Color2/Model/Hsv.php';
class Image_Color2_Tests_Model_Hsv extends PHPUnit_Framework_TestCase {
function testFromRgb_ProperType() {
$model = Image_Color2_Model_Hsv::fromRgb(array(171, 205, 239));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Hsv', $model);
+ $this->assertSame('Image_Color2_Model_Hsv', get_class($model));
}
function testFromRgb_Blueish() {
@@ -51,7 +51,7 @@ function testFromRgb_White() {
function testFromArray() {
$model = Image_Color2_Model_Hsv::fromArray(array(210, 0.28, 0.94));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Hsv', $model);
+ $this->assertSame('Image_Color2_Model_Hsv', get_class($model));
$this->assertEquals('210, 28%, 94%', $model->getString());
}
function testFromArray_Gray() {
@@ -70,13 +70,13 @@ function testFromArray_White() {
function testFromString_Percents() {
$model = Image_Color2_Model_Hsv::fromString('210, 2%, 9%');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Hsv', $model);
+ $this->assertSame('Image_Color2_Model_Hsv', get_class($model));
$this->assertEquals('210, 2%, 9%', $model->getString());
}
function testFromString_Floats() {
$model = Image_Color2_Model_Hsv::fromString('210, .02, .09');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Hsv', $model);
+ $this->assertSame('Image_Color2_Model_Hsv', get_class($model));
$this->assertEquals('210, 2%, 9%', $model->getString());
}
View
10 tests/Model/Named.php
@@ -7,21 +7,21 @@
* @copyright 2005
*/
-require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Framework/TestCase.php';
require_once 'Image/Color2/Model/Named.php';
class Image_Color2_Tests_Model_Named extends PHPUnit_Framework_TestCase {
function testFromRgb() {
$model = Image_Color2_Model_Named::fromRgb(array(255,255,255));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Named', $model);
+ $this->assertSame('Image_Color2_Model_Named', get_class($model));
$this->assertEquals('white', $model->getString());
}
function testFromArray() {
$model = Image_Color2_Model_Named::fromArray(array('black', 'type'=>'named'));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Named', $model);
+ $this->assertSame('Image_Color2_Model_Named', get_class($model));
$this->assertEquals('black', $model->getString());
}
function testFromArray_Unknown() {
@@ -36,13 +36,13 @@ function testFromArray_Unknown() {
function testFromString() {
$model = Image_Color2_Model_Named::fromString('black');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Named', $model);
+ $this->assertSame('Image_Color2_Model_Named', get_class($model));
$this->assertEquals('black', $model->getString());
}
function testFromString_UppercaseWithSpaces() {
$model = Image_Color2_Model_Named::fromString('Light Steel BLUE');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_Named', $model);
+ $this->assertSame('Image_Color2_Model_Named', get_class($model));
$this->assertEquals('lightsteelblue', $model->getString());
}
function testFromString_Unknown() {
View
10 tests/Model/WebsafeHex.php
@@ -7,34 +7,34 @@
* @copyright 2005
*/
-require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Framework/TestCase.php';
require_once 'Image/Color2/Model/WebsafeHex.php';
class Image_Color2_Tests_Model_WebsafeHex extends PHPUnit_Framework_TestCase {
function testFromRgb() {
$model = Image_Color2_Model_WebsafeHex::fromRgb(array(171, 205, 239));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_WebsafeHex', $model);
+ $this->assertSame('Image_Color2_Model_WebsafeHex', get_class($model));
$this->assertEquals('#99ccff', $model->getString());
}
function testFromArray() {
$model = Image_Color2_Model_WebsafeHex::fromArray(array('AB','cd','EF'));
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_WebsafeHex', $model);
+ $this->assertSame('Image_Color2_Model_WebsafeHex', get_class($model));
$this->assertEquals('#99ccff', $model->getString());
}
function testFromString() {
$model = Image_Color2_Model_WebsafeHex::fromString('#abCDef');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_WebsafeHex', $model);
+ $this->assertSame('Image_Color2_Model_WebsafeHex', get_class($model));
$this->assertEquals('#99ccff', $model->getString());
}
function testFromString_Black() {
$model = Image_Color2_Model_WebsafeHex::fromString('#000000');
$this->assertTrue($model instanceof Image_Color2_Model);
- $this->assertType('Image_Color2_Model_WebsafeHex', $model);
+ $this->assertSame('Image_Color2_Model_WebsafeHex', get_class($model));
$this->assertEquals('#000000', $model->getString());
}

0 comments on commit ddcd4af

Please sign in to comment.