Properly namespace tests

This commit is contained in:
Timothy Warren 2016-08-29 11:34:25 -04:00
parent 2adb02daaa
commit 8f2ec8d4ed
16 changed files with 80 additions and 53 deletions

View File

@ -1,8 +1,10 @@
<?php
namespace Aviat\Ion\Tests;
use Aviat\Ion\Model as BaseModel;
class BaseModelTest extends Ion_TestCase {
class BaseModelTest extends \Ion_TestCase {
public function testBaseModelSanity()
{

View File

@ -1,5 +1,7 @@
<?php
namespace Aviat\Ion\Tests\Cache\Driver;
trait CacheDriverBase {
protected $foo = [

View File

@ -1,10 +1,10 @@
<?php
require_once('CacheDriverBase.php');
namespace Aviat\Ion\Tests\Cache\Driver;
use Aviat\Ion\Cache\Driver\NullDriver;
class CacheNullDriverTest extends Ion_TestCase {
class CacheNullDriverTest extends \Ion_TestCase {
use CacheDriverBase;
protected $driver;

View File

@ -1,11 +1,11 @@
<?php
require_once('CacheDriverBase.php');
namespace Aviat\Ion\Tests\Cache\Driver;
use Aviat\Ion\Config;
use Aviat\Ion\Cache\Driver\RedisDriver;
class CacheRedisDriverTestTwo extends Ion_TestCase {
class CacheRedisDriverTestTwo extends \Ion_TestCase {
use CacheDriverBase;
protected $driver;

View File

@ -1,10 +1,10 @@
<?php
require_once('CacheDriverBase.php');
namespace Aviat\Ion\Tests\Cache\Driver;
use Aviat\Ion\Cache\Driver\RedisDriver;
class CacheRedisDriverTest extends Ion_TestCase {
class CacheRedisDriverTest extends \Ion_TestCase {
use CacheDriverBase;
protected $driver;

View File

@ -1,11 +1,11 @@
<?php
require_once('CacheDriverBase.php');
namespace Aviat\Ion\Tests\Cache\Driver;
use Aviat\Ion\Friend;
use Aviat\Ion\Cache\Driver\SQLDriver;
class CacheSQLDriverTest extends Ion_TestCase {
class CacheSQLDriverTest extends \Ion_TestCase {
use CacheDriverBase;
protected $driver;

View File

@ -1,8 +1,10 @@
<?php
namespace Aviat\Ion\Tests;
use Aviat\Ion\Config;
class ConfigTest extends Ion_TestCase {
class ConfigTest extends \Ion_TestCase {
public function setUp()
{
@ -37,7 +39,7 @@ class ConfigTest extends Ion_TestCase {
public function testConfigBadSet()
{
$this->setExpectedException('InvalidArgumentException');
$this->expectException('InvalidArgumentException');
$this->config->set(NULL, FALSE);
}

View File

@ -1,5 +1,7 @@
<?php
namespace Aviat\Ion\Tests\Di;
use Aviat\Ion\Di\Container;
use Aviat\Ion\Di\ContainerAware;
use Aviat\Ion\Di\ContainerInterface;
@ -15,7 +17,7 @@ class Aware {
}
class ContainerAwareTest extends Ion_TestCase {
class ContainerAwareTest extends \Ion_TestCase {
public function setUp()
{

View File

@ -1,5 +1,7 @@
<?php
namespace Aviat\Ion\Tests\Di;
use Aviat\Ion\Di\Container;
use Aviat\Ion\Di\Exception\ContainerException;
use Monolog\Logger;
@ -7,7 +9,7 @@ use Monolog\Handler\TestHandler;
use Monolog\Handler\NullHandler;
class ContainerTest extends Ion_TestCase {
class ContainerTest extends \Ion_TestCase {
public function setUp()
{

View File

@ -1,8 +1,11 @@
<?php
use Aviat\Ion\Enum;
namespace Aviat\Ion\Tests;
class EnumTest extends Ion_TestCase {
use Aviat\Ion\Enum;
use TestEnum;
class EnumTest extends \Ion_TestCase {
protected $expectedConstList = [
'FOO' => 'bar',

View File

@ -1,8 +1,10 @@
<?php
namespace Aviat\Ion\Tests\Exception;
use Aviat\Ion\Exception\DoubleRenderException;
class DoubleRenderExceptionTest extends Ion_TestCase {
class DoubleRenderExceptionTest extends \Ion_TestCase {
public function testDefaultMessage()
{

View File

@ -1,13 +1,15 @@
<?php
namespace Aviat\Ion\Tests;
use Aviat\Ion\Friend;
class FriendTest extends Ion_TestCase {
class FriendTest extends \Ion_TestCase {
public function setUp()
{
parent::setUp();
$obj = new FriendTestClass();
$obj = new \FriendTestClass();
$this->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();
}
}

View File

@ -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);
}
}

View File

@ -1,8 +1,10 @@
<?php
namespace Aviat\Ion\Tests\Model;
use Aviat\Ion\Model\DB as BaseDBModel;
class BaseDBModelTest extends Ion_TestCase {
class BaseDBModelTest extends \Ion_TestCase {
public function testBaseDBModelSanity()
{

View File

@ -1,13 +1,15 @@
<?php
class AbstractTransformerTest extends Ion_TestCase {
namespace Aviat\Ion\Tests\Transformer;
class AbstractTransformerTest extends \Ion_TestCase {
protected $transformer;
public function setUp()
{
$this->transformer = new TestTransformer();
$this->transformer = new \TestTransformer();
}
public function dataTransformCollection()

View File

@ -1,7 +1,9 @@
<?php
class ArrayTypeTest extends Ion_TestCase {
use Aviat\Ion\ArrayWrapper;
namespace Aviat\Ion\Tests\Type;
class ArrayTypeTest extends \Ion_TestCase {
use \Aviat\Ion\ArrayWrapper;
public function setUp()
@ -124,7 +126,9 @@ class ArrayTypeTest extends Ion_TestCase {
{
$obj = $this->arr([]);
$this->setExpectedException('InvalidArgumentException', "Method 'foo' does not exist");
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage("Method 'foo' does not exist");
$obj->foo();
}