@@ -161,7 +161,7 @@ public function testCheckWithInvalidXml() {
161161 $ this ->config
162162 ->expects ($ this ->at (6 ))
163163 ->method ('setAppValue ' )
164- ->with ('core ' , 'lastupdateResult ' , 'false ' );
164+ ->with ('core ' , 'lastupdateResult ' , '[] ' );
165165
166166 $ updateXml = 'Invalid XML Response! ' ;
167167 $ this ->updater
@@ -265,4 +265,55 @@ public function testCheckWithEmptyInvalidXmlResponse() {
265265
266266 $ this ->assertSame ($ expectedResult , $ this ->updater ->check ());
267267 }
268+
269+ public function testCheckWithMissingAttributeXmlResponse () {
270+ $ expectedResult = [
271+ 'version ' => '' ,
272+ 'versionstring ' => '' ,
273+ 'url ' => '' ,
274+ 'web ' => '' ,
275+ 'autoupdater ' => '' ,
276+ ];
277+
278+ $ this ->config
279+ ->expects ($ this ->at (0 ))
280+ ->method ('getAppValue ' )
281+ ->with ('core ' , 'lastupdatedat ' )
282+ ->will ($ this ->returnValue (0 ));
283+ $ this ->config
284+ ->expects ($ this ->at (1 ))
285+ ->method ('getSystemValue ' )
286+ ->with ('updater.server.url ' , 'https://updates.nextcloud.com/updater_server/ ' )
287+ ->willReturnArgument (1 );
288+ $ this ->config
289+ ->expects ($ this ->at (2 ))
290+ ->method ('setAppValue ' )
291+ ->with ('core ' , 'lastupdatedat ' , $ this ->isType ('integer ' ));
292+ $ this ->config
293+ ->expects ($ this ->at (4 ))
294+ ->method ('getAppValue ' )
295+ ->with ('core ' , 'installedat ' )
296+ ->will ($ this ->returnValue ('installedat ' ));
297+ $ this ->config
298+ ->expects ($ this ->at (5 ))
299+ ->method ('getAppValue ' )
300+ ->with ('core ' , 'lastupdatedat ' )
301+ ->will ($ this ->returnValue ('lastupdatedat ' ));
302+
303+ // missing autoupdater element should still not fail
304+ $ updateXml = '<?xml version="1.0"?>
305+ <owncloud>
306+ <version></version>
307+ <versionstring></versionstring>
308+ <url></url>
309+ <web></web>
310+ </owncloud> ' ;
311+ $ this ->updater
312+ ->expects ($ this ->once ())
313+ ->method ('getUrlContent ' )
314+ ->with ($ this ->buildUpdateUrl ('https://updates.nextcloud.com/updater_server/ ' ))
315+ ->will ($ this ->returnValue ($ updateXml ));
316+
317+ $ this ->assertSame ($ expectedResult , $ this ->updater ->check ());
318+ }
268319}
0 commit comments