@@ -26,26 +26,71 @@ public function testBuild()
2626 }
2727
2828 /**
29- * Test build() would never create the same class name.
29+ * Test build() would never create the same class name for different signatures .
3030 *
3131 * @test
3232 */
33- public function testSubsequentCallsProduceDifferentClasses ()
33+ public function testDiverseSignaturesProduceDifferentClasses ()
3434 {
3535 $ builder = new MockDelegateFunctionBuilder ();
3636
37- $ builder ->build ();
37+ $ builder ->build (create_function ( '' , '' ) );
3838 $ class1 = $ builder ->getFullyQualifiedClassName ();
3939
40- $ builder ->build ();
40+ $ builder ->build (create_function ( ' $a ' , '' ) );
4141 $ class2 = $ builder ->getFullyQualifiedClassName ();
4242
4343 $ builder2 = new MockDelegateFunctionBuilder ();
44- $ builder2 ->build ();
44+ $ builder2 ->build (create_function ( ' $a, $b ' , '' ) );
4545 $ class3 = $ builder2 ->getFullyQualifiedClassName ();
4646
4747 $ this ->assertNotEquals ($ class1 , $ class2 );
4848 $ this ->assertNotEquals ($ class1 , $ class3 );
4949 $ this ->assertNotEquals ($ class2 , $ class3 );
5050 }
51+
52+ /**
53+ * Test build() would create the same class name for identical signatures.
54+ *
55+ * @test
56+ */
57+ public function testSameSignaturesProduceSameClass ()
58+ {
59+ $ signature = '$a ' ;
60+ $ builder = new MockDelegateFunctionBuilder ();
61+
62+ $ builder ->build (create_function ($ signature , '' ));
63+ $ class1 = $ builder ->getFullyQualifiedClassName ();
64+
65+ $ builder ->build (create_function ($ signature , '' ));
66+ $ class2 = $ builder ->getFullyQualifiedClassName ();
67+
68+ $ this ->assertEquals ($ class1 , $ class2 );
69+ }
70+
71+ /**
72+ * Tests declaring a class with enabled backupStaticAttributes.
73+ *
74+ * @test
75+ * @backupStaticAttributes enabled
76+ * @dataProvider provideTestBackupStaticAttributes
77+ */
78+ public function testBackupStaticAttributes ()
79+ {
80+ $ builder = new MockDelegateFunctionBuilder ();
81+ $ builder ->build ("min " );
82+ }
83+
84+ /**
85+ * Just repeat testBackupStaticAttributes a few times.
86+ *
87+ * @return array Test cases.
88+ */
89+ public function provideTestBackupStaticAttributes ()
90+ {
91+ return [
92+ [],
93+ []
94+ ];
95+ }
5196}
0 commit comments