1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Tests\Schema;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Schema\Name\Identifier;
use Doctrine\DBAL\Schema\View;
use Doctrine\Deprecations\PHPUnit\VerifyDeprecations;
use PHPUnit\Framework\TestCase;
class ViewTest extends TestCase
{
use VerifyDeprecations;
public function testEmptyName(): void
{
$this->expectDeprecationWithIdentifier('https://github.com/doctrine/dbal/pull/6646');
new View('', '');
}
public function testOverqualifiedName(): void
{
$this->expectDeprecationWithIdentifier('https://github.com/doctrine/dbal/pull/6592');
new View('warehouse.inventory.available_products', '');
}
/** @throws Exception */
public function testGetUnqualifiedObjectName(): void
{
$view = new View('active_users', '');
$name = $view->getObjectName();
self::assertEquals(Identifier::unquoted('active_users'), $name->getUnqualifiedName());
self::assertNull($name->getQualifier());
}
/** @throws Exception */
public function testGetQualifiedObjectName(): void
{
$view = new View('inventory.available_products', '');
$name = $view->getObjectName();
self::assertEquals(Identifier::unquoted('available_products'), $name->getUnqualifiedName());
self::assertEquals(Identifier::unquoted('inventory'), $name->getQualifier());
}
}
|