|
@@ 894-917 (lines=24) @@
|
| 891 |
|
/** |
| 892 |
|
* @group DDC-2372 |
| 893 |
|
*/ |
| 894 |
|
public function testTraitPropertiesAndMethodsAreNotDuplicated() |
| 895 |
|
{ |
| 896 |
|
$cmf = new ClassMetadataFactory(); |
| 897 |
|
$em = $this->getTestEntityManager(); |
| 898 |
|
$cmf->setEntityManager($em); |
| 899 |
|
|
| 900 |
|
$user = new DDC2372User(); |
| 901 |
|
$metadata = $cmf->getMetadataFor(get_class($user)); |
| 902 |
|
|
| 903 |
|
// @todo guilhermeblanco Fix this test as changing Entity class should never be allowed. |
| 904 |
|
$metadata->setClassName($this->namespace . "\DDC2372User"); |
| 905 |
|
|
| 906 |
|
$this->generator->writeEntityClass($metadata, $this->tmpDir); |
| 907 |
|
|
| 908 |
|
self::assertFileExists($this->tmpDir . "/" . $this->namespace . "/DDC2372User.php"); |
| 909 |
|
|
| 910 |
|
require $this->tmpDir . "/" . $this->namespace . "/DDC2372User.php"; |
| 911 |
|
|
| 912 |
|
$reflClass = new \ReflectionClass($metadata->getClassName()); |
| 913 |
|
|
| 914 |
|
self::assertSame($reflClass->hasProperty('address'), false); |
| 915 |
|
self::assertSame($reflClass->hasMethod('setAddress'), false); |
| 916 |
|
self::assertSame($reflClass->hasMethod('getAddress'), false); |
| 917 |
|
} |
| 918 |
|
|
| 919 |
|
/** |
| 920 |
|
* @group DDC-2372 |
|
@@ 922-944 (lines=23) @@
|
| 919 |
|
/** |
| 920 |
|
* @group DDC-2372 |
| 921 |
|
*/ |
| 922 |
|
public function testTraitPropertiesAndMethodsAreNotDuplicatedInChildClasses() |
| 923 |
|
{ |
| 924 |
|
$cmf = new ClassMetadataFactory(); |
| 925 |
|
$em = $this->getTestEntityManager(); |
| 926 |
|
$cmf->setEntityManager($em); |
| 927 |
|
|
| 928 |
|
$user = new DDC2372Admin(); |
| 929 |
|
$metadata = $cmf->getMetadataFor(get_class($user)); |
| 930 |
|
|
| 931 |
|
// @todo guilhermeblanco Fix this test as changing Entity class should never be allowed. |
| 932 |
|
$metadata->setClassName($this->namespace . "\DDC2372Admin"); |
| 933 |
|
|
| 934 |
|
$this->generator->writeEntityClass($metadata, $this->tmpDir); |
| 935 |
|
|
| 936 |
|
self::assertFileExists($this->tmpDir . "/" . $this->namespace . "/DDC2372Admin.php"); |
| 937 |
|
require $this->tmpDir . "/" . $this->namespace . "/DDC2372Admin.php"; |
| 938 |
|
|
| 939 |
|
$reflClass = new \ReflectionClass($metadata->getClassName()); |
| 940 |
|
|
| 941 |
|
self::assertSame($reflClass->hasProperty('address'), false); |
| 942 |
|
self::assertSame($reflClass->hasMethod('setAddress'), false); |
| 943 |
|
self::assertSame($reflClass->hasMethod('getAddress'), false); |
| 944 |
|
} |
| 945 |
|
|
| 946 |
|
/** |
| 947 |
|
* @group DDC-1590 |