generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
c4079cf
commit 35b3389
Showing
11 changed files
with
136 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Envor\Datastore\Database\Factories; | ||
|
||
use Envor\Datastore\Driver; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
class DatastoreFactory extends Factory | ||
{ | ||
/** | ||
* The name of the factory's corresponding model. | ||
* | ||
* @var string | ||
*/ | ||
protected $model = \Envor\Datastore\Tests\Fixtures\Datastore::class; | ||
Check failure on line 15 in database/factories/DatastoreFactory.php
|
||
|
||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array | ||
*/ | ||
public function definition() | ||
{ | ||
return [ | ||
'uuid' => $this->faker->uuid, | ||
'name' => ':memory:', | ||
'driver' => Driver::SQLite, | ||
]; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
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,20 @@ | ||
<?php | ||
|
||
namespace Envor\Datastore\Tests\Fixtures; | ||
|
||
use Envor\Datastore\Concerns\HasDatastoreDriver; | ||
use Envor\Datastore\Driver; | ||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Datastore extends Model | ||
{ | ||
use HasDatastoreDriver; | ||
use HasFactory; | ||
|
||
protected $guarded = []; | ||
|
||
protected $casts = [ | ||
'driver' => Driver::class, | ||
]; | ||
} |
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,22 @@ | ||
<?php | ||
|
||
use Envor\Datastore\Tests\Fixtures\Datastore; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
it('will configure the datastore', function () { | ||
$datastore = Datastore::factory()->create(); | ||
|
||
$datastore->configure(); | ||
|
||
expect(config('database.default'))->toBe($datastore->database()->name); | ||
|
||
expect(config("database.connections.{$datastore->database()->name}"))->toBe($datastore->database()->config); | ||
Check failure on line 13 in tests/HasDatastoreDriverTest.php
|
||
}); | ||
|
||
it('will create and migrate the datastore', function () { | ||
$datastore = Datastore::factory()->create(); | ||
|
||
$datastore->migrate(); | ||
|
||
expect(Schema::connection($datastore->database()->name)->hasTable('migrations'))->toBeTrue(); | ||
}); |
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