Skip to content

Commit 49d1f7e

Browse files
authored
Merge pull request #3 from imliam/master
Add GitHub Actions & Fix Tests
2 parents 0b5906a + ee7773f commit 49d1f7e

File tree

4 files changed

+99
-0
lines changed

4 files changed

+99
-0
lines changed

.github/workflows/tests.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Run Tests
2+
on: [push]
3+
4+
jobs:
5+
run:
6+
runs-on: ubuntu-latest
7+
strategy:
8+
max-parallel: 15
9+
fail-fast: false
10+
matrix:
11+
php-versions: ['7.2', '7.3', '7.4']
12+
laravel-versions: ['^7.0']
13+
name: Test on PHP ${{ matrix.php-versions }}, Laravel ${{ matrix.laravel-versions }}
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@master
17+
- name: Install PHP
18+
uses: shivammathur/setup-php@master
19+
with:
20+
php-version: ${{ matrix.php-versions }}
21+
- name: Create Laravel app
22+
run: |
23+
composer create-project laravel/laravel=${{ matrix.laravel-versions }} ../app --prefer-dist
24+
- name: Install Packages
25+
run: |
26+
mkdir -p ../app
27+
cd ../app
28+
composer require livewire/livewire
29+
composer config repositories.local '{"type": "path", "url": "../tall"}' --file composer.json
30+
composer require laravel-frontend-presets/tall dev-master
31+
php artisan ui tall --auth
32+
- name: Run PHPUnit
33+
run: |
34+
cd ../app
35+
php vendor/bin/phpunit

src/TallPreset.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public static function install()
3333
$filesystem->deleteDirectory(resource_path('sass'));
3434

3535
$filesystem->copyDirectory(__DIR__ . '/../stubs/default', base_path());
36+
37+
static::updateDefaultHomeRoute();
3638
}
3739

3840
public static function installAuth()
@@ -49,4 +51,11 @@ protected static function updatePackageArray(array $packages)
4951
Arr::except($packages, static::NPM_PACKAGES_TO_REMOVE)
5052
);
5153
}
54+
55+
protected static function updateDefaultHomeRoute()
56+
{
57+
$originalProvider = file_get_contents(app_path('Providers/RouteServiceProvider.php'));
58+
$newProvider = str_replace("public const HOME = '/home';", "public const HOME = '/';", $originalProvider);
59+
file_put_contents(app_path('Providers/RouteServiceProvider.php'), $newProvider);
60+
}
5261
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class CreatePasswordResetsTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('password_resets', function (Blueprint $table) {
17+
$table->string('email')->index();
18+
$table->string('token');
19+
$table->timestamp('created_at')->nullable();
20+
});
21+
}
22+
23+
/**
24+
* Reverse the migrations.
25+
*
26+
* @return void
27+
*/
28+
public function down()
29+
{
30+
Schema::dropIfExists('password_resets');
31+
}
32+
}

stubs/default/tests/TestCase.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Tests;
4+
5+
use Illuminate\Foundation\Mix;
6+
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
7+
8+
abstract class TestCase extends BaseTestCase
9+
{
10+
use CreatesApplication;
11+
12+
protected function setUp(): void
13+
{
14+
parent::setUp();
15+
16+
// Swap out the Mix manifest implementation, so we don't need
17+
// to run the npm commands to generate a manifest file for
18+
// the assets in order to run tests that return views.
19+
$this->swap(Mix::class, function () {
20+
return '';
21+
});
22+
}
23+
}

0 commit comments

Comments
 (0)