@@ -26,26 +26,71 @@ public function testBuild()
26
26
}
27
27
28
28
/**
29
- * Test build() would never create the same class name.
29
+ * Test build() would never create the same class name for different signatures .
30
30
*
31
31
* @test
32
32
*/
33
- public function testSubsequentCallsProduceDifferentClasses ()
33
+ public function testDiverseSignaturesProduceDifferentClasses ()
34
34
{
35
35
$ builder = new MockDelegateFunctionBuilder ();
36
36
37
- $ builder ->build ();
37
+ $ builder ->build (create_function ( '' , '' ) );
38
38
$ class1 = $ builder ->getFullyQualifiedClassName ();
39
39
40
- $ builder ->build ();
40
+ $ builder ->build (create_function ( ' $a ' , '' ) );
41
41
$ class2 = $ builder ->getFullyQualifiedClassName ();
42
42
43
43
$ builder2 = new MockDelegateFunctionBuilder ();
44
- $ builder2 ->build ();
44
+ $ builder2 ->build (create_function ( ' $a, $b ' , '' ) );
45
45
$ class3 = $ builder2 ->getFullyQualifiedClassName ();
46
46
47
47
$ this ->assertNotEquals ($ class1 , $ class2 );
48
48
$ this ->assertNotEquals ($ class1 , $ class3 );
49
49
$ this ->assertNotEquals ($ class2 , $ class3 );
50
50
}
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
+ }
51
96
}
0 commit comments