|
50 | 50 | use TheCodingMachine\TDBM\Test\Dao\Bean\BoatBean;
|
51 | 51 | use TheCodingMachine\TDBM\Test\Dao\Bean\CatBean;
|
52 | 52 | use TheCodingMachine\TDBM\Test\Dao\Bean\CategoryBean;
|
| 53 | +use TheCodingMachine\TDBM\Test\Dao\Bean\CompositePkBean; |
53 | 54 | use TheCodingMachine\TDBM\Test\Dao\Bean\CountryBean;
|
54 | 55 | use TheCodingMachine\TDBM\Test\Dao\Bean\DateArrayBean;
|
55 | 56 | use TheCodingMachine\TDBM\Test\Dao\Bean\DogBean;
|
|
69 | 70 | use TheCodingMachine\TDBM\Test\Dao\BoatDao;
|
70 | 71 | use TheCodingMachine\TDBM\Test\Dao\CatDao;
|
71 | 72 | use TheCodingMachine\TDBM\Test\Dao\CategoryDao;
|
| 73 | +use TheCodingMachine\TDBM\Test\Dao\CompositePkDao; |
72 | 74 | use TheCodingMachine\TDBM\Test\Dao\ContactDao;
|
73 | 75 | use TheCodingMachine\TDBM\Test\Dao\CountryDao;
|
74 | 76 | use TheCodingMachine\TDBM\Test\Dao\DogDao;
|
@@ -1799,15 +1801,6 @@ public function testDecimalIsMappedToString(): void
|
1799 | 1801 | $this->assertSame('string', (string) $reflectionClass->getMethod('getLength')->getReturnType());
|
1800 | 1802 | }
|
1801 | 1803 |
|
1802 |
| - /** |
1803 |
| - * @depends testDaoGeneration |
1804 |
| - */ |
1805 |
| - public function testNoGetByIdOnMultiPrimaryKeys(): void |
1806 |
| - { |
1807 |
| - $reflectionClass = new \ReflectionClass(StateDao::class); |
1808 |
| - $this->assertFalse($reflectionClass->hasMethod('getById')); |
1809 |
| - } |
1810 |
| - |
1811 | 1804 | /**
|
1812 | 1805 | * @depends testDaoGeneration
|
1813 | 1806 | */
|
@@ -1836,6 +1829,18 @@ public function testDeleteMultiPrimaryKeysBean(): void
|
1836 | 1829 | $this->assertCount(0, $stateDao->findAll());
|
1837 | 1830 | }
|
1838 | 1831 |
|
| 1832 | + /** |
| 1833 | + * @depends testDaoGeneration |
| 1834 | + */ |
| 1835 | + public function testCompositePrimaryKeyGetter(): void |
| 1836 | + { |
| 1837 | + $stateDao = new StateDao($this->tdbmService); |
| 1838 | + $country = new CountryBean('USA'); |
| 1839 | + $stateBean = new StateBean($country, 'CA', 'California'); |
| 1840 | + $stateDao->save($stateBean); |
| 1841 | + $this->assertSame($stateBean, $stateDao->getById($country->getId(), 'CA')); |
| 1842 | + } |
| 1843 | + |
1839 | 1844 | /**
|
1840 | 1845 | * @depends testDaoGeneration
|
1841 | 1846 | */
|
@@ -2091,7 +2096,7 @@ public function testOneToOneInverseRelationGetter(): void
|
2091 | 2096 | $this->assertNull($objectBase->getObjectInherited());
|
2092 | 2097 | $objectInherited = new ObjectInheritedBean($objectBase);
|
2093 | 2098 | $objectInheritedDao->save($objectInherited);
|
2094 |
| - $this->assertInstanceOf(ObjectInheritedBean::class, $objectBase->getObjectInherited()); |
| 2099 | + $this->assertSame($objectInherited, $objectBase->getObjectInherited()); |
2095 | 2100 | $this->assertEquals(1, $objectBase->jsonSerialize()['objectInherited']['id']);
|
2096 | 2101 | }
|
2097 | 2102 | }
|
0 commit comments