From 6ab5de726be38818e6a8c8c888ab4eab2b9fb25c Mon Sep 17 00:00:00 2001 From: Dinand Mentink Date: Fri, 16 Oct 2020 16:57:33 +0200 Subject: [PATCH 1/3] Rename Stubs dir to stubs Default laravel/laravel stubs dir uses lowercase --- src/Orangehill/Iseed/Iseed.php | 2 +- src/Orangehill/Iseed/{Stubs => stubs}/seed.stub | 0 tests/IseedTest.php | 8 ++++---- tests/{Stubs => stubs}/seed.stub | 0 tests/{Stubs => stubs}/seed_5.stub | 0 tests/{Stubs => stubs}/seed_505.stub | 0 tests/{Stubs => stubs}/seed_blank.stub | 0 7 files changed, 5 insertions(+), 5 deletions(-) rename src/Orangehill/Iseed/{Stubs => stubs}/seed.stub (100%) rename tests/{Stubs => stubs}/seed.stub (100%) rename tests/{Stubs => stubs}/seed_5.stub (100%) rename tests/{Stubs => stubs}/seed_505.stub (100%) rename tests/{Stubs => stubs}/seed_blank.stub (100%) diff --git a/src/Orangehill/Iseed/Iseed.php b/src/Orangehill/Iseed/Iseed.php index 26eb5c9..20e5c8e 100644 --- a/src/Orangehill/Iseed/Iseed.php +++ b/src/Orangehill/Iseed/Iseed.php @@ -206,7 +206,7 @@ public function generateClassName($table, $prefix=null, $suffix=null) */ public function getStubPath() { - return __DIR__ . DIRECTORY_SEPARATOR . 'Stubs'; + return __DIR__ . DIRECTORY_SEPARATOR . 'stubs'; } /** diff --git a/src/Orangehill/Iseed/Stubs/seed.stub b/src/Orangehill/Iseed/stubs/seed.stub similarity index 100% rename from src/Orangehill/Iseed/Stubs/seed.stub rename to src/Orangehill/Iseed/stubs/seed.stub diff --git a/tests/IseedTest.php b/tests/IseedTest.php index 3735703..63edf3f 100644 --- a/tests/IseedTest.php +++ b/tests/IseedTest.php @@ -13,8 +13,8 @@ public function __construct() { parent::__construct(); - static::$stubsDir = __DIR__.'/../src/Orangehill/Iseed/Stubs'; - static::$testStubsDir = __DIR__.'/Stubs'; + static::$stubsDir = __DIR__.'/../src/Orangehill/Iseed/stubs'; + static::$testStubsDir = __DIR__.'/stubs'; } public function tearDown(): void @@ -2131,7 +2131,7 @@ public function testCanGetStubPath() { $iseed = new Orangehill\Iseed\Iseed(); $output = $iseed->getStubPath(); - $expected = substr(__DIR__, 0, -5).'src'.DIRECTORY_SEPARATOR.'Orangehill'.DIRECTORY_SEPARATOR.'Iseed'.DIRECTORY_SEPARATOR.'Stubs'; + $expected = substr(__DIR__, 0, -5).'src'.DIRECTORY_SEPARATOR.'Orangehill'.DIRECTORY_SEPARATOR.'Iseed'.DIRECTORY_SEPARATOR.'stubs'; $this->assertEquals($expected, $output); } @@ -2142,7 +2142,7 @@ public function testCanGenerateSeed() $mocked = m::mock(\Orangehill\Iseed\Iseed::class, [$file, $composer])->makePartial(); $mocked->shouldReceive('readStubFile') ->once() - ->with(substr(__DIR__, 0, -5).'src'.DIRECTORY_SEPARATOR.'Orangehill'.DIRECTORY_SEPARATOR.'Iseed'.DIRECTORY_SEPARATOR.'Stubs'.DIRECTORY_SEPARATOR.'seed.stub'); + ->with(substr(__DIR__, 0, -5).'src'.DIRECTORY_SEPARATOR.'Orangehill'.DIRECTORY_SEPARATOR.'Iseed'.DIRECTORY_SEPARATOR.'stubs'.DIRECTORY_SEPARATOR.'seed.stub'); $file->shouldReceive('put')->once()->with('seedPath', 'populatedStub'); $mocked->shouldReceive('hasTable')->once()->andReturn(true); $mocked->shouldReceive('getData')->once()->andReturn([]); diff --git a/tests/Stubs/seed.stub b/tests/stubs/seed.stub similarity index 100% rename from tests/Stubs/seed.stub rename to tests/stubs/seed.stub diff --git a/tests/Stubs/seed_5.stub b/tests/stubs/seed_5.stub similarity index 100% rename from tests/Stubs/seed_5.stub rename to tests/stubs/seed_5.stub diff --git a/tests/Stubs/seed_505.stub b/tests/stubs/seed_505.stub similarity index 100% rename from tests/Stubs/seed_505.stub rename to tests/stubs/seed_505.stub diff --git a/tests/Stubs/seed_blank.stub b/tests/stubs/seed_blank.stub similarity index 100% rename from tests/Stubs/seed_blank.stub rename to tests/stubs/seed_blank.stub From cc311c44dc2976ed7ebf9b9cf6308453c8149180 Mon Sep 17 00:00:00 2001 From: Dinand Mentink Date: Fri, 16 Oct 2020 17:10:28 +0200 Subject: [PATCH 2/3] Use database/seeders over database/seeds for default laravel 8 support --- src/config/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/config.php b/src/config/config.php index 3520cee..9720983 100644 --- a/src/config/config.php +++ b/src/config/config.php @@ -1,5 +1,5 @@ '/database/seeds', + 'path' => '/database/seeders', 'chunk_size' => 500 // Maximum number of rows per insert statement ); From 4599ed311bcc57575f2a8250587d1d08c6a215f0 Mon Sep 17 00:00:00 2001 From: Dinand Mentink Date: Fri, 16 Oct 2020 17:19:58 +0200 Subject: [PATCH 3/3] Add Database\Seeders namespace to seed stub --- src/Orangehill/Iseed/stubs/seed.stub | 2 ++ tests/stubs/seed.stub | 2 ++ tests/stubs/seed_5.stub | 2 ++ tests/stubs/seed_505.stub | 2 ++ tests/stubs/seed_blank.stub | 2 ++ 5 files changed, 10 insertions(+) diff --git a/src/Orangehill/Iseed/stubs/seed.stub b/src/Orangehill/Iseed/stubs/seed.stub index 382eb2a..8363940 100644 --- a/src/Orangehill/Iseed/stubs/seed.stub +++ b/src/Orangehill/Iseed/stubs/seed.stub @@ -1,5 +1,7 @@