@@ -96,6 +96,61 @@ public function testPublicRepositoryWithEmptyComposer($type, $filename)
96
96
$ this ->assertSame ($ validEmpty , $ gitDriver ->getComposerInformation ($ identifier ));
97
97
}
98
98
99
+ /**
100
+ * @dataProvider getAssetTypes
101
+ *
102
+ * @param string $type
103
+ * @param string $filename
104
+ */
105
+ public function testPublicRepositoryWithSkipUpdate ($ type , $ filename )
106
+ {
107
+ $ repoUrl = 'https://github.com/fxpio/composer-asset-plugin.git ' ;
108
+ $ identifier = '92bebbfdcde75ef2368317830e54b605bc938123 ' ;
109
+ $ io = $ this ->getMockBuilder ('Composer\IO\IOInterface ' )->getMock ();
110
+
111
+ $ this ->config ->merge (array (
112
+ 'config ' => array (
113
+ 'git-skip-update ' => '1 week ' ,
114
+ ),
115
+ ));
116
+
117
+ $ repoConfig = array (
118
+ 'url ' => $ repoUrl ,
119
+ 'asset-type ' => $ type ,
120
+ 'filename ' => $ filename ,
121
+ );
122
+
123
+ $ process = $ this ->getMockBuilder ('Composer\Util\ProcessExecutor ' )->getMock ();
124
+ $ process ->expects ($ this ->any ())
125
+ ->method ('splitLines ' )
126
+ ->will ($ this ->returnValue (array ()));
127
+ $ process ->expects ($ this ->any ())
128
+ ->method ('execute ' )
129
+ ->will ($ this ->returnCallback (function ($ command , &$ output = null ) use ($ identifier , $ repoConfig ) {
130
+ if ($ command === sprintf ('git show %s ' , sprintf ('%s:%s ' , escapeshellarg ($ identifier ), $ repoConfig ['filename ' ]))) {
131
+ $ output = '{"name": "foo"} ' ;
132
+ } elseif (false !== strpos ($ command , 'git log ' )) {
133
+ $ date = new \DateTime (null , new \DateTimeZone ('UTC ' ));
134
+ $ output = $ date ->getTimestamp ();
135
+ }
136
+
137
+ return 0 ;
138
+ }));
139
+
140
+ /* @var IOInterface $io */
141
+ /* @var ProcessExecutor $process */
142
+
143
+ $ gitDriver = new GitDriver ($ repoConfig , $ io , $ this ->config , $ process , null );
144
+ $ gitDriver ->initialize ();
145
+
146
+ $ validEmpty = array (
147
+ '_nonexistent_package ' => true ,
148
+ );
149
+
150
+ $ this ->assertNotNull ($ gitDriver ->getComposerInformation ($ identifier ));
151
+ $ this ->assertNotSame ($ validEmpty , $ gitDriver ->getComposerInformation ($ identifier ));
152
+ }
153
+
99
154
/**
100
155
* @dataProvider getAssetTypes
101
156
*
0 commit comments