Files
piratepoet/mailpoet/tests/integration/Doctrine/TablePrefixMetadataFactoryTest.php
Rostislav Wolny c9c7146ef1 Improve table prefixing to allow Doctrine entities for WP tables
WordPress tables use only the DB prefix, but MailPoet tables use
DB prefix + plugin prefix (mailpoet).

This commit changes TablePrefixMetadataFactory to be able to distiguish
WP table for posts and adds proper prefix.
[MAILPOET-5646]
2024-01-08 12:04:06 +05:00

16 lines
583 B
PHP

<?php declare(strict_types = 1);
namespace MailPoet\Doctrine;
use MailPoet\Entities\NewsletterEntity;
use MailPoet\Entities\WpPostEntity;
class TablePrefixMetadataFactoryTest extends \MailPoetTest {
public function testItPrefixTablesCorrectly() {
$wpPostMetadata = $this->entityManager->getClassMetadata(WpPostEntity::class);
$newslettersMetadata = $this->entityManager->getClassMetadata(NewsletterEntity::class);
verify($wpPostMetadata->getTableName())->equals('mp_posts');
verify($newslettersMetadata->getTableName())->equals('mp_mailpoet_newsletters');
}
}