diff --git a/UPGRADE.md b/UPGRADE.md
index c3d27a838a7..fe731347c93 100644
--- a/UPGRADE.md
+++ b/UPGRADE.md
@@ -8,6 +8,32 @@ awareness about deprecated code.
# Upgrade to 4.0
+## BC BREAK: removed Schema Visitor API.
+
+The following interfaces and classes have been removed:
+
+1. `Doctrine\DBAL\Schema\Visitor`,
+2. `Doctrine\DBAL\Schema\NamespaceVisitor`,
+3. `Doctrine\DBAL\Schema\AbstractVisitor`.
+
+The following methods have been removed:
+
+1. `Doctrine\DBAL\Schema\Schema::visit()`,
+2. `Doctrine\DBAL\Schema\Table::visit()`,
+3. `Doctrine\DBAL\Schema\Sequence::visit()`.
+
+## BC BREAK: removed `RemoveNamespacedAssets`.
+
+The `RemoveNamespacedAssets` schema visitor has been removed.
+
+## BC BREAK: removed the functionality of checking schema for the usage of reserved keywords.
+
+The following components have been removed:
+
+1. The `dbal:reserved-words` console command.
+2. The `ReservedWordsCommand` and `ReservedKeywordsValidator` classes.
+3. The `KeywordList::getName()` method.
+
## BC BREAK: removed `AbstractPlatform::supportsForeignKeyConstraints()`.
The `AbstractPlatform::supportsForeignKeyConstraints()` method has been removed.
@@ -533,7 +559,6 @@ Table columns are no longer indexed by column name. Use the `name` attribute of
- Class `Doctrine\DBAL\Cache\ResultCacheStatement` was made final.
- Class `Doctrine\DBAL\Cache\ArrayStatement` was made final.
- Class `Doctrine\DBAL\Schema\Synchronizer\SingleDatabaseSynchronizer` was made final.
-- Class `Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets` was made final.
- Class `Doctrine\DBAL\Portability\Statement` was made final.
## BC BREAK: Changes in the `Doctrine\DBAL\Schema` API
diff --git a/psalm.xml.dist b/psalm.xml.dist
index f01aff53643..3db3bf5dda1 100644
--- a/psalm.xml.dist
+++ b/psalm.xml.dist
@@ -40,33 +40,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Platforms/Keywords/DB2Keywords.php b/src/Platforms/Keywords/DB2Keywords.php
index 8584579df07..2000fa44fef 100644
--- a/src/Platforms/Keywords/DB2Keywords.php
+++ b/src/Platforms/Keywords/DB2Keywords.php
@@ -4,27 +4,11 @@
namespace Doctrine\DBAL\Platforms\Keywords;
-use Doctrine\Deprecations\Deprecation;
-
/**
* DB2 Keywords.
*/
class DB2Keywords extends KeywordList
{
- /**
- * @deprecated
- */
- public function getName(): string
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5433',
- 'DB2Keywords::getName() is deprecated.'
- );
-
- return 'DB2';
- }
-
/**
* {@inheritdoc}
*/
diff --git a/src/Platforms/Keywords/KeywordList.php b/src/Platforms/Keywords/KeywordList.php
index 01cc917869f..150ca3b4316 100644
--- a/src/Platforms/Keywords/KeywordList.php
+++ b/src/Platforms/Keywords/KeywordList.php
@@ -39,11 +39,4 @@ protected function initializeKeywords(): void
* @return string[]
*/
abstract protected function getKeywords(): array;
-
- /**
- * Returns the name of this keyword list.
- *
- * @deprecated
- */
- abstract public function getName(): string;
}
diff --git a/src/Platforms/Keywords/MariaDBKeywords.php b/src/Platforms/Keywords/MariaDBKeywords.php
index 9220dc4fcfc..feb39475d09 100644
--- a/src/Platforms/Keywords/MariaDBKeywords.php
+++ b/src/Platforms/Keywords/MariaDBKeywords.php
@@ -4,24 +4,8 @@
namespace Doctrine\DBAL\Platforms\Keywords;
-use Doctrine\Deprecations\Deprecation;
-
class MariaDBKeywords extends MySQLKeywords
{
- /**
- * @deprecated
- */
- public function getName(): string
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5433',
- 'MariaDBKeywords::getName() is deprecated.'
- );
-
- return 'MariaDB';
- }
-
/**
* {@inheritdoc}
*/
diff --git a/src/Platforms/Keywords/MySQL80Keywords.php b/src/Platforms/Keywords/MySQL80Keywords.php
index a12a7608671..78c5572d29e 100644
--- a/src/Platforms/Keywords/MySQL80Keywords.php
+++ b/src/Platforms/Keywords/MySQL80Keywords.php
@@ -4,8 +4,6 @@
namespace Doctrine\DBAL\Platforms\Keywords;
-use Doctrine\Deprecations\Deprecation;
-
use function array_merge;
/**
@@ -13,20 +11,6 @@
*/
class MySQL80Keywords extends MySQLKeywords
{
- /**
- * @deprecated
- */
- public function getName(): string
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5433',
- 'MySQL80Keywords::getName() is deprecated.'
- );
-
- return 'MySQL80';
- }
-
/**
* {@inheritdoc}
*
diff --git a/src/Platforms/Keywords/MySQLKeywords.php b/src/Platforms/Keywords/MySQLKeywords.php
index 9896e9c2659..430822c9367 100644
--- a/src/Platforms/Keywords/MySQLKeywords.php
+++ b/src/Platforms/Keywords/MySQLKeywords.php
@@ -4,27 +4,11 @@
namespace Doctrine\DBAL\Platforms\Keywords;
-use Doctrine\Deprecations\Deprecation;
-
/**
* MySQL Keywordlist.
*/
class MySQLKeywords extends KeywordList
{
- /**
- * @deprecated
- */
- public function getName(): string
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5433',
- 'MySQLKeywords::getName() is deprecated.'
- );
-
- return 'MySQL';
- }
-
/**
* {@inheritdoc}
*
diff --git a/src/Platforms/Keywords/OracleKeywords.php b/src/Platforms/Keywords/OracleKeywords.php
index ee14a6b9217..83bea4b62c9 100644
--- a/src/Platforms/Keywords/OracleKeywords.php
+++ b/src/Platforms/Keywords/OracleKeywords.php
@@ -4,27 +4,11 @@
namespace Doctrine\DBAL\Platforms\Keywords;
-use Doctrine\Deprecations\Deprecation;
-
/**
* Oracle Keywordlist.
*/
class OracleKeywords extends KeywordList
{
- /**
- * @deprecated
- */
- public function getName(): string
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5433',
- 'OracleKeywords::getName() is deprecated.'
- );
-
- return 'Oracle';
- }
-
/**
* {@inheritdoc}
*/
diff --git a/src/Platforms/Keywords/PostgreSQLKeywords.php b/src/Platforms/Keywords/PostgreSQLKeywords.php
index 6c7198f07d8..ffb24655d54 100644
--- a/src/Platforms/Keywords/PostgreSQLKeywords.php
+++ b/src/Platforms/Keywords/PostgreSQLKeywords.php
@@ -4,27 +4,11 @@
namespace Doctrine\DBAL\Platforms\Keywords;
-use Doctrine\Deprecations\Deprecation;
-
/**
* Reserved keywords list corresponding to the PostgreSQL database platform of the oldest supported version.
*/
class PostgreSQLKeywords extends KeywordList
{
- /**
- * @deprecated
- */
- public function getName(): string
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5433',
- 'PostgreSQLKeywords::getName() is deprecated.'
- );
-
- return 'PostgreSQL';
- }
-
/**
* {@inheritdoc}
*/
diff --git a/src/Platforms/Keywords/ReservedKeywordsValidator.php b/src/Platforms/Keywords/ReservedKeywordsValidator.php
deleted file mode 100644
index f623148a116..00000000000
--- a/src/Platforms/Keywords/ReservedKeywordsValidator.php
+++ /dev/null
@@ -1,117 +0,0 @@
-keywordLists = $keywordLists;
- }
-
- /**
- * @return string[]
- */
- public function getViolations(): array
- {
- return $this->violations;
- }
-
- /**
- * @return string[]
- */
- private function isReservedWord(string $word): array
- {
- if ($word[0] === '`') {
- $word = str_replace('`', '', $word);
- }
-
- $keywordLists = [];
- foreach ($this->keywordLists as $keywordList) {
- if (! $keywordList->isKeyword($word)) {
- continue;
- }
-
- $keywordLists[] = $keywordList->getName();
- }
-
- return $keywordLists;
- }
-
- /**
- * @param string[] $violatedPlatforms
- */
- private function addViolation(string $asset, array $violatedPlatforms): void
- {
- if (count($violatedPlatforms) === 0) {
- return;
- }
-
- $this->violations[] = $asset . ' keyword violations: ' . implode(', ', $violatedPlatforms);
- }
-
- public function acceptColumn(Table $table, Column $column): void
- {
- $this->addViolation(
- 'Table ' . $table->getName() . ' column ' . $column->getName(),
- $this->isReservedWord($column->getName())
- );
- }
-
- public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint): void
- {
- }
-
- public function acceptIndex(Table $table, Index $index): void
- {
- }
-
- public function acceptSchema(Schema $schema): void
- {
- }
-
- public function acceptSequence(Sequence $sequence): void
- {
- }
-
- public function acceptTable(Table $table): void
- {
- $this->addViolation(
- 'Table ' . $table->getName(),
- $this->isReservedWord($table->getName())
- );
- }
-}
diff --git a/src/Platforms/Keywords/SQLServerKeywords.php b/src/Platforms/Keywords/SQLServerKeywords.php
index d365e79e80a..7791e207673 100644
--- a/src/Platforms/Keywords/SQLServerKeywords.php
+++ b/src/Platforms/Keywords/SQLServerKeywords.php
@@ -4,27 +4,11 @@
namespace Doctrine\DBAL\Platforms\Keywords;
-use Doctrine\Deprecations\Deprecation;
-
/**
* Reserved keywords list corresponding to the Microsoft SQL Server database platform of the oldest supported version.
*/
class SQLServerKeywords extends KeywordList
{
- /**
- * @deprecated
- */
- public function getName(): string
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5433',
- 'SQLServerKeywords::getName() is deprecated.'
- );
-
- return 'SQLServer';
- }
-
/**
* {@inheritdoc}
*
diff --git a/src/Platforms/Keywords/SQLiteKeywords.php b/src/Platforms/Keywords/SQLiteKeywords.php
index 6b8882e52c3..022b469ccfd 100644
--- a/src/Platforms/Keywords/SQLiteKeywords.php
+++ b/src/Platforms/Keywords/SQLiteKeywords.php
@@ -4,27 +4,11 @@
namespace Doctrine\DBAL\Platforms\Keywords;
-use Doctrine\Deprecations\Deprecation;
-
/**
* SQLite Keywordlist.
*/
class SQLiteKeywords extends KeywordList
{
- /**
- * @deprecated
- */
- public function getName(): string
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5433',
- 'SQLiteKeywords::getName() is deprecated.'
- );
-
- return 'SQLite';
- }
-
/**
* {@inheritdoc}
*/
diff --git a/src/Schema/Schema.php b/src/Schema/Schema.php
index ff7a5e450dd..44fb842932e 100644
--- a/src/Schema/Schema.php
+++ b/src/Schema/Schema.php
@@ -11,11 +11,8 @@
use Doctrine\DBAL\Schema\Exception\SequenceDoesNotExist;
use Doctrine\DBAL\Schema\Exception\TableAlreadyExists;
use Doctrine\DBAL\Schema\Exception\TableDoesNotExist;
-use Doctrine\DBAL\Schema\Visitor\NamespaceVisitor;
-use Doctrine\DBAL\Schema\Visitor\Visitor;
use Doctrine\DBAL\SQL\Builder\CreateSchemaObjectsSQLBuilder;
use Doctrine\DBAL\SQL\Builder\DropSchemaObjectsSQLBuilder;
-use Doctrine\Deprecations\Deprecation;
use function array_values;
use function str_contains;
@@ -393,34 +390,6 @@ public function toDropSql(AbstractPlatform $platform): array
return $builder->buildSQL($this);
}
- /**
- * @deprecated
- */
- public function visit(Visitor $visitor): void
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5435',
- 'Schema::visit() is deprecated.'
- );
-
- $visitor->acceptSchema($this);
-
- if ($visitor instanceof NamespaceVisitor) {
- foreach ($this->namespaces as $namespace) {
- $visitor->acceptNamespace($namespace);
- }
- }
-
- foreach ($this->_tables as $table) {
- $table->visit($visitor);
- }
-
- foreach ($this->_sequences as $sequence) {
- $sequence->visit($visitor);
- }
- }
-
/**
* Cloning a Schema triggers a deep clone of all related assets.
*/
diff --git a/src/Schema/Sequence.php b/src/Schema/Sequence.php
index b172b08c2ec..5f12ed6ce42 100644
--- a/src/Schema/Sequence.php
+++ b/src/Schema/Sequence.php
@@ -4,9 +4,6 @@
namespace Doctrine\DBAL\Schema;
-use Doctrine\DBAL\Schema\Visitor\Visitor;
-use Doctrine\Deprecations\Deprecation;
-
use function count;
use function sprintf;
@@ -97,18 +94,4 @@ public function isAutoIncrementsFor(Table $table): bool
return $tableSequenceName === $sequenceName;
}
-
- /**
- * @deprecated
- */
- public function visit(Visitor $visitor): void
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5435',
- 'Sequence::visit() is deprecated.'
- );
-
- $visitor->acceptSequence($this);
- }
}
diff --git a/src/Schema/Table.php b/src/Schema/Table.php
index 4b0bb082430..877485c69b6 100644
--- a/src/Schema/Table.php
+++ b/src/Schema/Table.php
@@ -13,9 +13,7 @@
use Doctrine\DBAL\Schema\Exception\IndexNameInvalid;
use Doctrine\DBAL\Schema\Exception\InvalidTableName;
use Doctrine\DBAL\Schema\Exception\UniqueConstraintDoesNotExist;
-use Doctrine\DBAL\Schema\Visitor\Visitor;
use Doctrine\DBAL\Types\Type;
-use Doctrine\Deprecations\Deprecation;
use function array_filter;
use function array_merge;
@@ -619,34 +617,6 @@ public function getOptions(): array
return $this->_options;
}
- /**
- * @deprecated
- *
- * @throws SchemaException
- */
- public function visit(Visitor $visitor): void
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5435',
- 'Table::visit() is deprecated.'
- );
-
- $visitor->acceptTable($this);
-
- foreach ($this->getColumns() as $column) {
- $visitor->acceptColumn($this, $column);
- }
-
- foreach ($this->getIndexes() as $index) {
- $visitor->acceptIndex($this, $index);
- }
-
- foreach ($this->getForeignKeys() as $constraint) {
- $visitor->acceptForeignKey($this, $constraint);
- }
- }
-
/**
* Clone of a Table triggers a deep clone of all affected assets.
*/
diff --git a/src/Schema/Visitor/AbstractVisitor.php b/src/Schema/Visitor/AbstractVisitor.php
deleted file mode 100644
index 0f0143770f3..00000000000
--- a/src/Schema/Visitor/AbstractVisitor.php
+++ /dev/null
@@ -1,48 +0,0 @@
-schema = $schema;
- }
-
- public function acceptTable(Table $table): void
- {
- if ($this->schema === null) {
- return;
- }
-
- if ($table->isInDefaultNamespace($this->schema->getName())) {
- return;
- }
-
- $this->schema->dropTable($table->getName());
- }
-
- public function acceptSequence(Sequence $sequence): void
- {
- if ($this->schema === null) {
- return;
- }
-
- if ($sequence->isInDefaultNamespace($this->schema->getName())) {
- return;
- }
-
- $this->schema->dropSequence($sequence->getName());
- }
-
- public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint): void
- {
- if ($this->schema === null) {
- return;
- }
-
- // The table may already be deleted in a previous
- // RemoveNamespacedAssets#acceptTable call. Removing Foreign keys that
- // point to nowhere.
- if (! $this->schema->hasTable($fkConstraint->getForeignTableName())) {
- $localTable->removeForeignKey($fkConstraint->getName());
-
- return;
- }
-
- $foreignTable = $this->schema->getTable($fkConstraint->getForeignTableName());
- if ($foreignTable->isInDefaultNamespace($this->schema->getName())) {
- return;
- }
-
- $localTable->removeForeignKey($fkConstraint->getName());
- }
-}
diff --git a/src/Schema/Visitor/Visitor.php b/src/Schema/Visitor/Visitor.php
deleted file mode 100644
index c725b649b26..00000000000
--- a/src/Schema/Visitor/Visitor.php
+++ /dev/null
@@ -1,39 +0,0 @@
- */
- private array $keywordLists;
-
- private ConnectionProvider $connectionProvider;
-
- public function __construct(ConnectionProvider $connectionProvider)
- {
- Deprecation::triggerIfCalledFromOutside(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/pull/5431',
- 'ReservedWordsCommand is deprecated. Use database documentation instead.'
- );
-
- parent::__construct();
- $this->connectionProvider = $connectionProvider;
-
- $this->keywordLists = [
- 'db2' => new DB2Keywords(),
- 'mariadb' => new MariaDBKeywords(),
- 'mysql' => new MySQLKeywords(),
- 'mysql80' => new MySQL80Keywords(),
- 'oracle' => new OracleKeywords(),
- 'pgsql' => new PostgreSQLKeywords(),
- 'sqlite' => new SQLiteKeywords(),
- 'sqlserver' => new SQLServerKeywords(),
- ];
- }
-
- /**
- * Add or replace a keyword list.
- */
- public function setKeywordList(string $name, KeywordList $keywordList): void
- {
- $this->keywordLists[$name] = $keywordList;
- }
-
- protected function configure(): void
- {
- $this
- ->setName('dbal:reserved-words')
- ->setDescription('Checks if the current database contains identifiers that are reserved.')
- ->setDefinition([
- new InputOption('connection', null, InputOption::VALUE_REQUIRED, 'The named database connection'),
- new InputOption(
- 'list',
- 'l',
- InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
- 'Keyword-List name.'
- ),
- ])
- ->setHelp(<<%command.full_name%
-
-If you want to check against specific dialects you can
-pass them to the command:
-
- %command.full_name% -l mysql -l pgsql
-
-The following keyword lists are currently shipped with Doctrine:
-
- * db2
- * mariadb
- * mysql
- * mysql80
- * oracle
- * pgsql
- * sqlite
- * sqlserver
-EOT
- );
- }
-
- /**
- * {@inheritdoc}
- *
- * @throws Exception
- */
- protected function execute(InputInterface $input, OutputInterface $output): int
- {
- $output->writeln(
- 'The dbal:reserved-words command is deprecated.'
- . ' Use the documentation on the used database platform(s) instead.'
- );
- $output->writeln('');
-
- $conn = $this->getConnection($input);
-
- $keywordLists = $input->getOption('list');
-
- if (is_string($keywordLists)) {
- $keywordLists = [$keywordLists];
- } elseif (! is_array($keywordLists)) {
- $keywordLists = [];
- }
-
- if (count($keywordLists) === 0) {
- $keywordLists = array_keys($this->keywordLists);
- }
-
- $keywords = [];
- foreach ($keywordLists as $keywordList) {
- if (! isset($this->keywordLists[$keywordList])) {
- throw new InvalidArgumentException(sprintf(
- 'There exists no keyword list with name "%s". Known lists: %s',
- $keywordList,
- implode(', ', array_keys($this->keywordLists))
- ));
- }
-
- $keywords[] = $this->keywordLists[$keywordList];
- }
-
- $output->write(
- 'Checking keyword violations for ' . implode(', ', $keywordLists) . '...',
- true
- );
-
- $schema = $conn->createSchemaManager()->createSchema();
- $visitor = new ReservedKeywordsValidator($keywords);
- $schema->visit($visitor);
-
- $violations = $visitor->getViolations();
- if (count($violations) !== 0) {
- $output->write(
- 'There are ' . count($violations) . ' reserved keyword violations'
- . ' in your database schema:',
- true
- );
-
- foreach ($violations as $violation) {
- $output->write(' - ' . $violation, true);
- }
-
- return 1;
- }
-
- $output->write('No reserved keywords violations have been found!', true);
-
- return 0;
- }
-
- private function getConnection(InputInterface $input): Connection
- {
- $connectionName = $input->getOption('connection');
- assert(is_string($connectionName) || $connectionName === null);
-
- if ($connectionName !== null) {
- return $this->connectionProvider->getConnection($connectionName);
- }
-
- return $this->connectionProvider->getDefaultConnection();
- }
-}
diff --git a/src/Tools/Console/ConsoleRunner.php b/src/Tools/Console/ConsoleRunner.php
index 761723135b2..ec14c8300d0 100644
--- a/src/Tools/Console/ConsoleRunner.php
+++ b/src/Tools/Console/ConsoleRunner.php
@@ -5,7 +5,6 @@
namespace Doctrine\DBAL\Tools\Console;
use Composer\InstalledVersions;
-use Doctrine\DBAL\Tools\Console\Command\ReservedWordsCommand;
use Doctrine\DBAL\Tools\Console\Command\RunSqlCommand;
use Exception;
use Symfony\Component\Console\Application;
@@ -40,9 +39,6 @@ public static function run(ConnectionProvider $connectionProvider, array $comman
public static function addCommands(Application $cli, ConnectionProvider $connectionProvider): void
{
- $cli->addCommands([
- new RunSqlCommand($connectionProvider),
- new ReservedWordsCommand($connectionProvider),
- ]);
+ $cli->addCommands([new RunSqlCommand($connectionProvider)]);
}
}
diff --git a/tests/Platforms/ReservedKeywordsValidatorTest.php b/tests/Platforms/ReservedKeywordsValidatorTest.php
deleted file mode 100644
index 3f91dbb9c1e..00000000000
--- a/tests/Platforms/ReservedKeywordsValidatorTest.php
+++ /dev/null
@@ -1,44 +0,0 @@
-validator = new ReservedKeywordsValidator([new MySQLKeywords()]);
- }
-
- public function testReservedTableName(): void
- {
- $table = new Table('TABLE');
- $this->validator->acceptTable($table);
-
- self::assertEquals(
- ['Table TABLE keyword violations: MySQL'],
- $this->validator->getViolations()
- );
- }
-
- public function testReservedColumnName(): void
- {
- $table = new Table('TABLE');
- $column = $table->addColumn('table', 'string');
-
- $this->validator->acceptColumn($table, $column);
-
- self::assertEquals(
- ['Table TABLE column table keyword violations: MySQL'],
- $this->validator->getViolations()
- );
- }
-}
diff --git a/tests/Schema/SchemaTest.php b/tests/Schema/SchemaTest.php
index 5d4dc479707..b03ed59d7cf 100644
--- a/tests/Schema/SchemaTest.php
+++ b/tests/Schema/SchemaTest.php
@@ -9,8 +9,6 @@
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Schema\Sequence;
use Doctrine\DBAL\Schema\Table;
-use Doctrine\DBAL\Schema\Visitor\AbstractVisitor;
-use Doctrine\DBAL\Schema\Visitor\Visitor;
use PHPUnit\Framework\TestCase;
use function array_shift;
@@ -330,78 +328,4 @@ public function testCreatesNamespaceThroughAddingSequenceImplicitly(): void
self::assertTrue($schema->hasNamespace('baz'));
self::assertFalse($schema->hasNamespace('moo'));
}
-
- public function testVisitsVisitor(): void
- {
- $schema = new Schema();
- $visitor = $this->createMock(Visitor::class);
-
- $schema->createNamespace('foo');
- $schema->createNamespace('bar');
-
- $schema->createTable('baz');
- $schema->createTable('bla.bloo');
-
- $schema->createSequence('moo');
- $schema->createSequence('war');
-
- $visitor->expects(self::once())
- ->method('acceptSchema')
- ->with($schema);
-
- $visitor->expects(self::exactly(2))
- ->method('acceptTable')
- ->withConsecutive(
- [$schema->getTable('baz')],
- [$schema->getTable('bla.bloo')]
- );
-
- $visitor->expects(self::exactly(2))
- ->method('acceptSequence')
- ->withConsecutive(
- [$schema->getSequence('moo')],
- [$schema->getSequence('war')]
- );
-
- $schema->visit($visitor);
- }
-
- public function testVisitsNamespaceVisitor(): void
- {
- $schema = new Schema();
- $visitor = $this->createMock(AbstractVisitor::class);
-
- $schema->createNamespace('foo');
- $schema->createNamespace('bar');
-
- $schema->createTable('baz');
- $schema->createTable('bla.bloo');
-
- $schema->createSequence('moo');
- $schema->createSequence('war');
-
- $visitor->expects(self::once())
- ->method('acceptSchema')
- ->with($schema);
-
- $visitor->expects(self::exactly(3))
- ->method('acceptNamespace')
- ->withConsecutive(['foo'], ['bar'], ['bla']);
-
- $visitor->expects(self::exactly(2))
- ->method('acceptTable')
- ->withConsecutive(
- [$schema->getTable('baz')],
- [$schema->getTable('bla.bloo')]
- );
-
- $visitor->expects(self::exactly(2))
- ->method('acceptSequence')
- ->withConsecutive(
- [$schema->getSequence('moo')],
- [$schema->getSequence('war')]
- );
-
- $schema->visit($visitor);
- }
}
diff --git a/tests/Schema/Visitor/RemoveNamespacedAssetsTest.php b/tests/Schema/Visitor/RemoveNamespacedAssetsTest.php
deleted file mode 100644
index e4ac1af17c9..00000000000
--- a/tests/Schema/Visitor/RemoveNamespacedAssetsTest.php
+++ /dev/null
@@ -1,71 +0,0 @@
-setName('test');
- $schema = new Schema([], [], $config);
-
- $schema->createTable('test.test');
- $schema->createTable('foo.bar');
- $schema->createTable('baz');
-
- $schema->visit(new RemoveNamespacedAssets());
-
- self::assertTrue($schema->hasTable('test.test'));
- self::assertTrue($schema->hasTable('test.baz'));
- self::assertFalse($schema->hasTable('foo.bar'));
- }
-
- public function testCleanupForeignKeys(): void
- {
- $config = new SchemaConfig();
- $config->setName('test');
- $schema = new Schema([], [], $config);
-
- $fooTable = $schema->createTable('foo.bar');
- $fooTable->addColumn('id', 'integer');
-
- $testTable = $schema->createTable('test.test');
- $testTable->addColumn('id', 'integer');
-
- $testTable->addForeignKeyConstraint('foo.bar', ['id'], ['id']);
-
- $schema->visit(new RemoveNamespacedAssets());
-
- $sql = $schema->toSql(new MySQLPlatform());
- self::assertCount(1, $sql, 'Just one CREATE TABLE statement, no foreign key and table to foo.bar');
- }
-
- public function testCleanupForeignKeysDifferentOrder(): void
- {
- $config = new SchemaConfig();
- $config->setName('test');
- $schema = new Schema([], [], $config);
-
- $testTable = $schema->createTable('test.test');
- $testTable->addColumn('id', 'integer');
-
- $fooTable = $schema->createTable('foo.bar');
- $fooTable->addColumn('id', 'integer');
-
- $testTable->addForeignKeyConstraint('foo.bar', ['id'], ['id']);
-
- $schema->visit(new RemoveNamespacedAssets());
-
- $sql = $schema->toSql(new MySQLPlatform());
- self::assertCount(1, $sql, 'Just one CREATE TABLE statement, no foreign key and table to foo.bar');
- }
-}