@@ -15,13 +15,11 @@ class StableDependenciesPrincipleTest extends TestCase
1515{
1616 public function testItIgnoresNonPackageMetrics ()
1717 {
18- $ metric = $ this ->prophesize (Metric::class);
19-
18+ $ metric = $ this ->getMockBuilder (Metric::class)-> getMock ( );
19+ $ metric -> expects ( $ this -> never ())-> method ( ' get ' );
2020 $ object = new StableDependenciesPrinciple ();
2121
22- $ object ->apply ($ metric ->reveal ());
23-
24- $ metric ->get ('violations ' )->shouldNotHaveBeenCalled ();
22+ $ object ->apply ($ metric );
2523 }
2624
2725 /**
@@ -36,14 +34,14 @@ public function testItAddsViolationsIfOneDependentPackageIsMoreUnstableOrAsUnsta
3634 $ expectedViolationCount
3735 ) {
3836 $ violations = new Violations ();
39- $ metric = $ this ->prophesize (PackageMetric::class);
40- $ metric ->getInstability ( )->willReturn ($ packageInstability );
41- $ metric ->getDependentInstabilities ( )->willReturn ($ dependentInstabilities );
42- $ metric ->get ( ' violations ' )->willReturn ($ violations );
37+ $ metric = $ this ->getMockBuilder (PackageMetric::class)-> disableOriginalConstructor ()-> getMock ( );
38+ $ metric ->method ( ' getInstability ' )->willReturn ($ packageInstability );
39+ $ metric ->method ( ' getDependentInstabilities ' )->willReturn ($ dependentInstabilities );
40+ $ metric ->method ( ' get ' )->willReturn ($ violations );
4341
4442 $ object = new StableDependenciesPrinciple ();
4543
46- $ object ->apply ($ metric-> reveal () );
44+ $ object ->apply ($ metric );
4745
4846 $ this ->assertSame ($ expectedViolationCount , $ violations ->count ());
4947 }
0 commit comments