Skip to content

Commit 1c0aa6e

Browse files
GrahamCampbelltaylorotwell
authored andcommitted
Fix type errors in db tests (#38696)
* Fix type errors in db tests * Apply fixes from StyleCI Co-authored-by: Taylor Otwell <taylorotwell@users.noreply.github.com>
1 parent e0a0e69 commit 1c0aa6e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/Database/DatabaseConnectionTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,22 @@ public function testUpdateCallsTheAffectingStatementMethod()
9999
public function testDeleteCallsTheAffectingStatementMethod()
100100
{
101101
$connection = $this->getMockConnection(['affectingStatement']);
102-
$connection->expects($this->once())->method('affectingStatement')->with($this->equalTo('foo'), $this->equalTo(['bar']))->willReturn('baz');
102+
$connection->expects($this->once())->method('affectingStatement')->with($this->equalTo('foo'), $this->equalTo(['bar']))->willReturn(true);
103103
$results = $connection->delete('foo', ['bar']);
104-
$this->assertSame('baz', $results);
104+
$this->assertTrue($results);
105105
}
106106

107107
public function testStatementProperlyCallsPDO()
108108
{
109109
$pdo = $this->getMockBuilder(DatabaseConnectionTestMockPDO::class)->onlyMethods(['prepare'])->getMock();
110110
$statement = $this->getMockBuilder('PDOStatement')->onlyMethods(['execute', 'bindValue'])->getMock();
111111
$statement->expects($this->once())->method('bindValue')->with(1, 'bar', 2);
112-
$statement->expects($this->once())->method('execute')->willReturn('foo');
112+
$statement->expects($this->once())->method('execute')->willReturn(true);
113113
$pdo->expects($this->once())->method('prepare')->with($this->equalTo('foo'))->willReturn($statement);
114114
$mock = $this->getMockConnection(['prepareBindings'], $pdo);
115115
$mock->expects($this->once())->method('prepareBindings')->with($this->equalTo(['bar']))->willReturn(['bar']);
116116
$results = $mock->statement('foo', ['bar']);
117-
$this->assertSame('foo', $results);
117+
$this->assertTrue($results);
118118
$log = $mock->getQueryLog();
119119
$this->assertSame('foo', $log[0]['query']);
120120
$this->assertEquals(['bar'], $log[0]['bindings']);
@@ -127,12 +127,12 @@ public function testAffectingStatementProperlyCallsPDO()
127127
$statement = $this->getMockBuilder('PDOStatement')->onlyMethods(['execute', 'rowCount', 'bindValue'])->getMock();
128128
$statement->expects($this->once())->method('bindValue')->with('foo', 'bar', 2);
129129
$statement->expects($this->once())->method('execute');
130-
$statement->expects($this->once())->method('rowCount')->willReturn(['boom']);
130+
$statement->expects($this->once())->method('rowCount')->willReturn(42);
131131
$pdo->expects($this->once())->method('prepare')->with('foo')->willReturn($statement);
132132
$mock = $this->getMockConnection(['prepareBindings'], $pdo);
133133
$mock->expects($this->once())->method('prepareBindings')->with($this->equalTo(['foo' => 'bar']))->willReturn(['foo' => 'bar']);
134134
$results = $mock->update('foo', ['foo' => 'bar']);
135-
$this->assertEquals(['boom'], $results);
135+
$this->assertSame(42, $results);
136136
$log = $mock->getQueryLog();
137137
$this->assertSame('foo', $log[0]['query']);
138138
$this->assertEquals(['foo' => 'bar'], $log[0]['bindings']);

0 commit comments

Comments
 (0)