mirror of
https://github.com/doctrine/persistence.git
synced 2026-03-23 22:42:11 +01:00
This is an equivalent of1669e8danda17744efor 4.0.x It is easier and safer to re-run the same search and replace than to address conflicts.
39 lines
1012 B
PHP
39 lines
1012 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Doctrine\Tests\Persistence\Mapping;
|
|
|
|
use Doctrine\Persistence\Mapping\ClassMetadata;
|
|
use Doctrine\Persistence\Mapping\Driver\StaticPHPDriver;
|
|
use Doctrine\Tests\DoctrineTestCase;
|
|
|
|
class StaticPHPDriverTest extends DoctrineTestCase
|
|
{
|
|
public function testLoadMetadata(): void
|
|
{
|
|
$metadata = $this->createMock(ClassMetadata::class);
|
|
$metadata->expects(self::once())->method('getFieldNames');
|
|
|
|
$driver = new StaticPHPDriver([__DIR__]);
|
|
$driver->loadMetadataForClass(TestEntity::class, $metadata);
|
|
}
|
|
|
|
public function testGetAllClassNames(): void
|
|
{
|
|
$driver = new StaticPHPDriver([__DIR__]);
|
|
$classNames = $driver->getAllClassNames();
|
|
|
|
self::assertContains(TestEntity::class, $classNames);
|
|
}
|
|
}
|
|
|
|
class TestEntity
|
|
{
|
|
/** @phpstan-param ClassMetadata<object> $metadata */
|
|
public static function loadMetadata(ClassMetadata $metadata): void
|
|
{
|
|
$metadata->getFieldNames();
|
|
}
|
|
}
|