Skip to content

Commit 23f1b9a

Browse files
authored
[OC-46944]Fix signatures methods of ConnectionMock. (#18)
* chore(lib): fix signatures methods of ConnectionMock.
1 parent 023f3ae commit 23f1b9a

File tree

3 files changed

+72
-6
lines changed

3 files changed

+72
-6
lines changed

Tests/DependencyInjection/Fixtures/Util/ConnectionMock.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,17 @@ public function isTransactionActive()
7373
/**
7474
* {@inheritDoc}
7575
*/
76-
public function prepare($sql)
76+
public function prepare($sql): StatementSpy
7777
{
78-
return null;
78+
return new StatementSpy();
7979
}
8080

8181
/**
8282
* {@inheritDoc}
8383
*/
84-
public function query()
84+
public function query(string $sql): ResultSpy
8585
{
86-
return null;
86+
return new ResultSpy();
8787
}
8888

8989
/**
@@ -97,9 +97,9 @@ public function quote($value, $type = ParameterType::STRING)
9797
/**
9898
* {@inheritDoc}
9999
*/
100-
public function exec($sql)
100+
public function exec($sql): int
101101
{
102-
return null;
102+
return 1;
103103
}
104104

105105
/**
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace OpenClassrooms\Bundle\UseCaseBundle\Tests\DependencyInjection\Fixtures\Util;
4+
5+
use Doctrine\DBAL\Driver\Result;
6+
7+
class ResultSpy implements Result
8+
{
9+
public function fetchNumeric()
10+
{
11+
}
12+
13+
public function fetchAssociative()
14+
{
15+
}
16+
17+
public function fetchOne()
18+
{
19+
}
20+
21+
public function fetchAllNumeric(): array
22+
{
23+
}
24+
25+
public function fetchAllAssociative(): array
26+
{
27+
}
28+
29+
public function fetchFirstColumn(): array
30+
{
31+
}
32+
33+
public function rowCount(): int
34+
{
35+
}
36+
37+
public function columnCount(): int
38+
{
39+
}
40+
41+
public function free(): void
42+
{
43+
}
44+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace OpenClassrooms\Bundle\UseCaseBundle\Tests\DependencyInjection\Fixtures\Util;
4+
5+
use Doctrine\DBAL\Driver\Result;
6+
use Doctrine\DBAL\Driver\Statement;
7+
use Doctrine\DBAL\ParameterType;
8+
9+
class StatementSpy implements Statement
10+
{
11+
public function bindValue($param, $value, $type = ParameterType::STRING)
12+
{
13+
}
14+
15+
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null)
16+
{
17+
}
18+
19+
public function execute($params = null): Result
20+
{
21+
}
22+
}

0 commit comments

Comments
 (0)