26
26
use Doctrine \Migrations \Version \ExecutionResult ;
27
27
use Doctrine \Migrations \Version \Version ;
28
28
use PHPUnit \Framework \TestCase ;
29
+ use Psr \Log \Test \TestLogger ;
29
30
30
31
use function sprintf ;
31
32
@@ -42,7 +43,7 @@ class TableMetadataStorageTest extends TestCase
42
43
/** @var AbstractSchemaManager<AbstractPlatform> */
43
44
private AbstractSchemaManager $ schemaManager ;
44
45
45
- private DebugLogger $ debugLogger ;
46
+ private TestLogger $ testLogger ;
46
47
47
48
private function getSqliteConnection (Configuration |null $ configuration = null ): Connection
48
49
{
@@ -54,8 +55,8 @@ private function getSqliteConnection(Configuration|null $configuration = null):
54
55
public function setUp (): void
55
56
{
56
57
$ this ->connectionConfig = new Configuration ();
57
- $ this ->debugLogger = new DebugLogger ();
58
- $ this ->connectionConfig ->setMiddlewares ([new Middleware ($ this ->debugLogger )]);
58
+ $ this ->testLogger = new TestLogger ();
59
+ $ this ->connectionConfig ->setMiddlewares ([new Middleware ($ this ->testLogger )]);
59
60
$ this ->connection = $ this ->getSqliteConnection ($ this ->connectionConfig );
60
61
$ this ->schemaManager = $ this ->connection ->createSchemaManager ();
61
62
@@ -67,13 +68,12 @@ public function testSchemaIntrospectionExecutedOnlyOnce(): void
67
68
{
68
69
$ this ->storage ->ensureInitialized ();
69
70
70
- $ oldQueryCount = $ this ->debugLogger -> count ;
71
+ $ this ->testLogger -> reset () ;
71
72
$ this ->storage ->ensureInitialized ();
72
- self ::assertSame (0 , $ this ->debugLogger -> count - $ oldQueryCount );
73
+ self ::assertCount (0 , $ this ->testLogger -> records );
73
74
74
- $ oldQueryCount = $ this ->debugLogger ->count ;
75
75
$ this ->storage ->getExecutedMigrations ();
76
- self ::assertSame (1 , $ this ->debugLogger -> count - $ oldQueryCount );
76
+ self ::assertCount (1 , $ this ->testLogger -> records );
77
77
}
78
78
79
79
public function testDifferentTableNotUpdatedOnRead (): void
0 commit comments