@@ -12,24 +12,42 @@ class ViolationBaselineTest extends TestCase
1212 /**
1313 * @covers ::__construct
1414 * @covers ::getRuleName
15- * @covers ::getFileName
16- * @covers ::getMethodName
1715 */
18- public function testAccessorsWithoutMethod ()
16+ public function testGetRuleName ()
1917 {
2018 $ violation = new ViolationBaseline ('rule ' , 'foobar ' , null );
2119 static ::assertSame ('rule ' , $ violation ->getRuleName ());
22- static ::assertSame ('foobar ' , $ violation ->getFileName ());
23- static ::assertNull ($ violation ->getMethodName ());
2420 }
2521
2622 /**
23+ * Test the give file matches the baseline correctly
24+ *
2725 * @covers ::__construct
28- * @covers ::getMethodName
26+ * @covers ::matches
27+ * @return void
2928 */
30- public function testAccessorsWithMethod ()
29+ public function testMatchesWithMethod ()
3130 {
32- $ violation = new ViolationBaseline ('rule ' , 'foobar ' , 'method ' );
33- static ::assertSame ('method ' , $ violation ->getMethodName ());
31+ $ violation = new ViolationBaseline ('sniff ' , 'foobar.txt ' , 'method ' );
32+ static ::assertTrue ($ violation ->matches ('foobar.txt ' , 'method ' ));
33+ static ::assertTrue ($ violation ->matches ('/test/foobar.txt ' , 'method ' ));
34+ static ::assertFalse ($ violation ->matches ('foo.txt ' , 'method ' ));
35+ static ::assertFalse ($ violation ->matches ('foobar.txt ' , 'unknown ' ));
36+ }
37+
38+ /**
39+ * Test the give file matches the baseline correctly
40+ *
41+ * @covers ::__construct
42+ * @covers ::matches
43+ * @return void
44+ */
45+ public function testMatchesWithoutMethod ()
46+ {
47+ $ violation = new ViolationBaseline ('sniff ' , 'foobar.txt ' , null );
48+ static ::assertTrue ($ violation ->matches ('foobar.txt ' , null ));
49+ static ::assertTrue ($ violation ->matches ('/test/foobar.txt ' , null ));
50+ static ::assertFalse ($ violation ->matches ('foobar.txt ' , 'method ' ));
51+ static ::assertFalse ($ violation ->matches ('/test/unknown.txt ' , null ));
3452 }
3553}
0 commit comments