@@ -1683,6 +1683,20 @@ public function testUpdateWithTimestampValue()
1683
1683
$ this ->assertEquals (1 , $ result );
1684
1684
}
1685
1685
1686
+ public function testUpdateWithQualifiedTimestampValue ()
1687
+ {
1688
+ $ query = new BaseBuilder (m::mock (ConnectionInterface::class), new Grammar , m::mock (Processor::class));
1689
+ $ builder = new Builder ($ query );
1690
+ $ model = new EloquentBuilderTestStub ;
1691
+ $ this ->mockConnectionForModel ($ model , '' );
1692
+ $ builder ->setModel ($ model );
1693
+ $ builder ->getConnection ()->shouldReceive ('update ' )->once ()
1694
+ ->with ('update "table" set "table"."foo" = ?, "table"."updated_at" = ? ' , ['bar ' , null ])->andReturn (1 );
1695
+
1696
+ $ result = $ builder ->update (['table.foo ' => 'bar ' , 'table.updated_at ' => null ]);
1697
+ $ this ->assertEquals (1 , $ result );
1698
+ }
1699
+
1686
1700
public function testUpdateWithoutTimestamp ()
1687
1701
{
1688
1702
$ query = new BaseBuilder (m::mock (ConnectionInterface::class), new Grammar , m::mock (Processor::class));
@@ -1715,6 +1729,24 @@ public function testUpdateWithAlias()
1715
1729
Carbon::setTestNow (null );
1716
1730
}
1717
1731
1732
+ public function testUpdateWithAliasWithQualifiedTimestampValue ()
1733
+ {
1734
+ Carbon::setTestNow ($ now = '2017-10-10 10:10:10 ' );
1735
+
1736
+ $ query = new BaseBuilder (m::mock (ConnectionInterface::class), new Grammar , m::mock (Processor::class));
1737
+ $ builder = new Builder ($ query );
1738
+ $ model = new EloquentBuilderTestStub ;
1739
+ $ this ->mockConnectionForModel ($ model , '' );
1740
+ $ builder ->setModel ($ model );
1741
+ $ builder ->getConnection ()->shouldReceive ('update ' )->once ()
1742
+ ->with ('update "table" as "alias" set "foo" = ?, "alias"."updated_at" = ? ' , ['bar ' , null ])->andReturn (1 );
1743
+
1744
+ $ result = $ builder ->from ('table as alias ' )->update (['foo ' => 'bar ' , 'alias.updated_at ' => null ]);
1745
+ $ this ->assertEquals (1 , $ result );
1746
+
1747
+ Carbon::setTestNow (null );
1748
+ }
1749
+
1718
1750
public function testUpsert ()
1719
1751
{
1720
1752
Carbon::setTestNow ($ now = '2017-10-10 10:10:10 ' );
0 commit comments