You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: rules-tests/PHPUnit120/Rector/Class_/AllowMockObjectsWithoutExpectationsAttributeRector/Fixture/skip_if_mock_not_used_in_2_test_methods.php.inc
-1Lines changed: 0 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,5 @@ final class SkipIfMockNotUsedIn2TestMethods extends TestCase
@@ -83,7 +110,7 @@ public function refactor(Node $node): ?Class_
83
110
publicfunctiongetRuleDefinition(): RuleDefinition
84
111
{
85
112
returnnewRuleDefinition(
86
-
'Add #[AllowMockObjectsWithoutExpectations] attribute to PHPUnit test classes with mock properties used in multiple methods',
113
+
'Add #[AllowMockObjectsWithoutExpectations] attribute to PHPUnit test classes with mock properties used in multiple methods but one, to avoid irrelevant notices in tests run',
87
114
[
88
115
newCodeSample(
89
116
<<<'CODE_SAMPLE'
@@ -125,20 +152,22 @@ protected function setUp(): void
125
152
126
153
public function testOne(): void
127
154
{
128
-
// use $this->someServiceMock
155
+
$this->someServiceMock->expects($this->once())
156
+
->method('someMethod')
157
+
->willReturn('someValue');
129
158
}
130
159
131
160
public function testTwo(): void
132
161
{
133
-
// use $this->someServiceMock
162
+
$this->someServiceMock->expects($this->once())
163
+
->method('someMethod')
164
+
->willReturn('anotherValue');
134
165
}
135
166
}
136
167
CODE_SAMPLE
137
168
),
138
-
139
169
]
140
170
);
141
-
142
171
}
143
172
144
173
/**
@@ -187,4 +216,57 @@ private function shouldSkipClass(Class_ $class): bool
0 commit comments