13
13
14
14
use Gitonomy \Git \Blob ;
15
15
use Gitonomy \Git \Repository ;
16
+ use Prophecy \Argument ;
16
17
17
18
class RepositoryTest extends AbstractTest
18
19
{
@@ -62,17 +63,17 @@ public function testLoggerOk($repository)
62
63
$ this ->markTestSkipped ();
63
64
}
64
65
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 )
69
70
;
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 )
73
74
;
74
75
75
- $ repository ->setLogger ($ logger );
76
+ $ repository ->setLogger ($ loggerProphecy -> reveal () );
76
77
77
78
$ repository ->run ('remote ' );
78
79
}
@@ -87,21 +88,21 @@ public function testLoggerNOk($repository)
87
88
$ this ->markTestSkipped ();
88
89
}
89
90
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 )
94
95
;
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 )
98
99
;
99
- $ logger
100
- ->expects ( $ this -> once ( ))
101
- ->method ( ' error ' )
100
+ $ loggerProphecy
101
+ ->error (Argument:: type ( ' string ' ))
102
+ ->shouldBeCalledTimes ( 1 )
102
103
;
103
104
104
- $ repository ->setLogger ($ logger );
105
+ $ repository ->setLogger ($ loggerProphecy -> reveal () );
105
106
106
107
$ repository ->run ('not-work ' );
107
108
}
0 commit comments