Skip to content

Commit

Permalink
Adding on duplicate update test for insert statements (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwhat authored Nov 6, 2021
1 parent 4c30b85 commit 958fa8c
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tests/Statement/InsertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function testToStringWithIgnore()
$this->assertStringStartsWith('INSERT IGNORE INTO test', $this->subject->__toString());
}

public function testToStringWithQuery()
public function testToStringWithRaw()
{
$this->subject
->into('test')
Expand All @@ -190,6 +190,20 @@ public function testToStringWithQuery()
$this->assertStringStartsWith('INSERT INTO test (one) VALUES (1)', $this->subject->__toString());
}

public function testToStringWithOnDuplicateUpdate()
{
$this->subject
->into('test')
->columns('one')
->values(1)
->onDuplicateUpdate(['one' => 2]);

$this->assertStringStartsWith(
'INSERT INTO test (one) VALUES (?) ON DUPLICATE KEY UPDATE one = ?',
$this->subject->__toString()
);
}

public function testGetValues()
{
$this->subject
Expand Down Expand Up @@ -227,7 +241,7 @@ public function testGetValuesWithQuery()
$this->assertCount(0, $this->subject->getValues());
}

public function testGetValuesWithDuplicate()
public function testGetValuesWithOnDuplicateUpdate()
{
$this->subject
->columns('one')
Expand Down

0 comments on commit 958fa8c

Please sign in to comment.