File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ namespace AppZap \PHPFramework \Tests \Unit ;
3
+
4
+ use AppZap \PHPFramework \Domain \Repository \AbstractDomainRepository ;
5
+
6
+ class TestRepository1 extends AbstractDomainRepository{}
7
+ class TestRepository2 extends AbstractDomainRepository{}
8
+
9
+ class SingletonTest extends \PHPUnit_Framework_TestCase {
10
+
11
+ /**
12
+ * @test
13
+ */
14
+ public function getTheSameInstanceEveryTime () {
15
+ $ repo1Instance1 = TestRepository1::getInstance ();
16
+ $ repo1Instance2 = TestRepository1::getInstance ();
17
+ $ this ->assertSame ($ repo1Instance1 , $ repo1Instance2 );
18
+ }
19
+
20
+ /**
21
+ * @test
22
+ */
23
+ public function getRightClass () {
24
+ $ repo1Instance1 = TestRepository1::getInstance ();
25
+ $ repo2Instance1 = TestRepository2::getInstance ();
26
+ $ this ->assertTrue ($ repo1Instance1 instanceof TestRepository1);
27
+ $ this ->assertTrue ($ repo2Instance1 instanceof TestRepository2);
28
+ }
29
+
30
+ }
You can’t perform that action at this time.
0 commit comments