Skip to content

Commit 328bd24

Browse files
authored
Merge pull request #46 from simon-mundy/result-count-issue
Fixed tests in Unit and Integration
2 parents cfcf2e3 + 8ff2157 commit 328bd24

13 files changed

Lines changed: 212 additions & 235 deletions

composer.lock

Lines changed: 46 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan-baseline.neon

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,6 @@ parameters:
3030
count: 1
3131
path: src/Connection.php
3232

33-
-
34-
message: '#^PHPDoc tag @var for variable \$connectionInstance contains unknown class PhpDb\\Mysql\\Driver\\ConnectionInterface\.$#'
35-
identifier: class.notFound
36-
count: 1
37-
path: src/Container/DriverInterfaceFactory.php
38-
39-
-
40-
message: '#^PHPDoc tag @var for variable \$resultInstance contains unknown class PhpDb\\Mysql\\Driver\\ResultInterface\.$#'
41-
identifier: class.notFound
42-
count: 1
43-
path: src/Container/DriverInterfaceFactory.php
44-
45-
-
46-
message: '#^PHPDoc tag @var for variable \$statementInstance contains unknown class PhpDb\\Mysql\\Driver\\StatementInterface\.$#'
47-
identifier: class.notFound
48-
count: 1
49-
path: src/Container/DriverInterfaceFactory.php
50-
5133
-
5234
message: '#^Instanceof between PhpDb\\Mysql\\Connection and PhpDb\\Adapter\\Driver\\DriverAwareInterface will always evaluate to true\.$#'
5335
identifier: instanceof.alwaysTrue
@@ -186,42 +168,6 @@ parameters:
186168
count: 1
187169
path: src/Statement.php
188170

189-
-
190-
message: '#^Call to an undefined method PhpDb\\Mysql\\Driver\:\:quoteValue\(\)\.$#'
191-
identifier: method.notFound
192-
count: 2
193-
path: test/integration/AdapterPlatformTest.php
194-
195-
-
196-
message: '#^Parameter \#1 \$connection of class PhpDb\\Mysql\\Driver constructor expects PhpDb\\Mysql\\Connection, PDO given\.$#'
197-
identifier: argument.type
198-
count: 1
199-
path: test/integration/AdapterPlatformTest.php
200-
201-
-
202-
message: '#^Parameter \#1 \$connection of class PhpDb\\Mysql\\Driver constructor expects PhpDb\\Mysql\\Connection, mysqli given\.$#'
203-
identifier: argument.type
204-
count: 1
205-
path: test/integration/AdapterPlatformTest.php
206-
207-
-
208-
message: '#^Parameter \#2 \$statementPrototype of class PhpDb\\Mysql\\Driver constructor expects PhpDb\\Mysql\\Statement, PhpDb\\Adapter\\Driver\\Pdo\\Statement given\.$#'
209-
identifier: argument.type
210-
count: 1
211-
path: test/integration/AdapterPlatformTest.php
212-
213-
-
214-
message: '#^Property PhpDbIntegrationTest\\Mysql\\Platform\\AdapterPlatformTest\:\:\$adapters \(array\<string, mysqli\|PDO\>\) does not accept array\<string, mysqli\|PDO\|PhpDb\\Mysql\\Connection\>\.$#'
215-
identifier: assign.propertyType
216-
count: 1
217-
path: test/integration/AdapterPlatformTest.php
218-
219-
-
220-
message: '#^Property PhpDbIntegrationTest\\Mysql\\Platform\\AdapterPlatformTest\:\:\$adapters \(array\<string, mysqli\|PDO\>\) does not accept array\<string, mysqli\|PDO\|PhpDb\\Mysql\\Pdo\\Connection\>\.$#'
221-
identifier: assign.propertyType
222-
count: 1
223-
path: test/integration/AdapterPlatformTest.php
224-
225171
-
226172
message: '#^Parameter \#1 \$container of callable PhpDb\\Mysql\\Container\\DriverInterfaceFactory expects Laminas\\ServiceManager\\ServiceManager, Psr\\Container\\ContainerInterface given\.$#'
227173
identifier: argument.type
@@ -240,21 +186,3 @@ parameters:
240186
count: 1
241187
path: test/integration/Pdo/ConnectionTest.php
242188

243-
-
244-
message: '#^Unreachable statement \- code above always terminates\.$#'
245-
identifier: deadCode.unreachable
246-
count: 1
247-
path: test/integration/Pdo/QueryTest.php
248-
249-
-
250-
message: '#^Unreachable statement \- code above always terminates\.$#'
251-
identifier: deadCode.unreachable
252-
count: 1
253-
path: test/integration/Pdo/TableGatewayTest.php
254-
255-
-
256-
message: '#^Unreachable statement \- code above always terminates\.$#'
257-
identifier: deadCode.unreachable
258-
count: 1
259-
path: test/integration/TableGatewayTest.php
260-

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@
3434
<env name="TESTS_PHPDB_ADAPTER_MYSQL_DATABASE" value="phpdb_test"/>
3535
<env name="TESTS_PHPDB_ADAPTER_MYSQL_PORT" value="3306"/>
3636
</php>
37-
</phpunit>
37+
</phpunit>

src/Container/DriverInterfaceFactory.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
namespace PhpDb\Mysql\Container;
66

77
use Laminas\ServiceManager\ServiceManager;
8+
use PhpDb\Adapter\Driver\ConnectionInterface;
89
use PhpDb\Adapter\Driver\DriverInterface;
910
use PhpDb\Adapter\Driver\ResultInterface;
11+
use PhpDb\Adapter\Driver\StatementInterface;
1012
use PhpDb\Exception\ContainerException;
1113
use PhpDb\Mysql\Connection;
1214
use PhpDb\Mysql\Driver;
@@ -29,16 +31,16 @@ public function __invoke(
2931
);
3032
}
3133

32-
/** @var Driver\ConnectionInterface&Connection $connectionInstance */
34+
/** @var ConnectionInterface&Connection $connectionInstance */
3335
$connectionInstance = $container->build(Connection::class, $options);
3436

35-
/** @var Driver\StatementInterface&Statement $statementInstance */
37+
/** @var StatementInterface&Statement $statementInstance */
3638
$statementInstance = $container->build(
3739
Statement::class,
3840
$options['options'] ?? []
3941
);
4042

41-
/** @var Driver\ResultInterface&Result $resultInstance */
43+
/** @var ResultInterface&Result $resultInstance */
4244
$resultInstance = $container->has(ResultInterface::class)
4345
? $container->get(ResultInterface::class)
4446
: new Result();

src/Pdo/Driver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function createResult($resource): ResultInterface
2424
/** @var ResultInterface&Result $result */
2525
$result = clone $this->resultPrototype;
2626

27-
$rowCount = 0;
27+
$rowCount = null;
2828

2929
$lastGeneratedValue = $this->getLastGeneratedValue();
3030

0 commit comments

Comments
 (0)