generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
198 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
tests/PackageServiceProviderTests/MultiplePackageMigrationsTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Spatie\LaravelPackageTools\Tests\PackageServiceProviderTests; | ||
|
||
use Spatie\LaravelPackageTools\Package; | ||
use Spatie\TestTime\TestTime; | ||
|
||
class MultiplePackageMigrationsTest extends PackageServiceProviderTestCase | ||
{ | ||
public function configurePackage(Package $package) | ||
{ | ||
TestTime::freeze('Y-m-d H:i:s', '2020-01-01 00:00:00'); | ||
|
||
$package | ||
->name('laravel-package-tools') | ||
->hasMigrations(['create_laravel_package_tools_table']) | ||
->hasMigrations('create_other_laravel_package_tools_table', 'create_third_laravel_package_tools_table'); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_publish_the_migration() | ||
{ | ||
$this | ||
->artisan('vendor:publish --tag=package-tools-migrations') | ||
->assertExitCode(0); | ||
|
||
$this->assertFileExists(database_path('migrations/2020_01_01_000000_create_laravel_package_tools_table.php')); | ||
$this->assertFileExists(database_path('migrations/2020_01_01_000001_create_other_laravel_package_tools_table.php')); | ||
$this->assertFileExists(database_path('migrations/2020_01_01_000002_create_third_laravel_package_tools_table.php')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Spatie\LaravelPackageTools\Tests\PackageServiceProviderTests; | ||
|
||
use Spatie\LaravelPackageTools\Package; | ||
use Spatie\TestTime\TestTime; | ||
|
||
class PackageRoutesTest extends PackageServiceProviderTestCase | ||
{ | ||
public function configurePackage(Package $package) | ||
{ | ||
TestTime::freeze('Y-m-d H:i:s', '2020-01-01 00:00:00'); | ||
|
||
$package | ||
->name('laravel-package-tools') | ||
->hasRoutes('web', 'other'); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_load_the_route() | ||
{ | ||
$response = $this->get('my-route'); | ||
|
||
$response->assertSeeText('my response'); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_load_multiple_route() | ||
{ | ||
$adminResponse = $this->get('other-route'); | ||
|
||
$adminResponse->assertSeeText('other response'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Spatie\LaravelPackageTools\Tests\TestClasses; | ||
|
||
use Illuminate\Console\Command; | ||
|
||
class FourthTestCommand extends Command | ||
{ | ||
public $name = 'fourth-test-command'; | ||
|
||
public function handle() | ||
{ | ||
$this->info('output of test command'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Spatie\LaravelPackageTools\Tests\TestClasses; | ||
|
||
use Illuminate\Console\Command; | ||
|
||
class ThirdTestCommand extends Command | ||
{ | ||
public $name = 'third-test-command'; | ||
|
||
public function handle() | ||
{ | ||
$this->info('output of test command'); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/TestPackage/database/migrations/create_another_laravel_package_tools_table.php.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class CreateAnotherLaravelPackageToolsTable extends Migration | ||
{ | ||
public function up() | ||
{ | ||
Schema::create('laravel-package-tools_another-table', function (Blueprint $table) { | ||
$table->bigIncrements('id'); | ||
|
||
$table->timestamps(); | ||
}); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/TestPackage/database/migrations/create_other_laravel_package_tools_table.php.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class CreateLaravelPackageToolsTable extends Migration | ||
{ | ||
public function up() | ||
{ | ||
Schema::create('other-laravel-package-tools_table', function (Blueprint $table) { | ||
$table->bigIncrements('id'); | ||
|
||
$table->timestamps(); | ||
}); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/TestPackage/database/migrations/create_third_laravel_package_tools_table.php.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class CreateLaravelPackageToolsTable extends Migration | ||
{ | ||
public function up() | ||
{ | ||
Schema::create('third-laravel-package-tools_table', function (Blueprint $table) { | ||
$table->bigIncrements('id'); | ||
|
||
$table->timestamps(); | ||
}); | ||
} | ||
} |