Skip to content

Commit 19c2c8d

Browse files
committed
Added ClearCapableContainerInterface and test
1 parent 8578c65 commit 19c2c8d

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Dhii\Data\Container;
4+
5+
use Psr\Container\ContainerInterface as BaseContainerInterface;
6+
7+
/**
8+
* A container that can have its members cleared
9+
*
10+
* @since [*next-version*]
11+
*/
12+
interface ClearCapableContainerInterface extends
13+
BaseContainerInterface,
14+
ClearCapableInterface
15+
{
16+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
namespace Dhii\Data\Container\UnitTest;
4+
5+
use Xpmock\TestCase;
6+
use PHPUnit_Framework_MockObject_MockObject as MockObject;
7+
use Dhii\Data\Container\ClearCapableContainerInterface as TestSubject;
8+
9+
/**
10+
* Tests {@see TestSubject}.
11+
*
12+
* @since [*next-version*]
13+
*/
14+
class ClearCapableContainerInterfaceTest extends TestCase
15+
{
16+
/**
17+
* The name of the test subject.
18+
*
19+
* @since [*next-version*]
20+
*/
21+
const TEST_SUBJECT_CLASSNAME = 'Dhii\Data\Container\ClearCapableContainerInterface';
22+
23+
/**
24+
* Creates a new instance of the test subject.
25+
*
26+
* @since [*next-version*]
27+
*
28+
* @return TestSubject|MockObject The new instance.
29+
*/
30+
public function createInstance()
31+
{
32+
$mock = $this->getMockBuilder(self::TEST_SUBJECT_CLASSNAME)
33+
->getMock();
34+
35+
return $mock;
36+
}
37+
38+
/**
39+
* Tests whether a correct instance of a descendant can be created.
40+
*
41+
* @since [*next-version*]
42+
*/
43+
public function testCanBeCreated()
44+
{
45+
$subject = $this->createInstance();
46+
47+
$this->assertInstanceOf(self::TEST_SUBJECT_CLASSNAME, $subject, 'A correct instance of the test subject could not be created');
48+
$this->assertInstanceOf('Dhii\Data\Container\ClearCapableInterface', $subject, 'Subject does not implement required interface');
49+
$this->assertInstanceOf('Psr\Container\ContainerInterface', $subject, 'Subject does not implement required interface');
50+
}
51+
}

0 commit comments

Comments
 (0)