mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-09-25 22:09:23 +02:00
Use class constant instead of hardcoded namespace
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace DesignPatterns\Structural\DataMapper\Tests;
|
||||
|
||||
use DesignPatterns\Structural\DataMapper\StorageAdapter;
|
||||
use DesignPatterns\Structural\DataMapper\User;
|
||||
use DesignPatterns\Structural\DataMapper\UserMapper;
|
||||
|
||||
class DataMapperTest extends \PHPUnit_Framework_TestCase
|
||||
@@ -14,7 +15,7 @@ class DataMapperTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$user = $mapper->findById(1);
|
||||
|
||||
$this->assertInstanceOf('DesignPatterns\Structural\DataMapper\User', $user);
|
||||
$this->assertInstanceOf(User::class, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -3,19 +3,20 @@
|
||||
namespace DesignPatterns\Structural\Registry\Tests;
|
||||
|
||||
use DesignPatterns\Structural\Registry\Registry;
|
||||
use stdClass;
|
||||
|
||||
class RegistryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testSetAndGetLogger()
|
||||
{
|
||||
$key = Registry::LOGGER;
|
||||
$logger = new \stdClass();
|
||||
$logger = new stdClass();
|
||||
|
||||
Registry::set($key, $logger);
|
||||
$storedLogger = Registry::get($key);
|
||||
|
||||
$this->assertSame($logger, $storedLogger);
|
||||
$this->assertInstanceOf('stdClass', $storedLogger);
|
||||
$this->assertInstanceOf(stdClass::class, $storedLogger);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,7 +24,7 @@ class RegistryTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testThrowsExceptionWhenTryingToSetInvalidKey()
|
||||
{
|
||||
Registry::set('foobar', new \stdClass());
|
||||
Registry::set('foobar', new stdClass());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user