14
14
use Doctrine \Migrations \ParameterFormatter ;
15
15
use Doctrine \Migrations \Provider \SchemaDiffProvider ;
16
16
use Doctrine \Migrations \Query \Query ;
17
- use Doctrine \Migrations \Tests \TestLogger ;
17
+ use Doctrine \Migrations \Tests \LogUtil ;
18
18
use Doctrine \Migrations \Tests \Version \Fixture \EmptyTestMigration ;
19
19
use Doctrine \Migrations \Tests \Version \Fixture \VersionExecutorTestMigration ;
20
20
use Doctrine \Migrations \Version \DbalExecutor ;
25
25
use Exception ;
26
26
use PHPUnit \Framework \MockObject \MockObject ;
27
27
use PHPUnit \Framework \TestCase ;
28
+ use Psr \Log \Test \TestLogger ;
28
29
use Symfony \Component \Stopwatch \Stopwatch ;
29
30
use Symfony \Component \Stopwatch \StopwatchEvent ;
30
31
use Symfony \Component \Stopwatch \StopwatchPeriod ;
31
32
use Throwable ;
32
33
33
34
class ExecutorTest extends TestCase
34
35
{
36
+ use LogUtil;
37
+
35
38
/** @var Connection&MockObject */
36
39
private Connection $ connection ;
37
40
@@ -90,7 +93,7 @@ public function testExecuteWithNoQueries(): void
90
93
'++ migrating xx ' ,
91
94
'Migration xx was executed but did not result in any SQL statements. ' ,
92
95
'Migration xx migrated (took 100ms, used 100 memory) ' ,
93
- ], $ this ->logger -> logs );
96
+ ], $ this ->getInterpolatedLogRecords ( $ this -> logger ) );
94
97
}
95
98
96
99
public function testExecuteUp (): void
@@ -137,7 +140,7 @@ public function testExecuteUp(): void
137
140
3 => 'SELECT 2 ' ,
138
141
4 => 'Query took 100ms ' ,
139
142
5 => 'Migration test migrated (took 100ms, used 100 memory) ' ,
140
- ], $ this ->logger -> logs );
143
+ ], $ this ->getInterpolatedLogRecords ( $ this -> logger ) );
141
144
}
142
145
143
146
/** @test */
@@ -151,7 +154,7 @@ public function executeUpShouldAppendDescriptionWhenItIsNotEmpty(): void
151
154
152
155
$ this ->versionExecutor ->execute ($ plan , $ migratorConfiguration );
153
156
154
- self ::assertSame ('++ migrating test (testing) ' , $ this ->logger -> logs [0 ]);
157
+ self ::assertSame ('++ migrating test (testing) ' , $ this ->getInterpolatedLogRecords ( $ this -> logger ) [0 ]);
155
158
}
156
159
157
160
public function testExecuteDown (): void
@@ -198,7 +201,7 @@ public function testExecuteDown(): void
198
201
3 => 'SELECT 4 ' ,
199
202
4 => 'Query took 100ms ' ,
200
203
5 => 'Migration test reverted (took 100ms, used 100 memory) ' ,
201
- ], $ this ->logger -> logs );
204
+ ], $ this ->getInterpolatedLogRecords ( $ this -> logger ) );
202
205
}
203
206
204
207
public function testExecuteDryRun (): void
@@ -261,7 +264,7 @@ public function testExecuteDryRun(): void
261
264
'SELECT 1 ' ,
262
265
'SELECT 2 ' ,
263
266
'Migration test migrated (took 100ms, used 100 memory) ' ,
264
- ], $ this ->logger -> logs );
267
+ ], $ this ->getInterpolatedLogRecords ( $ this -> logger ) );
265
268
}
266
269
267
270
/** @test */
@@ -498,7 +501,7 @@ public function executeDownShouldAppendDescriptionWhenItIsNotEmpty(): void
498
501
$ migratorConfiguration ,
499
502
);
500
503
501
- self ::assertSame ('++ reverting test ' , $ this ->logger -> logs [0 ]);
504
+ self ::assertSame ('++ reverting test ' , $ this ->getInterpolatedLogRecords ( $ this -> logger ) [0 ]);
502
505
}
503
506
504
507
protected function setUp (): void
0 commit comments