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 +108,7 @@ public function refactor(Node $node): ?Class_
83
108
publicfunctiongetRuleDefinition(): RuleDefinition
84
109
{
85
110
returnnewRuleDefinition(
86
-
'Add #[AllowMockObjectsWithoutExpectations] attribute to PHPUnit test classes with mock properties used in multiple methods',
111
+
'Add #[AllowMockObjectsWithoutExpectations] attribute to PHPUnit test classes with mock properties used in multiple methods but one, to avoid irrelevant notices in tests run',
87
112
[
88
113
newCodeSample(
89
114
<<<'CODE_SAMPLE'
@@ -125,20 +150,22 @@ protected function setUp(): void
125
150
126
151
public function testOne(): void
127
152
{
128
-
// use $this->someServiceMock
153
+
$this->someServiceMock->expects($this->once())
154
+
->method('someMethod')
155
+
->willReturn('someValue');
129
156
}
130
157
131
158
public function testTwo(): void
132
159
{
133
-
// use $this->someServiceMock
160
+
$this->someServiceMock->expects($this->once())
161
+
->method('someMethod')
162
+
->willReturn('anotherValue');
134
163
}
135
164
}
136
165
CODE_SAMPLE
137
166
),
138
-
139
167
]
140
168
);
141
-
142
169
}
143
170
144
171
/**
@@ -187,4 +214,57 @@ private function shouldSkipClass(Class_ $class): bool
0 commit comments