File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,9 @@ public static function get_latest_vccw_url()
36
36
$ api = "https://api.github.com/repos/vccw-team/vccw/releases/latest " ;
37
37
$ body = json_decode ( self ::download ( $ api ) );
38
38
39
- if ( $ body ) {
39
+ if ( ! empty ( $ body ->assets [0 ] ) && ! empty ( $ body ->assets [0 ]->browser_download_url ) ) {
40
+ return $ body ->assets [0 ]->browser_download_url ;
41
+ } elseif ( $ body ) {
40
42
return $ body ->zipball_url ;
41
43
}
42
44
}
Original file line number Diff line number Diff line change 2
2
3
3
class Scaffold_VCCW_Test extends WP_UnitTestCase
4
4
{
5
+ /**
6
+ * Tests for the `Scaffold_VCCW::get_latest_vccw_url()`.
7
+ *
8
+ * @test
9
+ * @since 1.3.0
10
+ */
11
+ public function get_latest_vccw_url ()
12
+ {
13
+ $ url = Scaffold_VCCW::get_latest_vccw_url ();
14
+ $ this ->assertRegExp ( '#^https://github.com/vccw-team/vccw/releases/download# ' , $ url );
15
+ }
16
+
5
17
/**
6
18
* Tests for the `Scaffold_VCCW::rempty()`.
7
19
*
You can’t perform that action at this time.
0 commit comments