Skip to content

Commit

Permalink
Merge pull request #3 from imliam/master
Browse files Browse the repository at this point in the history
Add GitHub Actions & Fix Tests
  • Loading branch information
danharrin authored May 7, 2020
2 parents 0b5906a + ee7773f commit 49d1f7e
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run Tests
on: [push]

jobs:
run:
runs-on: ubuntu-latest
strategy:
max-parallel: 15
fail-fast: false
matrix:
php-versions: ['7.2', '7.3', '7.4']
laravel-versions: ['^7.0']
name: Test on PHP ${{ matrix.php-versions }}, Laravel ${{ matrix.laravel-versions }}
steps:
- name: Checkout
uses: actions/checkout@master
- name: Install PHP
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
- name: Create Laravel app
run: |
composer create-project laravel/laravel=${{ matrix.laravel-versions }} ../app --prefer-dist
- name: Install Packages
run: |
mkdir -p ../app
cd ../app
composer require livewire/livewire
composer config repositories.local '{"type": "path", "url": "../tall"}' --file composer.json
composer require laravel-frontend-presets/tall dev-master
php artisan ui tall --auth
- name: Run PHPUnit
run: |
cd ../app
php vendor/bin/phpunit
9 changes: 9 additions & 0 deletions src/TallPreset.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public static function install()
$filesystem->deleteDirectory(resource_path('sass'));

$filesystem->copyDirectory(__DIR__ . '/../stubs/default', base_path());

static::updateDefaultHomeRoute();
}

public static function installAuth()
Expand All @@ -49,4 +51,11 @@ protected static function updatePackageArray(array $packages)
Arr::except($packages, static::NPM_PACKAGES_TO_REMOVE)
);
}

protected static function updateDefaultHomeRoute()
{
$originalProvider = file_get_contents(app_path('Providers/RouteServiceProvider.php'));
$newProvider = str_replace("public const HOME = '/home';", "public const HOME = '/';", $originalProvider);
file_put_contents(app_path('Providers/RouteServiceProvider.php'), $newProvider);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}
23 changes: 23 additions & 0 deletions stubs/default/tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Tests;

use Illuminate\Foundation\Mix;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
use CreatesApplication;

protected function setUp(): void
{
parent::setUp();

// Swap out the Mix manifest implementation, so we don't need
// to run the npm commands to generate a manifest file for
// the assets in order to run tests that return views.
$this->swap(Mix::class, function () {
return '';
});
}
}

0 comments on commit 49d1f7e

Please sign in to comment.