1313
1414use Gitonomy \Git \Blob ;
1515use Gitonomy \Git \Repository ;
16+ use Prophecy \Argument ;
1617
1718class RepositoryTest extends AbstractTest
1819{
@@ -62,17 +63,17 @@ public function testLoggerOk($repository)
6263 $ this ->markTestSkipped ();
6364 }
6465
65- $ logger = $ this ->getMock ('Psr\Log\LoggerInterface ' );
66- $ logger
67- ->expects ( $ this -> once () )
68- ->method ( ' info ' )
66+ $ loggerProphecy = $ this ->prophesize ('Psr\Log\LoggerInterface ' );
67+ $ loggerProphecy
68+ ->info ( ' run command: remote "" ' )
69+ ->shouldBeCalledTimes ( 1 )
6970 ;
70- $ logger
71- ->expects ( $ this -> exactly ( 3 )) // duration, return code and output
72- ->method ( ' debug ' )
71+ $ loggerProphecy
72+ ->debug (Argument:: type ( ' string ' )) // duration, return code and output
73+ ->shouldBeCalledTimes ( 3 )
7374 ;
7475
75- $ repository ->setLogger ($ logger );
76+ $ repository ->setLogger ($ loggerProphecy -> reveal () );
7677
7778 $ repository ->run ('remote ' );
7879 }
@@ -87,21 +88,21 @@ public function testLoggerNOk($repository)
8788 $ this ->markTestSkipped ();
8889 }
8990
90- $ logger = $ this ->getMock ('Psr\Log\LoggerInterface ' );
91- $ logger
92- ->expects ( $ this -> once ( ))
93- ->method ( ' info ' )
91+ $ loggerProphecy = $ this ->prophesize ('Psr\Log\LoggerInterface ' );
92+ $ loggerProphecy
93+ ->info (Argument:: type ( ' string ' ))
94+ ->shouldBeCalledTimes ( 1 )
9495 ;
95- $ logger
96- ->expects ( $ this -> exactly ( 3 )) // duration, return code and output
97- ->method ( ' debug ' )
96+ $ loggerProphecy
97+ ->debug (Argument:: type ( ' string ' )) // duration, return code and output
98+ ->shouldBeCalledTimes ( 3 )
9899 ;
99- $ logger
100- ->expects ( $ this -> once ( ))
101- ->method ( ' error ' )
100+ $ loggerProphecy
101+ ->error (Argument:: type ( ' string ' ))
102+ ->shouldBeCalledTimes ( 1 )
102103 ;
103104
104- $ repository ->setLogger ($ logger );
105+ $ repository ->setLogger ($ loggerProphecy -> reveal () );
105106
106107 $ repository ->run ('not-work ' );
107108 }
0 commit comments