From 475c138cf736c40af1f7dd24e2212ec7af9615e2 Mon Sep 17 00:00:00 2001 From: Alymosul Date: Tue, 13 Mar 2018 20:19:20 +0200 Subject: [PATCH] Fixes and revert to the old testcase --- src/Illuminate/Validation/Rules/Unique.php | 4 ++-- tests/Support/framework/testing/disks/testing/letter.txt | 1 - tests/Validation/ValidationUniqueRuleTest.php | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) delete mode 100644 tests/Support/framework/testing/disks/testing/letter.txt diff --git a/src/Illuminate/Validation/Rules/Unique.php b/src/Illuminate/Validation/Rules/Unique.php index ab6be2b49c2b..20ba641a4bd1 100644 --- a/src/Illuminate/Validation/Rules/Unique.php +++ b/src/Illuminate/Validation/Rules/Unique.php @@ -20,7 +20,7 @@ class Unique * * @var string */ - protected $idColumn; + protected $idColumn = 'id'; /** * Ignore the given ID during the unique check. @@ -67,7 +67,7 @@ public function __toString() $this->table, $this->column, $this->ignore ? '"'.$this->ignore.'"' : 'NULL', - $this->idColumn ?? 'NULL', + $this->idColumn, $this->formatWheres() ), ','); } diff --git a/tests/Support/framework/testing/disks/testing/letter.txt b/tests/Support/framework/testing/disks/testing/letter.txt deleted file mode 100644 index 32f95c0d1244..000000000000 --- a/tests/Support/framework/testing/disks/testing/letter.txt +++ /dev/null @@ -1 +0,0 @@ -hi \ No newline at end of file diff --git a/tests/Validation/ValidationUniqueRuleTest.php b/tests/Validation/ValidationUniqueRuleTest.php index c1426d2febc2..0b7d403fe649 100644 --- a/tests/Validation/ValidationUniqueRuleTest.php +++ b/tests/Validation/ValidationUniqueRuleTest.php @@ -11,7 +11,7 @@ public function testItCorrectlyFormatsAStringVersionOfTheRule() { $rule = new \Illuminate\Validation\Rules\Unique('table'); $rule->where('foo', 'bar'); - $this->assertEquals('unique:table,NULL,NULL,NULL,foo,bar', (string) $rule); + $this->assertEquals('unique:table,NULL,NULL,id,foo,bar', (string) $rule); $rule = new \Illuminate\Validation\Rules\Unique('table', 'column'); $rule->ignore('Taylor, Otwell', 'id_column');