diff --git a/tests/Ion/BaseModelTest.php b/tests/Ion/BaseModelTest.php index 878c7a0..9006d3d 100644 --- a/tests/Ion/BaseModelTest.php +++ b/tests/Ion/BaseModelTest.php @@ -1,8 +1,10 @@ [ 'baz' => 'foobar' ] ]; - + protected $bar = 'secondvalue'; - + public function testHasCacheDriver() { $this->assertTrue((bool) $this->driver); } - + public function testDriverGetSet() { $this->driver->set('foo', $this->foo); @@ -22,21 +24,21 @@ trait CacheDriverBase { $this->assertEquals($this->driver->get('foo'), $this->foo); $this->assertEquals($this->driver->get('bar'), 'baz'); } - + public function testInvalidate() { $this->driver->set('foo', $this->foo); $this->driver->invalidate('foo'); $this->assertEmpty($this->driver->get('foo')); } - + public function testInvalidateAll() { $this->driver->set('foo', $this->foo); $this->driver->set('bar', $this->bar); - + $this->driver->invalidateAll(); - + $this->assertEmpty($this->driver->get('foo')); $this->assertEmpty($this->driver->get('bar')); } diff --git a/tests/Ion/Cache/Driver/NullDriverTest.php b/tests/Ion/Cache/Driver/NullDriverTest.php index 1182f8b..108b6c6 100644 --- a/tests/Ion/Cache/Driver/NullDriverTest.php +++ b/tests/Ion/Cache/Driver/NullDriverTest.php @@ -1,10 +1,10 @@ config->set(['apple', 'sauce', 'is'], 'great'); $apple = $this->config->get('apple'); $this->assertEquals('great', $apple['sauce']['is'], "Config value not set correctly"); - + $this->assertEquals('great', $this->config->get(['apple', 'sauce', 'is']), "Array argument get for config failed."); } public function testConfigBadSet() { - $this->setExpectedException('InvalidArgumentException'); + $this->expectException('InvalidArgumentException'); $this->config->set(NULL, FALSE); } diff --git a/tests/Ion/Di/ContainerAwareTest.php b/tests/Ion/Di/ContainerAwareTest.php index de803bb..e23e202 100644 --- a/tests/Ion/Di/ContainerAwareTest.php +++ b/tests/Ion/Di/ContainerAwareTest.php @@ -1,5 +1,7 @@ container = $container; @@ -15,20 +17,20 @@ class Aware { } -class ContainerAwareTest extends Ion_TestCase { - +class ContainerAwareTest extends \Ion_TestCase { + public function setUp() { $this->container = new Container(); $this->aware = new Aware($this->container); } - + public function testContainerAwareTrait() { // The container was set in setup // check that the get method returns the same $this->assertSame($this->container, $this->aware->getContainer()); - + $container2 = new Container([ 'foo' => 'bar', 'baz' => 'foobar' diff --git a/tests/Ion/Di/ContainerTest.php b/tests/Ion/Di/ContainerTest.php index 0d0a6eb..402fc9d 100644 --- a/tests/Ion/Di/ContainerTest.php +++ b/tests/Ion/Di/ContainerTest.php @@ -1,5 +1,7 @@ 'bar', diff --git a/tests/Ion/Exception/DoubleRenderExceptionTest.php b/tests/Ion/Exception/DoubleRenderExceptionTest.php index b522b2c..57598c0 100644 --- a/tests/Ion/Exception/DoubleRenderExceptionTest.php +++ b/tests/Ion/Exception/DoubleRenderExceptionTest.php @@ -1,8 +1,10 @@ friend = new Friend($obj); } @@ -26,7 +28,7 @@ class FriendTest extends Ion_TestCase { public function testGet() { $this->assertEquals(356, $this->friend->protected); - $this->assertNull($this->friend->foo); // Return NULL for non-existend properties + $this->assertNull($this->friend->foo); // Return NULL for non-existent properties $this->assertEquals(47, $this->friend->parentProtected); $this->assertEquals(84, $this->friend->grandParentProtected); $this->assertNull($this->friend->parentPrivate); // Can't get a parent's privates @@ -43,14 +45,17 @@ class FriendTest extends Ion_TestCase { public function testBadInvokation() { - $this->setExpectedException('InvalidArgumentException', 'Friend must be an object'); + $this->expectException('InvalidArgumentException'); + $this->expectExceptionMessage('Friend must be an object'); $friend = new Friend('foo'); } public function testBadMethod() { - $this->setExpectedException('BadMethodCallException', "Method 'foo' does not exist"); + $this->expectException('BadMethodCallException'); + $this->expectExceptionMessage("Method 'foo' does not exist"); + $this->friend->foo(); } } \ No newline at end of file diff --git a/tests/Ion/JsonTest.php b/tests/Ion/JsonTest.php index 212f8f8..16a0b66 100644 --- a/tests/Ion/JsonTest.php +++ b/tests/Ion/JsonTest.php @@ -60,11 +60,10 @@ class JsonTest extends \Ion_TestCase { $this->assertEquals((object)$expected, Json::decode($json, false)); $badJson = '{foo:{1|2}}'; - $this->setExpectedException( - 'Aviat\Ion\JsonException', - 'JSON_ERROR_SYNTAX - Syntax error', - JSON_ERROR_SYNTAX - ); + $this->expectException('Aviat\Ion\JsonException'); + $this->expectExceptionMessage('JSON_ERROR_SYNTAX - Syntax error'); + $this->expectExceptionCode(JSON_ERROR_SYNTAX); + Json::decode($badJson); } } \ No newline at end of file diff --git a/tests/Ion/Model/BaseDBModelTest.php b/tests/Ion/Model/BaseDBModelTest.php index 285a427..7e8eecf 100644 --- a/tests/Ion/Model/BaseDBModelTest.php +++ b/tests/Ion/Model/BaseDBModelTest.php @@ -1,8 +1,10 @@ transformer = new TestTransformer(); + $this->transformer = new \TestTransformer(); } - + public function dataTransformCollection() { return [ @@ -67,13 +69,13 @@ class AbstractTransformerTest extends Ion_TestCase { ], ]; } - + public function testTransform() { $data = $this->dataTransformCollection(); $original = $data['object']['original'][0]; $expected = $data['object']['expected'][0]; - + $actual = $this->transformer->transform($original); $this->assertEquals($expected, $actual); } diff --git a/tests/Ion/Type/ArrayTypeTest.php b/tests/Ion/Type/ArrayTypeTest.php index 0f907ff..a69ca9c 100644 --- a/tests/Ion/Type/ArrayTypeTest.php +++ b/tests/Ion/Type/ArrayTypeTest.php @@ -1,7 +1,9 @@ arr([]); - $this->setExpectedException('InvalidArgumentException', "Method 'foo' does not exist"); + $this->expectException('InvalidArgumentException'); + $this->expectExceptionMessage("Method 'foo' does not exist"); + $obj->foo(); }