@@ -709,13 +709,16 @@ public function providerImplementationChanged()
709709 ];
710710 }
711711
712- public function testClassMethodCaseChangeIsIgnored ()
712+ /**
713+ * @dataProvider providerCaseChanged
714+ */
715+ public function testClassMethodCaseChangeChanged ($ context , $ visibility , $ code )
713716 {
714- $ constructor = $ this ->getConstructorForContext (' class ' );
717+ $ constructor = $ this ->getConstructorForContext ($ context );
715718 $ classBefore = new $ constructor ('tmp ' , [
716719 'stmts ' => [
717720 new ClassMethod ('tmpMethod ' , [
718- 'type ' => Visibility::getModifier (' public ' ),
721+ 'type ' => Visibility::getModifier ($ visibility ),
719722 'stmts ' => [
720723 new MethodCall (new Variable ('test ' ), 'someMethod ' ),
721724 ],
@@ -726,17 +729,33 @@ public function testClassMethodCaseChangeIsIgnored()
726729 $ classAfter = new $ constructor ('tmp ' , [
727730 'stmts ' => [
728731 new ClassMethod ('tmpmethod ' , [
729- 'type ' => Visibility::getModifier (' public ' ),
732+ 'type ' => Visibility::getModifier ($ visibility ),
730733 'stmts ' => [
731734 new MethodCall (new Variable ('test ' ), 'someMethod ' ),
732735 ],
733736 ]),
734737 ],
735738 ]);
736739
737- $ analyzer = new ClassMethodAnalyzer (' class ' );
740+ $ analyzer = new ClassMethodAnalyzer ($ context );
738741 $ report = $ analyzer ->analyze ($ classBefore , $ classAfter );
739742
740- Assert::assertDifference ($ report , 'class ' , Level::PATCH );
743+ Assert::assertDifference ($ report , $ context , Level::PATCH );
744+
745+ $ expectedLevel = LevelMapping::getLevelForCode ($ code );
746+ $ this ->assertSame ($ code , $ report [$ context ][$ expectedLevel ][0 ]->getCode ());
747+ $ this ->assertSame (sprintf ('[%s] Method has been renamed (case only). ' , $ visibility ), $ report [$ context ][$ expectedLevel ][0 ]->getReason ());
741748 }
749+
750+ public function providerCaseChanged ()
751+ {
752+ return [
753+ ['class ' , 'public ' , 'V150 ' ],
754+ ['class ' , 'protected ' , 'V156 ' ],
755+ ['class ' , 'private ' , 'V157 ' ],
756+ ['trait ' , 'public ' , 'V152 ' ],
757+ ['trait ' , 'protected ' , 'V158 ' ],
758+ ['trait ' , 'private ' , 'V159 ' ],
759+ ];
760+ }
742761}
0 commit comments