@@ -56,9 +56,60 @@ public function testItRulesOutFilesOutsideVendorsAsIndirect()
56
56
$ this ->assertFalse ($ deprecation ->isIndirect ());
57
57
}
58
58
59
+ public function providerIsSelf (): array
60
+ {
61
+ return [
62
+ 'not_from_vendors_file ' => [true , '' , 'MyClass1 ' , '' ],
63
+ 'nonexistent_file ' => [false , '' , 'MyClass1 ' , 'dummy_vendor_path ' ],
64
+ 'serialized_trace_without_triggering_file ' => [
65
+ true ,
66
+ serialize (['class ' => '' , 'method ' => '' , 'deprecation ' => '' , 'files_stack ' => []]),
67
+ SymfonyTestsListenerForV5::class,
68
+ '' ,
69
+ ],
70
+ 'serialized_trace_with_not_from_vendors_triggering_file ' => [
71
+ true ,
72
+ serialize ([
73
+ 'class ' => '' ,
74
+ 'method ' => '' ,
75
+ 'deprecation ' => '' ,
76
+ 'triggering_file ' => '' ,
77
+ 'files_stack ' => [],
78
+ ]),
79
+ SymfonyTestsListenerForV5::class,
80
+ '' ,
81
+ ],
82
+ 'serialized_trace_with_nonexistent_triggering_file ' => [
83
+ false ,
84
+ serialize ([
85
+ 'class ' => '' ,
86
+ 'method ' => '' ,
87
+ 'deprecation ' => '' ,
88
+ 'triggering_file ' => 'dummy_vendor_path ' ,
89
+ 'files_stack ' => [],
90
+ ]),
91
+ SymfonyTestsListenerForV5::class,
92
+ '' ,
93
+ ],
94
+ ];
95
+ }
96
+
97
+ /**
98
+ * @dataProvider providerIsSelf
99
+ */
100
+ public function testIsSelf (bool $ expectedIsSelf , string $ message , string $ traceClass , string $ file ): void
101
+ {
102
+ $ trace = [
103
+ ['class ' => 'MyClass1 ' , 'function ' => 'myMethod ' ],
104
+ ['class ' => $ traceClass , 'function ' => 'myMethod ' ],
105
+ ];
106
+ $ deprecation = new Deprecation ($ message , $ trace , $ file );
107
+ $ this ->assertEquals ($ expectedIsSelf , $ deprecation ->isSelf ());
108
+ }
109
+
59
110
/**
60
111
* This method is here to simulate the extra level from the piece of code
61
- * triggering an error to the error handler
112
+ * triggering an error to the error handler.
62
113
*/
63
114
public function debugBacktrace (): array
64
115
{
0 commit comments