Skip to content

Commit a9d43e0

Browse files
authored
Merge pull request #117 from samsonasik/clean-up-autoload-hack
Clean up autoload hack on test
2 parents 61c0a19 + c314b08 commit a9d43e0

3 files changed

Lines changed: 21 additions & 6 deletions

File tree

kahlan-config.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
<?php
22

3-
use Laminas\ServiceManager\AbstractPluginManager;
43
use Kahlan\Filter\Filters;
54
use Kahlan\Reporter\Coverage;
65
use Kahlan\Reporter\Coverage\Driver\Xdebug;
76

8-
// autoload hack
9-
class_alias(AbstractPluginManager::class, Zend\ServiceManager\AbstractPluginManager::class);
10-
117
Filters::apply($this, 'coverage', function($next): void {
128
if (! extension_loaded('xdebug')) {
139
return;

spec/ModuleSpec.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,21 @@
130130
$driver = Double::instance(['extends' => Driver::class, 'methods' => '__construct']);
131131
allow($driver)->toReceive('getName')->andReturn('pdo_mysql');
132132

133-
allow($connection)->toReceive('getParams')->andReturn([]);
133+
$pdoMysqlInitCommandAttr = defined(Mysql::class . '::ATTR_INIT_COMMAND')
134+
? Mysql::ATTR_INIT_COMMAND
135+
: PDO::MYSQL_ATTR_INIT_COMMAND;
136+
137+
allow($connection)->toReceive('getParams')->andReturn([
138+
'user' => 'mysqluser',
139+
'password' => 'mysqlpassword',
140+
'dbname' => 'mysqldbname',
141+
'host' => 'mysqlhost',
142+
'port' => '3306',
143+
'driverOptions' => [
144+
$pdoMysqlInitCommandAttr => "SET NAMES 'UTF8'",
145+
],
146+
'driverClass' => Driver::class,
147+
]);
134148
allow($connection)->toReceive('getUsername')->andReturn('root');
135149
allow($connection)->toReceive('getPassword')->andReturn('');
136150
allow($connection)->toReceive('getDriver')->andReturn($driver);
@@ -165,9 +179,15 @@
165179
: PDO::MYSQL_ATTR_INIT_COMMAND;
166180

167181
allow($connection)->toReceive('getParams')->andReturn([
182+
'user' => 'mysqluser',
183+
'password' => 'mysqlpassword',
184+
'dbname' => 'mysqldbname',
185+
'host' => 'mysqlhost',
186+
'port' => '3306',
168187
'driverOptions' => [
169188
$pdoMysqlInitCommandAttr => "SET NAMES 'UTF8'",
170189
],
190+
'driverClass' => Driver::class,
171191
]);
172192
allow($connection)->toReceive('getUsername')->andReturn('root');
173193
allow($connection)->toReceive('getPassword')->andReturn('');

src/Handler/Writer/Mail.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ public function shutdown(): void
7777
try {
7878
$this->transport->send($this->mail);
7979
} catch (Exception $exception) {
80-
/** @var string $message */
8180
$message = $exception->getMessage();
8281
/** @var int $code */
8382
$code = $exception->getCode();

0 commit comments

Comments
 (0)