mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-09-25 22:09:23 +02:00
30 lines
757 B
PHP
30 lines
757 B
PHP
<?php
|
|
|
|
namespace DesignPatterns\Structural\Registry\Tests;
|
|
|
|
use DesignPatterns\Structural\Registry\Registry;
|
|
|
|
class RegistryTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
public function testSimpleGetSet()
|
|
{
|
|
$key = 'myIdentifier';
|
|
$object = new \StdClass();
|
|
$object->props = array('a' => 1, 'b' => 2);
|
|
|
|
Registry::set($key, $object);
|
|
$actual = Registry::get($key);
|
|
|
|
$this->assertEquals($object, $actual);
|
|
$this->assertInstanceOf('StdClass', $actual);
|
|
}
|
|
|
|
public function testSetAndGetLogger()
|
|
{
|
|
Registry::set(Registry::LOGGER, new \StdClass());
|
|
|
|
$logger = Registry::get(Registry::LOGGER);
|
|
$this->assertInstanceOf('StdClass', $logger);
|
|
}
|
|
}
|