|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Doctrine\DBAL\Tests\Events; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\DBAL\Connection; |
|
8
|
|
|
use Doctrine\DBAL\Event\ConnectionEventArgs; |
|
9
|
|
|
use Doctrine\DBAL\Event\Listeners\OracleSessionInit; |
|
|
|
|
|
|
10
|
|
|
use Doctrine\DBAL\Events; |
|
11
|
|
|
use PHPUnit\Framework\TestCase; |
|
12
|
|
|
use function sprintf; |
|
13
|
|
|
|
|
14
|
|
|
class OracleSessionInitTest extends TestCase |
|
15
|
|
|
{ |
|
16
|
|
|
public function testPostConnect() : void |
|
17
|
|
|
{ |
|
18
|
|
|
$connectionMock = $this->createMock(Connection::class); |
|
19
|
|
|
$connectionMock->expects($this->once()) |
|
20
|
|
|
->method('executeUpdate') |
|
21
|
|
|
->with($this->isType('string')); |
|
22
|
|
|
|
|
23
|
|
|
$eventArgs = new ConnectionEventArgs($connectionMock); |
|
24
|
|
|
|
|
25
|
|
|
$listener = new OracleSessionInit(); |
|
26
|
|
|
$listener->postConnect($eventArgs); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @group DBAL-1824 |
|
31
|
|
|
* @dataProvider getPostConnectWithSessionParameterValuesData |
|
32
|
|
|
*/ |
|
33
|
|
|
public function testPostConnectQuotesSessionParameterValues(string $name, string $value) : void |
|
34
|
|
|
{ |
|
35
|
|
|
$connectionMock = $this->getMockBuilder(Connection::class) |
|
36
|
|
|
->disableOriginalConstructor() |
|
37
|
|
|
->getMock(); |
|
38
|
|
|
$connectionMock->expects($this->once()) |
|
39
|
|
|
->method('executeUpdate') |
|
40
|
|
|
->with($this->stringContains(sprintf('%s = %s', $name, $value))); |
|
41
|
|
|
|
|
42
|
|
|
$eventArgs = new ConnectionEventArgs($connectionMock); |
|
43
|
|
|
|
|
44
|
|
|
$listener = new OracleSessionInit([$name => $value]); |
|
45
|
|
|
$listener->postConnect($eventArgs); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @return array<int, array<int, mixed>> |
|
50
|
|
|
*/ |
|
51
|
|
|
public static function getPostConnectWithSessionParameterValuesData() : iterable |
|
52
|
|
|
{ |
|
53
|
|
|
return [ |
|
54
|
|
|
['CURRENT_SCHEMA', 'foo'], |
|
55
|
|
|
]; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function testGetSubscribedEvents() : void |
|
59
|
|
|
{ |
|
60
|
|
|
$listener = new OracleSessionInit(); |
|
61
|
|
|
self::assertEquals([Events::postConnect], $listener->getSubscribedEvents()); |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths