diff --git a/src/Database/Schema/Blueprint.php b/src/Database/Schema/Blueprint.php index e8e98cb..7114495 100644 --- a/src/Database/Schema/Blueprint.php +++ b/src/Database/Schema/Blueprint.php @@ -431,9 +431,7 @@ public function routingRequired(): void */ public function string($column, $length = null): PropertyDefinition { - $length = $length ?: Builder::$defaultStringLength; - - return $this->text('string', $column, compact('length')); + return $this->text($column); } /** diff --git a/tests/Unit/Database/Schema/BlueprintTest.php b/tests/Unit/Database/Schema/BlueprintTest.php index 1483a9f..4c79c9d 100644 --- a/tests/Unit/Database/Schema/BlueprintTest.php +++ b/tests/Unit/Database/Schema/BlueprintTest.php @@ -130,6 +130,8 @@ public function it_performs_token_count() $name = 'name'; $expected = compact('type', 'name'); + $this->blueprint->tokenCount($expected['name']); + $this->assertColumn($expected); } @@ -142,6 +144,8 @@ public function it_adds_text() $name = 'name'; $expected = compact('type', 'name'); + $this->blueprint->text($name); + $this->assertColumn($expected); } @@ -150,10 +154,12 @@ public function it_adds_text() */ public function it_adds_string() { - $type = 'string'; + $type = 'text'; $name = 'name'; $expected = compact('type', 'name'); + $this->blueprint->string($expected['name']); + $this->assertColumn($expected); } @@ -177,6 +183,8 @@ public function it_adds_a_range() $name = 'name'; $expected = compact('type', 'name'); + $this->blueprint->range($expected['type'], $expected['name']); + $this->assertColumn($expected); } @@ -191,10 +199,7 @@ public function it_adds_a_integer_range() $this->blueprint->integerRange($expected['name']); - $columns = $this->blueprint->getColumns(); - $attr = $columns[0]->getAttributes(); - - $this->assertEquals($expected, $attr); + $this->assertColumn($expected); } /** @@ -206,13 +211,13 @@ public function it_adds_a_integer() $name = 'name'; $expected = compact('type', 'name'); + $this->blueprint->integer($name); + $this->assertColumn($expected); } public function assertColumn($expected) { - $this->blueprint->addColumn($expected['type'], $expected['name']); - $columns = $this->blueprint->getColumns(); $attr = $columns[0]->getAttributes(); @@ -227,7 +232,7 @@ public function it_adds_a_column() $type = 'string'; $name = 'name'; $expected = compact('type', 'name'); - + $this->blueprint->addColumn($type, $name); $this->assertColumn($expected); }