Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 95973d3

Browse files
committed
fix tests.
1 parent 6c3ec76 commit 95973d3

File tree

2 files changed

+27
-36
lines changed

2 files changed

+27
-36
lines changed

pkg/dbal/Tests/DbalConnectionFactoryConfigTest.php

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,64 +47,83 @@ public function testShouldParseConfigurationAsExpected($config, $expectedConfig)
4747
{
4848
$factory = new DbalConnectionFactory($config);
4949

50-
$this->assertAttributeEquals($expectedConfig, 'config', $factory);
50+
$actualConfig = $this->readAttribute($factory, 'config');
51+
$this->assertSame($expectedConfig, $actualConfig);
5152
}
5253

5354
public static function provideConfigs()
5455
{
5556
yield [
5657
null,
5758
[
58-
'lazy' => true,
5959
'connection' => [
6060
'url' => 'mysql://root@localhost',
6161
],
62+
'table_name' => 'enqueue',
63+
'polling_interval' => 1000,
64+
'lazy' => true,
6265
],
6366
];
6467

6568
yield [
6669
'mysql:',
6770
[
68-
'lazy' => true,
6971
'connection' => [
7072
'url' => 'mysql://root@localhost',
7173
],
74+
'table_name' => 'enqueue',
75+
'polling_interval' => 1000,
76+
'lazy' => true,
7277
],
7378
];
7479

7580
yield [
7681
'pgsql:',
7782
[
78-
'lazy' => true,
7983
'connection' => [
8084
'url' => 'pgsql://root@localhost',
8185
],
86+
'table_name' => 'enqueue',
87+
'polling_interval' => 1000,
88+
'lazy' => true,
8289
],
8390
];
8491

8592
yield [
8693
'mysql://user:pass@host:10000/db',
8794
[
88-
'lazy' => true,
8995
'connection' => [
9096
'url' => 'mysql://user:pass@host:10000/db',
9197
],
98+
'table_name' => 'enqueue',
99+
'polling_interval' => 1000,
100+
'lazy' => true,
92101
],
93102
];
94103

95104
yield [
96105
[],
97106
[
98-
'lazy' => true,
99107
'connection' => [
100108
'url' => 'mysql://root@localhost',
101109
],
110+
'table_name' => 'enqueue',
111+
'polling_interval' => 1000,
112+
'lazy' => true,
102113
],
103114
];
104115

105116
yield [
106-
['table_name' => 'a_queue_table', 'connection' => ['foo' => 'fooVal', 'bar' => 'barVal']],
107-
['table_name' => 'a_queue_table', 'connection' => ['foo' => 'fooVal', 'bar' => 'barVal']],
117+
[
118+
'connection' => ['foo' => 'fooVal', 'bar' => 'barVal'],
119+
'table_name' => 'a_queue_table',
120+
],
121+
[
122+
'connection' => ['foo' => 'fooVal', 'bar' => 'barVal'],
123+
'table_name' => 'a_queue_table',
124+
'polling_interval' => 1000,
125+
'lazy' => true,
126+
],
108127
];
109128
}
110129
}

pkg/dbal/Tests/DbalConnectionFactoryTest.php

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Enqueue\Dbal\Tests;
44

5-
use Doctrine\DBAL\Connection;
65
use Enqueue\Dbal\DbalConnectionFactory;
76
use Enqueue\Dbal\DbalContext;
87
use Enqueue\Test\ClassExtensionTrait;
@@ -17,33 +16,6 @@ public function testShouldImplementConnectionFactoryInterface()
1716
$this->assertClassImplements(PsrConnectionFactory::class, DbalConnectionFactory::class);
1817
}
1918

20-
public function testCouldBeConstructedWithEmptyConfiguration()
21-
{
22-
$factory = new DbalConnectionFactory();
23-
24-
$this->assertAttributeEquals([
25-
'lazy' => true,
26-
'connection' => ['url' => 'mysql://root@localhost'],
27-
], 'config', $factory);
28-
}
29-
30-
public function testCouldBeConstructedWithCustomConfiguration()
31-
{
32-
$factory = new DbalConnectionFactory([
33-
'connection' => [
34-
'dbname' => 'theDbName',
35-
],
36-
'lazy' => false,
37-
]);
38-
39-
$this->assertAttributeEquals([
40-
'lazy' => false,
41-
'connection' => [
42-
'dbname' => 'theDbName',
43-
],
44-
], 'config', $factory);
45-
}
46-
4719
public function testShouldCreateLazyContext()
4820
{
4921
$factory = new DbalConnectionFactory(['lazy' => true]);

0 commit comments

Comments
 (0)