forked from lamtranb/laravel-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SchemaParserTest.php
47 lines (36 loc) · 1.13 KB
/
SchemaParserTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespace Nwidart\Modules\Tests;
use Nwidart\Modules\Support\Migrations\SchemaParser;
class SchemaParserTest extends \PHPUnit\Framework\TestCase
{
/** @test */
public function it_generates_migration_method_calls()
{
$parser = new SchemaParser('username:string, password:integer');
$expected = <<<TEXT
\t\t\t\$table->string('username');
\t\t\t\$table->integer('password');\n
TEXT;
self::assertEquals($expected, $parser->render());
}
/** @test */
public function it_generates_migration_methods_for_up_method()
{
$parser = new SchemaParser('username:string, password:integer');
$expected = <<<TEXT
\t\t\t\$table->string('username');
\t\t\t\$table->integer('password');\n
TEXT;
self::assertEquals($expected, $parser->up());
}
/** @test */
public function it_generates_migration_methods_for_down_method()
{
$parser = new SchemaParser('username:string, password:integer');
$expected = <<<TEXT
\t\t\t\$table->dropColumn('username');
\t\t\t\$table->dropColumn('password');\n
TEXT;
self::assertEquals($expected, $parser->down());
}
}