Neos\Flow\Tests\Functional\Persistence\Doctrine\Mapping\Driver\FlowAnnotationDriverTest::columnNamesAreBuiltCorrectly PHP Метод

columnNamesAreBuiltCorrectly() публичный Метод

Makes sure that - thumbnail and image (same type) do get distinct column names - simple properties get mapped to their name - using joincolumn without name on single associations uses the property name
    public function columnNamesAreBuiltCorrectly()
    {
        $expectedTitleMapping = ['fieldName' => 'title', 'columnName' => 'title', 'targetEntity' => 'string', 'nullable' => false, 'type' => 'string'];
        $expectedImageAssociationMapping = ['fieldName' => 'image', 'columnName' => 'image', 'joinColumns' => [0 => ['name' => 'image', 'referencedColumnName' => 'persistence_object_identifier', 'unique' => true]], 'joinColumnFieldNames' => ['image' => 'image']];
        $expectedCommentAssociationMapping = ['fieldName' => 'comment', 'columnName' => 'comment', 'joinColumns' => [0 => ['name' => 'comment', 'referencedColumnName' => 'persistence_object_identifier', 'unique' => true, 'nullable' => true, 'onDelete' => 'SET NULL', 'columnDefinition' => null]], 'sourceEntity' => Fixtures\Post::class, 'sourceToTargetKeyColumns' => ['comment' => 'persistence_object_identifier'], 'joinColumnFieldNames' => ['comment' => 'comment'], 'targetToSourceKeyColumns' => ['persistence_object_identifier' => 'comment']];
        $classMetadata = new ClassMetadata(Fixtures\Post::class);
        $driver = $this->objectManager->get(FlowAnnotationDriver::class);
        $driver->loadMetadataForClass(Fixtures\Post::class, $classMetadata);
        $this->assertEquals($expectedTitleMapping, $classMetadata->getFieldMapping('title'), 'mapping for "title" not as expected');
        $imageAssociationMapping = $classMetadata->getAssociationMapping('image');
        $thumbnailAssociationMapping = $classMetadata->getAssociationMapping('thumbnail');
        foreach (array_keys($expectedImageAssociationMapping) as $key) {
            $this->assertEquals($expectedImageAssociationMapping[$key], $imageAssociationMapping[$key], 'mapping for "image" not as expected');
            $this->assertNotEquals($expectedImageAssociationMapping[$key], $thumbnailAssociationMapping[$key], 'mapping for "thumbnail" not as expected');
        }
        $commentAssociationMapping = $classMetadata->getAssociationMapping('comment');
        $this->assertEquals(1, count($commentAssociationMapping['joinColumns']));
        foreach (array_keys($expectedCommentAssociationMapping) as $key) {
            $this->assertEquals($expectedCommentAssociationMapping[$key], $commentAssociationMapping[$key], 'mapping for "comment" not as expected');
        }
    }