diff --git a/.travis.yml b/.travis.yml index 91d06a2f..881e7144 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,6 @@ before_script: - mysql -e 'CREATE DATABASE IF NOT EXISTS test;' - php artisan key:random - php artisan salt:random -- php -f ./tests/scripts/download-plugins.php script: ./vendor/bin/phpunit diff --git a/tests/PluginControllerTest.php b/tests/PluginControllerTest.php index 7e5307fd..ee3d7704 100644 --- a/tests/PluginControllerTest.php +++ b/tests/PluginControllerTest.php @@ -11,6 +11,26 @@ class PluginControllerTest extends TestCase protected function setUp() { parent::setUp(); + + $plugins = [ + 'example-plugin' => 'example-plugin_v1.0.zip', + 'avatar-api' => 'avatar-api_v1.1.zip' + ]; + foreach ($plugins as $plugin_name => $filename) { + if (!file_exists(base_path('plugins/'.$plugin_name))) { + file_put_contents( + storage_path('testing/'.$filename), + file_get_contents("https://github.com/printempw/blessing-skin-plugins/raw/master/dist/$filename") + ); + + $zip = new ZipArchive(); + $zip->open(storage_path('testing/'.$filename)); + $zip->extractTo(base_path('plugins/')); + $zip->close(); + unlink(storage_path('testing/'.$filename)); + } + } + return $this->actAs('admin'); } diff --git a/tests/scripts/download-plugins.php b/tests/scripts/download-plugins.php deleted file mode 100644 index 33ade77d..00000000 --- a/tests/scripts/download-plugins.php +++ /dev/null @@ -1,57 +0,0 @@ -open('./storage/'.$filename); - $zip->extractTo('./plugins/'); - $zip->close(); - unlink('./storage/'.$filename); - } catch (Exception $e) { - fwrite(STDOUT, error("Failed to unzip!")); - exit(1); - } - $time_diff = round(microtime(true) - $timer, 3); - fwrite(STDOUT, success("Finished: \"$plugin_name\" in {$time_diff}s")); - } else { - fwrite(STDOUT, success("Plugin \"$plugin_name\" is existed. OK.")); - } -} - -$plugins = [ - 'example-plugin' => 'example-plugin_v1.0.zip', - 'avatar-api' => 'avatar-api_v1.1.zip' -]; - -foreach ($plugins as $plugin_name => $filename) { - getPlugin($plugin_name, $filename); -}