-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(specs): marking property as nullable
Merge pull request #273 from AlexTheBest/bugfix/specs-nullable
- Loading branch information
Showing
2 changed files
with
45 additions
and
1 deletion.
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,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Orion\Tests\Unit\Specs\Builders; | ||
|
||
use Orion\Specs\Builders\PathsBuilder; | ||
use Orion\Specs\Builders\PropertyBuilder; | ||
use Orion\Tests\Unit\TestCase; | ||
use Orion\ValueObjects\Specs\Schema\SchemaProperty; | ||
|
||
class PropertyBuilderTest extends TestCase | ||
{ | ||
/** | ||
* @var PathsBuilder | ||
*/ | ||
protected $pathsBuilder; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->pathsBuilder = app()->make(PathsBuilder::class); | ||
} | ||
|
||
/** @test */ | ||
public function building_property(): void | ||
{ | ||
$column = [ | ||
'name' => 'example_column', | ||
'nullable' => true, | ||
]; | ||
$concretePropertyClass = 'Orion\ValueObjects\Specs\Schema\SchemaProperty'; | ||
|
||
$propertyBuilder = new PropertyBuilder(); | ||
$property = $propertyBuilder->build($column, $concretePropertyClass); | ||
|
||
$this->assertInstanceOf(SchemaProperty::class, $property); | ||
$this->assertEquals($column['name'], $property->name); | ||
$this->assertEquals($column['nullable'], $property->nullable); | ||
} | ||
} | ||
|
||
|