Pārlūkot izejas kodu

travis run dusk

jqh 5 gadi atpakaļ
vecāks
revīzija
64fe9816f4

+ 1 - 0
.gitignore

@@ -7,3 +7,4 @@ package-lock.json
 mix-manifest.json
 /images/
 pre-dist
+/laravel-tests

+ 12 - 5
.travis.yml

@@ -1,7 +1,6 @@
 language: php
 
 php:
-  - 7.1
   - 7.2
   - 7.3
 
@@ -15,10 +14,18 @@ sudo: false
 services:
   - mysql
 
+install:
+  - mysql -e 'create database if not exists laravel;'
+  - travis_retry composer create-project --prefer-dist --no-suggest --no-interaction laravel/laravel laravel-tests
+  - cp -f ./tests/resources/stubs/artisan ./laravel-tests/
+  - cp -f ./tests/resources/stubs/ComposerConfigCommand.php ./laravel-tests/app/
+  - cd ./laravel-tests
+  - php artisan admin:composer-config
+  - travis_retry composer require dcat/laravel-admin:*@dev --no-interaction --prefer-dist --dev
+
 before_script:
-  - mysql -e 'create database if not exists laravel_dcat_admin_test;'
-  - travis_retry composer self-update
-  - travis_retry composer install --no-interaction
+  - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
+  - php artisan serve &
 
 script:
-  - composer test
+  - php artisan dusk

+ 29 - 0
tests/resources/stubs/ComposerConfigCommand.php

@@ -0,0 +1,29 @@
+<?php
+
+namespace App;
+
+use Illuminate\Console\Command;
+
+class ComposerConfigCommand extends Command
+{
+    protected $signature = 'admin:composer-config';
+
+    public function handle()
+    {
+        $composer = base_path('composer.json');
+
+        /* @var \Illuminate\Filesystem\Filesystem $files */
+        $files = app('files');
+
+        $contents = json_decode($files->get($composer), true);
+
+        $contents['repositories'] = [
+            [
+                'type' => 'path',
+                'url'  => '../',
+            ],
+        ];
+
+        $files->put($composer, str_replace('\\/', '/', json_encode($contents)));
+    }
+}

+ 61 - 0
tests/resources/stubs/artisan

@@ -0,0 +1,61 @@
+#!/usr/bin/env php
+<?php
+
+use Illuminate\Console\Application as Artisan;
+
+define('LARAVEL_START', microtime(true));
+
+/*
+|--------------------------------------------------------------------------
+| Register The Auto Loader
+|--------------------------------------------------------------------------
+|
+| Composer provides a convenient, automatically generated class loader
+| for our application. We just need to utilize it! We'll require it
+| into the script here so that we do not have to worry about the
+| loading of any our classes "manually". Feels great to relax.
+|
+*/
+
+require __DIR__.'/vendor/autoload.php';
+
+$app = require_once __DIR__.'/bootstrap/app.php';
+
+/*
+|--------------------------------------------------------------------------
+| Run The Artisan Application
+|--------------------------------------------------------------------------
+|
+| When we run the console application, the current CLI command will be
+| executed in this console and the response sent back to a terminal
+| or another output device for the developers. Here goes nothing!
+|
+*/
+
+Artisan::starting(function ($artisan) {
+    $artisan->resolveCommands([
+        App\ComposerConfigCommand::class,
+    ]);
+});
+
+$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
+
+$status = $kernel->handle(
+    $input = new Symfony\Component\Console\Input\ArgvInput,
+    new Symfony\Component\Console\Output\ConsoleOutput
+);
+
+/*
+|--------------------------------------------------------------------------
+| Shutdown The Application
+|--------------------------------------------------------------------------
+|
+| Once Artisan has finished running, we will fire off the shutdown events
+| so that any final work may be done by the application before we shut
+| down the process. This is the last thing to happen to the request.
+|
+*/
+
+$kernel->terminate($input, $status);
+
+exit($status);