Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change some implementations and update documentation
- Loading branch information
1 parent
c22dcc9
commit ad1ed40
Showing
5 changed files
with
95 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Tightenco\Parental\Tests\Features; | ||
|
||
use Tightenco\Parental\Tests\Models\Car; | ||
use Tightenco\Parental\Tests\Models\Plane; | ||
use Tightenco\Parental\Tests\Models\Vehicle; | ||
use Tightenco\Parental\Tests\TestCase; | ||
|
||
class TypeColumnCanBeAliased extends TestCase | ||
{ | ||
/** @test */ | ||
function type_column_values_can_accept_type_aliases() | ||
{ | ||
Car::create(['type' => 'car']); | ||
Plane::create(['type' => Plane::class]); | ||
|
||
$vehicles = Vehicle::all(); | ||
|
||
$this->assertInstanceOf(Car::class, $vehicles[0]); | ||
$this->assertInstanceOf(Plane::class, $vehicles[1]); | ||
} | ||
|
||
/** @test */ | ||
function type_aliases_are_set_on_creation() | ||
{ | ||
$car = Car::create(); | ||
|
||
$this->assertEquals('car', $car->fresh()->type); | ||
} | ||
} |
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