-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix remove useless fields from nova resources (#96)
* Fix remove useless fields from nova resources * Refactoring a delete method
- Loading branch information
Showing
3 changed files
with
47 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace Cable8mm\Xeed\Tests\Unit\Generators; | ||
|
||
use Cable8mm\Xeed\Column; | ||
use Cable8mm\Xeed\Generators\NovaResourceGenerator; | ||
use Cable8mm\Xeed\Support\File; | ||
use Cable8mm\Xeed\Support\Path; | ||
use Cable8mm\Xeed\Table; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class NovaResourceGeneratorTest extends TestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
NovaResourceGenerator::make( | ||
new Table('samples', [ | ||
Column::make('id', 'bigint'), | ||
Column::make('created_at', 'timestamp'), | ||
Column::make('updated_at', 'timestamp'), | ||
]), | ||
destination: Path::testgen() | ||
)->run(); | ||
} | ||
|
||
protected function tearDown(): void | ||
{ | ||
File::system()->delete(Path::testgen().DIRECTORY_SEPARATOR.'Sample.php'); | ||
} | ||
|
||
public function test_it_can_be_existed(): void | ||
{ | ||
$this->assertFileExists(Path::testgen().DIRECTORY_SEPARATOR.'Sample.php'); | ||
} | ||
|
||
public function test_it_can_be_without_timestamps(): void | ||
{ | ||
$file = File::system()->read(Path::testgen().DIRECTORY_SEPARATOR.'Sample.php'); | ||
|
||
$this->assertStringNotContainsString('Created At', $file); | ||
$this->assertStringNotContainsString('Updated At', $file); | ||
} | ||
} |