@@ 639-663 (lines=25) @@ | ||
636 | /** |
|
637 | * @group DDC-2172 |
|
638 | */ |
|
639 | public function testGetInheritanceTypeString() |
|
640 | { |
|
641 | $reflection = new \ReflectionClass('\Doctrine\ORM\Mapping\ClassMetadataInfo'); |
|
642 | $method = new \ReflectionMethod($this->_generator, 'getInheritanceTypeString'); |
|
643 | $constants = $reflection->getConstants(); |
|
644 | $pattern = '/^INHERITANCE_TYPE_/'; |
|
645 | ||
646 | $method->setAccessible(true); |
|
647 | ||
648 | foreach ($constants as $name => $value) { |
|
649 | if( ! preg_match($pattern, $name)) { |
|
650 | continue; |
|
651 | } |
|
652 | ||
653 | $expected = preg_replace($pattern, '', $name); |
|
654 | $actual = $method->invoke($this->_generator, $value); |
|
655 | ||
656 | $this->assertEquals($expected, $actual); |
|
657 | } |
|
658 | ||
659 | $this->expectException(\InvalidArgumentException::class); |
|
660 | $this->expectExceptionMessage('Invalid provided InheritanceType: INVALID'); |
|
661 | ||
662 | $method->invoke($this->_generator, 'INVALID'); |
|
663 | } |
|
664 | ||
665 | /** |
|
666 | * @group DDC-2172 |
|
@@ 668-692 (lines=25) @@ | ||
665 | /** |
|
666 | * @group DDC-2172 |
|
667 | */ |
|
668 | public function testGetChangeTrackingPolicyString() |
|
669 | { |
|
670 | $reflection = new \ReflectionClass('\Doctrine\ORM\Mapping\ClassMetadata'); |
|
671 | $method = new \ReflectionMethod($this->_generator, 'getChangeTrackingPolicyString'); |
|
672 | $constants = $reflection->getConstants(); |
|
673 | $pattern = '/^CHANGETRACKING_/'; |
|
674 | ||
675 | $method->setAccessible(true); |
|
676 | ||
677 | foreach ($constants as $name => $value) { |
|
678 | if( ! preg_match($pattern, $name)) { |
|
679 | continue; |
|
680 | } |
|
681 | ||
682 | $expected = preg_replace($pattern, '', $name); |
|
683 | $actual = $method->invoke($this->_generator, $value); |
|
684 | ||
685 | $this->assertEquals($expected, $actual); |
|
686 | } |
|
687 | ||
688 | $this->expectException(\InvalidArgumentException::class); |
|
689 | $this->expectExceptionMessage('Invalid provided ChangeTrackingPolicy: INVALID'); |
|
690 | ||
691 | $method->invoke($this->_generator, 'INVALID'); |
|
692 | } |
|
693 | ||
694 | /** |
|
695 | * @group DDC-2172 |
|
@@ 697-721 (lines=25) @@ | ||
694 | /** |
|
695 | * @group DDC-2172 |
|
696 | */ |
|
697 | public function testGetIdGeneratorTypeString() |
|
698 | { |
|
699 | $reflection = new \ReflectionClass('\Doctrine\ORM\Mapping\ClassMetadataInfo'); |
|
700 | $method = new \ReflectionMethod($this->_generator, 'getIdGeneratorTypeString'); |
|
701 | $constants = $reflection->getConstants(); |
|
702 | $pattern = '/^GENERATOR_TYPE_/'; |
|
703 | ||
704 | $method->setAccessible(true); |
|
705 | ||
706 | foreach ($constants as $name => $value) { |
|
707 | if( ! preg_match($pattern, $name)) { |
|
708 | continue; |
|
709 | } |
|
710 | ||
711 | $expected = preg_replace($pattern, '', $name); |
|
712 | $actual = $method->invoke($this->_generator, $value); |
|
713 | ||
714 | $this->assertEquals($expected, $actual); |
|
715 | } |
|
716 | ||
717 | $this->expectException(\InvalidArgumentException::class); |
|
718 | $this->expectExceptionMessage('Invalid provided IdGeneratorType: INVALID'); |
|
719 | ||
720 | $method->invoke($this->_generator, 'INVALID'); |
|
721 | } |
|
722 | ||
723 | /** |
|
724 | * @dataProvider getEntityTypeAliasDataProvider |