Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 1bf29dd

Browse files
committed
Update mocking in tests
1 parent b3e72f5 commit 1bf29dd

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

test/unit/TableGateway/Feature/SequenceFeatureTest.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ public function testPreInsertWillReturnLastInsertValueIfPrimaryKeySetInColumnsDa
102102
$platform->expects($this->any())
103103
->method('quoteIdentifier')
104104
->will($this->returnValue($this->sequenceName));
105-
$adapter = $this->getMock('Zend\Db\Adapter\Adapter', ['getPlatform', 'createStatement'], [], '', false);
105+
$adapter = $this->getMockBuilder('Zend\Db\Adapter\Adapter')
106+
->setMethods(['getPlatform', 'createStatement'])
107+
->disableOriginalConstructor()
108+
->getMock();
106109
$adapter->expects($this->any())
107110
->method('getPlatform')
108111
->will($this->returnValue($platform));
@@ -123,7 +126,10 @@ public function testPreInsertWillReturnLastInsertValueIfPrimaryKeySetInColumnsDa
123126
->will($this->returnValue($statement));
124127
$this->tableGateway = $this->getMockForAbstractClass('Zend\Db\TableGateway\TableGateway', ['table', $adapter], '', true);
125128
$this->feature->setTableGateway($this->tableGateway);
126-
$insert = $this->getMock('Zend\Db\Sql\Insert', ['getPlatform', 'createStatement', 'getRawState'], [], '', false);
129+
$insert = $this->getMockBuilder('Zend\Db\Sql\Insert')
130+
->setMethods(['getPlatform', 'createStatement', 'getRawState'])
131+
->disableOriginalConstructor()
132+
->getMock();
127133
$insert->expects($this->at(0))
128134
->method('getRawState')
129135
->with('columns')
@@ -135,13 +141,17 @@ public function testPreInsertWillReturnLastInsertValueIfPrimaryKeySetInColumnsDa
135141

136142
public function nextSequenceIdProvider()
137143
{
138-
return [['PostgreSQL', 'SELECT NEXTVAL(\'"' . $this->sequenceName . '"\')'],
139-
['Oracle', 'SELECT ' . $this->sequenceName . '.NEXTVAL as "nextval" FROM dual']];
144+
return [
145+
['PostgreSQL', 'SELECT NEXTVAL(\'"' . $this->sequenceName . '"\')'],
146+
['Oracle', 'SELECT ' . $this->sequenceName . '.NEXTVAL as "nextval" FROM dual'],
147+
];
140148
}
141149

142150
public function lastSequenceIdProvider()
143151
{
144-
return [['PostgreSQL', 'SELECT CURRVAL(\'' . $this->sequenceName . '\')'],
145-
['Oracle', 'SELECT ' . $this->sequenceName . '.CURRVAL as "currval" FROM dual']];
152+
return [
153+
['PostgreSQL', 'SELECT CURRVAL(\'' . $this->sequenceName . '\')'],
154+
['Oracle', 'SELECT ' . $this->sequenceName . '.CURRVAL as "currval" FROM dual'],
155+
];
146156
}
147157
}

0 commit comments

Comments
 (0)