From d51e918054f5d50b72b2274657d6da517e00fd21 Mon Sep 17 00:00:00 2001 From: Andy Truong Date: Thu, 5 Apr 2018 09:32:02 +0700 Subject: [PATCH] Don't skip column options. --- lib/Doctrine/DBAL/Schema/Column.php | 2 +- tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/DBAL/Schema/Column.php b/lib/Doctrine/DBAL/Schema/Column.php index 7534a33035c..eead5e6aa82 100644 --- a/lib/Doctrine/DBAL/Schema/Column.php +++ b/lib/Doctrine/DBAL/Schema/Column.php @@ -132,7 +132,7 @@ public function setOptions(array $options) $name ), E_USER_DEPRECATED); - return $this; + continue; } $this->$method($value); } diff --git a/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php b/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php index f15e0208050..c78595442fa 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php @@ -65,6 +65,19 @@ public function testSettingUnknownOptionIsStillSupported() : void new Column('foo', $this->createMock(Type::class), ['unknown_option' => 'bar']); } + /** + * @group legacy + * @expectedDeprecation The "unknown_option" column option is not supported, setting it is deprecated and will cause an error in Doctrine 3.0 + */ + public function testOptionsShouldNotBeIgnored() : void + { + $col1 = new Column('bar', Type::getType(Type::INTEGER), ['unknown_option' => 'bar', 'notnull' => true]); + self::assertTrue($col1->getNotnull()); + + $col2 = new Column('bar', Type::getType(Type::INTEGER), ['unknown_option' => 'bar', 'notnull' => false]); + self::assertFalse($col2->getNotnull()); + } + /** * @return Column */