| @@ 1838-1850 (lines=13) @@ | ||
| 1835 | ); |
|
| 1836 | } |
|
| 1837 | ||
| 1838 | public function testCustomTypeValueSql() |
|
| 1839 | { |
|
| 1840 | if (DBALType::hasType('negative_to_positive')) { |
|
| 1841 | DBALType::overrideType('negative_to_positive', NegativeToPositiveType::class); |
|
| 1842 | } else { |
|
| 1843 | DBALType::addType('negative_to_positive', NegativeToPositiveType::class); |
|
| 1844 | } |
|
| 1845 | ||
| 1846 | $this->assertSqlGeneration( |
|
| 1847 | 'SELECT p.customInteger FROM Doctrine\Tests\Models\CustomType\CustomTypeParent p WHERE p.id = 1', |
|
| 1848 | 'SELECT -(c0_.customInteger) AS customInteger_0 FROM customtype_parents c0_ WHERE c0_.id = 1' |
|
| 1849 | ); |
|
| 1850 | } |
|
| 1851 | ||
| 1852 | public function testCustomTypeValueSqlIgnoresIdentifierColumn() |
|
| 1853 | { |
|
| @@ 1852-1864 (lines=13) @@ | ||
| 1849 | ); |
|
| 1850 | } |
|
| 1851 | ||
| 1852 | public function testCustomTypeValueSqlIgnoresIdentifierColumn() |
|
| 1853 | { |
|
| 1854 | if (DBALType::hasType('negative_to_positive')) { |
|
| 1855 | DBALType::overrideType('negative_to_positive', NegativeToPositiveType::class); |
|
| 1856 | } else { |
|
| 1857 | DBALType::addType('negative_to_positive', NegativeToPositiveType::class); |
|
| 1858 | } |
|
| 1859 | ||
| 1860 | $this->assertSqlGeneration( |
|
| 1861 | 'SELECT p.id FROM Doctrine\Tests\Models\CustomType\CustomTypeParent p WHERE p.id = 1', |
|
| 1862 | 'SELECT c0_.id AS id_0 FROM customtype_parents c0_ WHERE c0_.id = 1' |
|
| 1863 | ); |
|
| 1864 | } |
|
| 1865 | ||
| 1866 | public function testCustomTypeValueSqlForAllFields() |
|
| 1867 | { |
|
| @@ 1866-1878 (lines=13) @@ | ||
| 1863 | ); |
|
| 1864 | } |
|
| 1865 | ||
| 1866 | public function testCustomTypeValueSqlForAllFields() |
|
| 1867 | { |
|
| 1868 | if (DBALType::hasType('negative_to_positive')) { |
|
| 1869 | DBALType::overrideType('negative_to_positive', NegativeToPositiveType::class); |
|
| 1870 | } else { |
|
| 1871 | DBALType::addType('negative_to_positive', NegativeToPositiveType::class); |
|
| 1872 | } |
|
| 1873 | ||
| 1874 | $this->assertSqlGeneration( |
|
| 1875 | 'SELECT p FROM Doctrine\Tests\Models\CustomType\CustomTypeParent p', |
|
| 1876 | 'SELECT c0_.id AS id_0, -(c0_.customInteger) AS customInteger_1 FROM customtype_parents c0_' |
|
| 1877 | ); |
|
| 1878 | } |
|
| 1879 | ||
| 1880 | public function testCustomTypeValueSqlForPartialObject() |
|
| 1881 | { |
|
| @@ 1880-1892 (lines=13) @@ | ||
| 1877 | ); |
|
| 1878 | } |
|
| 1879 | ||
| 1880 | public function testCustomTypeValueSqlForPartialObject() |
|
| 1881 | { |
|
| 1882 | if (DBALType::hasType('negative_to_positive')) { |
|
| 1883 | DBALType::overrideType('negative_to_positive', NegativeToPositiveType::class); |
|
| 1884 | } else { |
|
| 1885 | DBALType::addType('negative_to_positive', NegativeToPositiveType::class); |
|
| 1886 | } |
|
| 1887 | ||
| 1888 | $this->assertSqlGeneration( |
|
| 1889 | 'SELECT partial p.{id, customInteger} FROM Doctrine\Tests\Models\CustomType\CustomTypeParent p', |
|
| 1890 | 'SELECT c0_.id AS id_0, -(c0_.customInteger) AS customInteger_1 FROM customtype_parents c0_' |
|
| 1891 | ); |
|
| 1892 | } |
|
| 1893 | ||
| 1894 | /** |
|
| 1895 | * @group DDC-1529 |
|
| @@ 27-35 (lines=9) @@ | ||
| 24 | { |
|
| 25 | private $_em; |
|
| 26 | ||
| 27 | protected function setUp() { |
|
| 28 | if (DBALType::hasType('negative_to_positive')) { |
|
| 29 | DBALType::overrideType('negative_to_positive', NegativeToPositiveType::class); |
|
| 30 | } else { |
|
| 31 | DBALType::addType('negative_to_positive', NegativeToPositiveType::class); |
|
| 32 | } |
|
| 33 | ||
| 34 | $this->_em = $this->_getTestEntityManager(); |
|
| 35 | } |
|
| 36 | ||
| 37 | public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed) |
|
| 38 | { |
|