-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework Doctrine Bulk tests to not use deprecated code
- Loading branch information
Showing
10 changed files
with
108 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Context/InsertQueryCounter.php
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Context/ProxyLogger.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Flow\Doctrine\Bulk\Tests\Context; | ||
|
||
use Psr\Log\AbstractLogger; | ||
use Psr\Log\LoggerAwareInterface; | ||
use Psr\Log\LoggerAwareTrait; | ||
use Psr\Log\NullLogger; | ||
|
||
final class ProxyLogger extends AbstractLogger implements LoggerAwareInterface | ||
{ | ||
use LoggerAwareTrait; | ||
|
||
public int $count = 0; | ||
|
||
public function __construct() | ||
{ | ||
$this->logger = new NullLogger(); | ||
} | ||
|
||
public function log($level, $message, array $context = []) : void | ||
{ | ||
if (!isset($context['sql'])) { | ||
return; | ||
} | ||
|
||
if (\str_starts_with(\trim($context['sql']), 'INSERT')) { | ||
$this->count++; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/IntegrationTestCase.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Flow\Doctrine\Bulk\Tests; | ||
|
||
use Flow\Doctrine\Bulk\Tests\Context\DatabaseContext; | ||
use Flow\Doctrine\Bulk\Tests\Context\ProxyLogger; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
abstract class IntegrationTestCase extends TestCase | ||
{ | ||
protected DatabaseContext $databaseContext; | ||
|
||
protected readonly ProxyLogger $logger; | ||
|
||
public function __construct(string $name) | ||
{ | ||
$this->logger = new ProxyLogger(); | ||
|
||
parent::__construct($name); | ||
} | ||
|
||
protected function tearDown() : void | ||
{ | ||
$this->databaseContext->dropAllTables(); | ||
} | ||
|
||
public function executedQueriesCount() : int | ||
{ | ||
return $this->logger->count; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters