From c2130336b0ccb3dbb189828db688a5a79d7c5634 Mon Sep 17 00:00:00 2001 From: Alexandre T Date: Fri, 21 Feb 2020 11:26:17 +0100 Subject: [PATCH 01/44] Test type of value before using ctype function --- lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php b/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php index fd36d15b..8ff00e3d 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php @@ -135,7 +135,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) return null; } - if (ctype_alpha($value[0])) { + if (!is_resource($value) && ctype_alpha($value[0])) { return $this->getSpatialPlatform($platform)->convertStringToPHPValue($this, $value); } From 4dfa9b340ac461fb10baa05619ad6a648cd5516b Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Fri, 21 Feb 2020 13:37:00 +0100 Subject: [PATCH 02/44] Fork and code quality and code test updated --- .gitignore | 6 +- .php_cs.dist | 79 +++++ .travis.yml | 22 +- CHANGELOG.md | 9 + CONTRIBUTING.md | 15 +- README.md | 35 +- composer.json | 25 +- phpcs.xml.dist | 514 ++++++++++++++++++++++++++++++ phpmd.xml.dist | 16 + tests/travis/composer.orm2.3.json | 23 +- tests/travis/composer.orm2.4.json | 21 +- tests/travis/composer.orm2.5.json | 25 +- tests/travis/composer.orm2.6.json | 46 +++ 13 files changed, 789 insertions(+), 47 deletions(-) create mode 100644 .php_cs.dist create mode 100644 phpcs.xml.dist create mode 100644 phpmd.xml.dist create mode 100644 tests/travis/composer.orm2.6.json diff --git a/.gitignore b/.gitignore index 798d4793..d8a7996a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,2 @@ +composer.lock vendor/ -composer.lock* -doctrine2-spatial.iml -.idea* -.idea/* -/nbproject \ No newline at end of file diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 00000000..c7c31a25 --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,79 @@ +in(__DIR__) + ->exclude('var') + ->exclude('vendor') +; + +$header = <<setCacheFile(__DIR__.'/var/cache/.php_cs.cache') + ->setRules([ + '@DoctrineAnnotation' => true, + '@PhpCsFixer' => true, + '@Symfony' => true, + '@PHPUnit60Migration:risky' => true, + '@PHP70Migration' => true, + '@PHP71Migration' => true, + '@PHP73Migration' => true, +// 'strict_param' => true, + 'array_syntax' => ['syntax' => 'short'], + 'dir_constant' => true, + 'ereg_to_preg' => true, + 'header_comment' => [ + 'comment_type' => 'PHPDoc', + 'header' => $header, + 'location' => 'after_open', + 'separate' => 'bottom' + ], +// 'date_time_immutable' => true, +// 'declare_strict_types' => true, + 'is_null' => true, + 'mb_str_functions' => true, + 'modernize_types_casting' => true, + 'no_unneeded_final_method' => true, +// 'no_alias_functions' =>true, + 'ordered_interfaces' => [ + 'direction' => 'ascend', + 'order' => 'alpha', + ], + 'ordered_class_elements' => [ + 'order' => [ + 'use_trait', + 'constant_public', 'constant_protected', 'constant_private', 'constant', + 'property_public_static', 'property_protected_static', 'property_private_static', 'property_static', + 'property_public', 'property_protected', 'property_private', 'property', + 'construct', 'destruct', + 'phpunit', + 'method_public_static', 'method_protected_static', 'method_private_static', 'method_static', + 'method_public', 'method_protected', 'method_private', 'method', 'magic' + ], + 'sortAlgorithm' => 'alpha' + ], + 'single_line_throw' => false + ]) + ->setFinder($finder) + ; \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 0f140156..038a52ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,21 +3,21 @@ language: php sudo: false php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - 7.1 + - 7.2 + - 7.3 + - 7.4 - hhvm env: - ORM=2.3 - ORM=2.4 - ORM=2.5 + - ORM=2.6 + - ORM=2.7 before_script: - composer self-update + - cp ./composer.json ./tests/travis/composer.orm2.7.json - cp ./tests/travis/composer.orm$ORM.json ./composer.json - composer install --prefer-source - mkdir -p ./build/coverage @@ -36,6 +36,10 @@ notifications: matrix: allow_failures: - php: hhvm # driver for PostgreSQL currently unsupported by HHVM, requires 3rd party dependency - exclude: - - php: 5.3 - env: ORM=2.5 # ORM >=2.5 requires PHP >=5.4 +# exclude: +# - php: 7.4 +# env: ORM=2.3 # ORM <=2.6.4 are not compatible with PHP >=7.4 +# - php: 7.4 +# env: ORM=2.4 # ORM <=2.6.4 are not compatible with PHP >=7.4 +# - php: 7.4 +# env: ORM=2.5 # ORM <=2.6.4 are not compatible with PHP >=7.4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 24aee520..893ce856 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] ### Added +- Project fork from creof/doctrine-spatial2 +- Adding support of PHP7.2, PHP7.3, PHP7.4 +- Removing deprecations of doctrine2 +### Removed +- Removing support of PHP5.*, PHP7.0, PHP7.1 + +## [1.1.1] - 2020-02-21 +Nota: This version was never published by creof. But the fork begins at this date. +### Added - Added support for PostgreSql ST_MakeEnvelope function. ### Changed - Added implementation of getTypeFamily() and getSQLType() to AbstractGeometryType. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3ced1ac2..5d4fe026 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,10 @@ -(this is a work in progress) +Contributing +============ -- Code formatting MUST follow PSR-2. -- Issues SHOULD include code and/or data to reproduce the issue. -- PR's for issues SHOULD include test(s) for issue. -- PR's SHOULD have adequate documentation (commit messages, comments, etc.) to readily convey what and/or why. -- Code SHOULD attempt to follow [Object Calisthenics](http://www.xpteam.com/jeff/writings/objectcalisthenics.rtf) methodology. +Quality of code is auto-verified by php-cs-fixer, php code sniffer and php mess detector. + +Before a commit, launch the quality script: + +```bash +composer quality +``` \ No newline at end of file diff --git a/README.md b/README.md index a531f64a..0d7fa576 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,33 @@ # Doctrine2-Spatial -[![Build Status](https://travis-ci.org/creof/doctrine2-spatial.svg?branch=master)](https://travis-ci.org/creof/doctrine2-spatial) -[![Code Climate](https://codeclimate.com/github/creof/doctrine2-spatial/badges/gpa.svg)](https://codeclimate.com/github/creof/doctrine2-spatial) -[![Coverage Status](https://coveralls.io/repos/creof/doctrine2-spatial/badge.svg?branch=master&service=github)](https://coveralls.io/github/creof/doctrine2-spatial?branch=master) -[![Downloads](https://img.shields.io/packagist/dm/creof/doctrine2-spatial.svg)](https://packagist.org/packages/creof/doctrine2-spatial) -[![Gitter](https://badges.gitter.im/gitterHQ/gitter.svg)](https://gitter.im/creof/doctrine2-spatial) +This project was forked from [creof/doctrine2-spatial](https://github.com/creof/doctrine2-spatial) which seems to be unactive since 2017. +This fork will upgrade this package to the last doctrine version and the [PHP supported versions](https://www.php.net/supported-versions.php). +Feel free to [contribute](./CONTRIBUTING.md)! -Doctrine2 multi-platform support for spatial types and functions. Currently MySQL and PostgreSQL with PostGIS are supported. Could potentially add support for other platforms if an interest is expressed. +[![Build Status](https://travis-ci.org/Alexandre-T/doctrine2-spatial.svg?branch=master)](https://travis-ci.org/creof/doctrine2-spatial) +[![Code Climate](https://codeclimate.com/github/Alexandre-T/doctrine2-spatial/badges/gpa.svg)](https://codeclimate.com/github/creof/doctrine2-spatial) +[![Coverage Status](https://coveralls.io/repos/Alexandre-T/doctrine2-spatial/badge.svg?branch=master&service=github)](https://coveralls.io/github/creof/doctrine2-spatial?branch=master) +[![Downloads](https://img.shields.io/packagist/dm/Alexandre-T/doctrine2-spatial.svg)](https://packagist.org/packages/creof/doctrine2-spatial) -Documentation can be found at [here](./doc/index.md) +Doctrine2 multi-platform support for spatial types and functions. +Currently MySQL and PostgreSQL with PostGIS are supported. +Could potentially add support for other platforms if an interest is expressed. -## composer.json -```javascript -{ +### [Documentation](./doc/index.md) + +### Installation + +Update your composer.json to add this package: +```yaml "require": { - ... - "creof/doctrine2-spatial": "~1" + .... + "alexandret/doctrine2-spatial": "~1" + .... + } ``` You will also have to change the version requirement of doctrine to at least 2.3: -```javascript - +```yaml "doctrine/orm": ">=2.3", ``` diff --git a/composer.json b/composer.json index b5b179de..673e8220 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "creof/doctrine2-spatial", + "name": "alexandret/doctrine2-spatial", "type": "library", "description": "Doctrine2 multi-platform support for spatial types and functions", "keywords": ["orm", "dbal", "database", "postgresql", "mysql", "opengis", "postgis", "gis", "spatial", "geometry", "geography"], @@ -7,19 +7,36 @@ { "name": "Derek Lambert", "email": "dlambert@dereklambert.com" + }, + { + "name": "Alexandre Tranchant", + "email": "alexandre.tranchant@gmail.com" } ], "license": "MIT", "require": { - "doctrine/orm": ">=2.3", + "doctrine/orm": ">2.7", "creof/geo-parser": "~2.0", "creof/wkt-parser": "~2.0", "creof/wkb-parser": "~2.0" }, "require-dev": { - "phpunit/phpunit": "<5.0", + "friendsofphp/php-cs-fixer": "^2.16", + "phpmd/phpmd": "@stable", + "phpunit/phpunit": "*", "phpunit/phpcov": "*", - "satooshi/php-coveralls": "~1.0" + "php-coveralls/php-coveralls": "~1.0", + "squizlabs/php_codesniffer": "3.*" + }, + "scripts": { + "quality": [ + "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", + "phpcs --standard=phpcs.xml.dist -s", + "phpmd bin,config,public,src,tests text ./phpmd.xml.dist" + ], + "phpcs": "phpcs --standard=phpcs.xml.dist -s", + "phpcsfixer": "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", + "phpmd": "phpmd bin,config,public,src,tests text ./phpmd.xml.dist" }, "autoload": { "psr-0": { diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 00000000..835bdec5 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,514 @@ + + + + + + + + + + + The coding standard of Alexandre Tranchant's application, based on the Generic, PSR2. + + + + */.git/* + + */vendor/* + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + lib/ + tests/ + \ No newline at end of file diff --git a/phpmd.xml.dist b/phpmd.xml.dist new file mode 100644 index 00000000..f3883fc6 --- /dev/null +++ b/phpmd.xml.dist @@ -0,0 +1,16 @@ + + + Alexandre Tranchant rule set. + + + + + + + + diff --git a/tests/travis/composer.orm2.3.json b/tests/travis/composer.orm2.3.json index bc2ee258..acd35272 100644 --- a/tests/travis/composer.orm2.3.json +++ b/tests/travis/composer.orm2.3.json @@ -1,5 +1,5 @@ { - "name": "creof/doctrine2-spatial", + "name": "alexandret/doctrine2-spatial", "type": "library", "description": "Doctrine2 multi-platform support for spatial types and functions", "keywords": ["orm", "dbal", "database", "postgresql", "mysql", "opengis", "postgis", "gis", "spatial", "geometry", "geography"], @@ -7,6 +7,10 @@ { "name": "Derek Lambert", "email": "dlambert@dereklambert.com" + }, + { + "name": "Alexandre Tranchant", + "email": "alexandre.tranchant@gmail.com" } ], "license": "MIT", @@ -17,9 +21,22 @@ "creof/wkb-parser": "~2.0" }, "require-dev": { - "phpunit/phpunit": "<5.0", + "friendsofphp/php-cs-fixer": "^2.16", + "phpmd/phpmd": "@stable", + "phpunit/phpunit": "*", "phpunit/phpcov": "*", - "satooshi/php-coveralls": "~1.0" + "php-coveralls/php-coveralls": "~1.0", + "squizlabs/php_codesniffer": "3.*" + }, + "scripts": { + "quality": [ + "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", + "phpcs --standard=phpcs.xml.dist -s", + "phpmd bin,config,public,src,tests text ./phpmd.xml.dist" + ], + "phpcs": "phpcs --standard=phpcs.xml.dist -s", + "phpcsfixer": "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", + "phpmd": "phpmd bin,config,public,src,tests text ./phpmd.xml.dist" }, "autoload": { "psr-0": { diff --git a/tests/travis/composer.orm2.4.json b/tests/travis/composer.orm2.4.json index 2ac28127..8fc0956d 100644 --- a/tests/travis/composer.orm2.4.json +++ b/tests/travis/composer.orm2.4.json @@ -1,5 +1,5 @@ { - "name": "creof/doctrine2-spatial", + "name": "alexandret/doctrine2-spatial", "type": "library", "description": "Doctrine2 multi-platform support for spatial types and functions", "keywords": ["orm", "dbal", "database", "postgresql", "mysql", "opengis", "postgis", "gis", "spatial", "geometry", "geography"], @@ -7,6 +7,10 @@ { "name": "Derek Lambert", "email": "dlambert@dereklambert.com" + }, + { + "name": "Alexandre Tranchant", + "email": "alexandre.tranchant@gmail.com" } ], "license": "MIT", @@ -17,9 +21,22 @@ "creof/wkb-parser": "~2.0" }, "require-dev": { + "friendsofphp/php-cs-fixer": "^2.16", + "phpmd/phpmd": "@stable", "phpunit/phpunit": "<5.0", "phpunit/phpcov": "*", - "satooshi/php-coveralls": "~1.0" + "satooshi/php-coveralls": "~1.0", + "squizlabs/php_codesniffer": "3.*" + }, + "scripts": { + "quality": [ + "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", + "phpcs --standard=phpcs.xml.dist -s", + "phpmd bin,config,public,src,tests text ./phpmd.xml.dist" + ], + "phpcs": "phpcs --standard=phpcs.xml.dist -s", + "phpcsfixer": "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", + "phpmd": "phpmd bin,config,public,src,tests text ./phpmd.xml.dist" }, "autoload": { "psr-0": { diff --git a/tests/travis/composer.orm2.5.json b/tests/travis/composer.orm2.5.json index 0338cfbf..8468c0fc 100644 --- a/tests/travis/composer.orm2.5.json +++ b/tests/travis/composer.orm2.5.json @@ -1,5 +1,5 @@ { - "name": "creof/doctrine2-spatial", + "name": "alexandret/doctrine2-spatial", "type": "library", "description": "Doctrine2 multi-platform support for spatial types and functions", "keywords": ["orm", "dbal", "database", "postgresql", "mysql", "opengis", "postgis", "gis", "spatial", "geometry", "geography"], @@ -7,19 +7,36 @@ { "name": "Derek Lambert", "email": "dlambert@dereklambert.com" + }, + { + "name": "Alexandre Tranchant", + "email": "alexandre.tranchant@gmail.com" } ], "license": "MIT", "require": { - "doctrine/orm": "<2.6", + "doctrine/orm": "<2.5", "creof/geo-parser": "~2.0", "creof/wkt-parser": "~2.0", "creof/wkb-parser": "~2.0" }, "require-dev": { - "phpunit/phpunit": "<5.0", + "friendsofphp/php-cs-fixer": "^2.16", + "phpmd/phpmd": "@stable", + "phpunit/phpunit": "*", "phpunit/phpcov": "*", - "satooshi/php-coveralls": "~1.0" + "php-coveralls/php-coveralls": "~1.0", + "squizlabs/php_codesniffer": "3.*" + }, + "scripts": { + "quality": [ + "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", + "phpcs --standard=phpcs.xml.dist -s", + "phpmd bin,config,public,src,tests text ./phpmd.xml.dist" + ], + "phpcs": "phpcs --standard=phpcs.xml.dist -s", + "phpcsfixer": "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", + "phpmd": "phpmd bin,config,public,src,tests text ./phpmd.xml.dist" }, "autoload": { "psr-0": { diff --git a/tests/travis/composer.orm2.6.json b/tests/travis/composer.orm2.6.json new file mode 100644 index 00000000..3c24cebd --- /dev/null +++ b/tests/travis/composer.orm2.6.json @@ -0,0 +1,46 @@ +{ + "name": "alexandret/doctrine2-spatial", + "type": "library", + "description": "Doctrine2 multi-platform support for spatial types and functions", + "keywords": ["orm", "dbal", "database", "postgresql", "mysql", "opengis", "postgis", "gis", "spatial", "geometry", "geography"], + "authors": [ + { + "name": "Derek Lambert", + "email": "dlambert@dereklambert.com" + }, + { + "name": "Alexandre Tranchant", + "email": "alexandre.tranchant@gmail.com" + } + ], + "license": "MIT", + "require": { + "doctrine/orm": "<2.7", + "creof/geo-parser": "~2.0", + "creof/wkt-parser": "~2.0", + "creof/wkb-parser": "~2.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.16", + "phpmd/phpmd": "@stable", + "phpunit/phpunit": "*", + "phpunit/phpcov": "*", + "php-coveralls/php-coveralls": "~1.0", + "squizlabs/php_codesniffer": "3.*" + }, + "scripts": { + "quality": [ + "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", + "phpcs --standard=phpcs.xml.dist -s", + "phpmd bin,config,public,src,tests text ./phpmd.xml.dist" + ], + "phpcs": "phpcs --standard=phpcs.xml.dist -s", + "phpcsfixer": "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", + "phpmd": "phpmd bin,config,public,src,tests text ./phpmd.xml.dist" + }, + "autoload": { + "psr-0": { + "CrEOF\\Spatial": "lib/" + } + } +} From e09660914cb3cca70dcc88aa6b0c1d86827176ec Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Fri, 21 Feb 2020 14:38:03 +0100 Subject: [PATCH 03/44] Void added to setUp method, Php-cs-fixer fix --- .gitignore | 2 + .php_cs.dist | 4 +- CHANGELOG.md | 1 + composer.json | 7 +- .../DBAL/Platform/AbstractPlatform.php | 44 +- lib/CrEOF/Spatial/DBAL/Platform/MySql.php | 29 +- .../DBAL/Platform/PlatformInterface.php | 32 +- .../Spatial/DBAL/Platform/PostgreSql.php | 80 ++- .../DBAL/Types/AbstractSpatialType.php | 119 ++-- .../DBAL/Types/Geography/LineStringType.php | 4 +- .../DBAL/Types/Geography/PointType.php | 4 +- .../DBAL/Types/Geography/PolygonType.php | 4 +- .../Spatial/DBAL/Types/GeographyType.php | 4 +- .../DBAL/Types/Geometry/LineStringType.php | 4 +- .../DBAL/Types/Geometry/MultiPolygonType.php | 4 +- .../Spatial/DBAL/Types/Geometry/PointType.php | 4 +- .../DBAL/Types/Geometry/PolygonType.php | 4 +- lib/CrEOF/Spatial/DBAL/Types/GeometryType.php | 4 +- .../Exception/InvalidValueException.php | 4 +- .../UnsupportedPlatformException.php | 4 +- .../Functions/AbstractSpatialDQLFunction.php | 50 +- .../ORM/Query/AST/Functions/MySql/Area.php | 12 +- .../Query/AST/Functions/MySql/AsBinary.php | 12 +- .../ORM/Query/AST/Functions/MySql/AsText.php | 12 +- .../ORM/Query/AST/Functions/MySql/Buffer.php | 13 +- .../Query/AST/Functions/MySql/Centroid.php | 13 +- .../Query/AST/Functions/MySql/Contains.php | 12 +- .../ORM/Query/AST/Functions/MySql/Crosses.php | 13 +- .../Query/AST/Functions/MySql/Dimension.php | 13 +- .../Query/AST/Functions/MySql/Disjoint.php | 12 +- .../Query/AST/Functions/MySql/Distance.php | 15 +- .../Functions/MySql/DistanceFromMultyLine.php | 63 ++- .../Query/AST/Functions/MySql/EndPoint.php | 13 +- .../Query/AST/Functions/MySql/Envelope.php | 12 +- .../ORM/Query/AST/Functions/MySql/Equals.php | 13 +- .../AST/Functions/MySql/ExteriorRing.php | 13 +- .../ORM/Query/AST/Functions/MySql/GLength.php | 12 +- .../Query/AST/Functions/MySql/GeodistPt.php | 63 ++- .../AST/Functions/MySql/GeomFromText.php | 12 +- .../AST/Functions/MySql/GeometryType.php | 13 +- .../AST/Functions/MySql/InteriorRingN.php | 13 +- .../Query/AST/Functions/MySql/Intersects.php | 13 +- .../Query/AST/Functions/MySql/IsClosed.php | 13 +- .../ORM/Query/AST/Functions/MySql/IsEmpty.php | 13 +- .../Query/AST/Functions/MySql/IsSimple.php | 13 +- .../Query/AST/Functions/MySql/LineString.php | 12 +- .../AST/Functions/MySql/LineStringFromWKB.php | 15 +- .../Query/AST/Functions/MySql/MBRContains.php | 12 +- .../Query/AST/Functions/MySql/MBRDisjoint.php | 8 +- .../Query/AST/Functions/MySql/MBREqual.php | 12 +- .../AST/Functions/MySql/MBRIntersects.php | 13 +- .../Query/AST/Functions/MySql/MBROverlaps.php | 13 +- .../Query/AST/Functions/MySql/MBRTouches.php | 13 +- .../Query/AST/Functions/MySql/MBRWithin.php | 13 +- .../AST/Functions/MySql/NumInteriorRings.php | 13 +- .../Query/AST/Functions/MySql/NumPoints.php | 13 +- .../Query/AST/Functions/MySql/Overlaps.php | 13 +- .../ORM/Query/AST/Functions/MySql/Point.php | 16 +- .../AST/Functions/MySql/PointFromWKB.php | 16 +- .../ORM/Query/AST/Functions/MySql/PointN.php | 13 +- .../ORM/Query/AST/Functions/MySql/SRID.php | 13 +- .../Query/AST/Functions/MySql/STBuffer.php | 15 +- .../Query/AST/Functions/MySql/STContains.php | 15 +- .../Query/AST/Functions/MySql/STCrosses.php | 15 +- .../Query/AST/Functions/MySql/STDisjoint.php | 15 +- .../Query/AST/Functions/MySql/STDistance.php | 15 +- .../Query/AST/Functions/MySql/STEquals.php | 15 +- .../AST/Functions/MySql/STIntersects.php | 13 +- .../Query/AST/Functions/MySql/STOverlaps.php | 15 +- .../Query/AST/Functions/MySql/STTouches.php | 15 +- .../Query/AST/Functions/MySql/STWithin.php | 15 +- .../Query/AST/Functions/MySql/StartPoint.php | 12 +- .../ORM/Query/AST/Functions/MySql/Touches.php | 16 +- .../ORM/Query/AST/Functions/MySql/Within.php | 13 +- .../ORM/Query/AST/Functions/MySql/X.php | 13 +- .../ORM/Query/AST/Functions/MySql/Y.php | 13 +- .../AST/Functions/PostgreSql/Geometry.php | 12 +- .../Query/AST/Functions/PostgreSql/STArea.php | 12 +- .../AST/Functions/PostgreSql/STAsBinary.php | 12 +- .../AST/Functions/PostgreSql/STAsGeoJson.php | 12 +- .../AST/Functions/PostgreSql/STAsText.php | 12 +- .../AST/Functions/PostgreSql/STAzimuth.php | 12 +- .../AST/Functions/PostgreSql/STBoundary.php | 12 +- .../AST/Functions/PostgreSql/STBuffer.php | 31 +- .../AST/Functions/PostgreSql/STCentroid.php | 12 +- .../Functions/PostgreSql/STClosestPoint.php | 12 +- .../AST/Functions/PostgreSql/STCollect.php | 12 +- .../AST/Functions/PostgreSql/STContains.php | 12 +- .../PostgreSql/STContainsProperly.php | 12 +- .../AST/Functions/PostgreSql/STCoveredBy.php | 12 +- .../AST/Functions/PostgreSql/STCovers.php | 12 +- .../AST/Functions/PostgreSql/STCrosses.php | 12 +- .../AST/Functions/PostgreSql/STDWithin.php | 12 +- .../AST/Functions/PostgreSql/STDifference.php | 12 +- .../AST/Functions/PostgreSql/STDisjoint.php | 12 +- .../AST/Functions/PostgreSql/STDistance.php | 12 +- .../Functions/PostgreSql/STDistanceSphere.php | 12 +- .../AST/Functions/PostgreSql/STEndPoint.php | 12 +- .../AST/Functions/PostgreSql/STEnvelope.php | 12 +- .../AST/Functions/PostgreSql/STExpand.php | 31 +- .../AST/Functions/PostgreSql/STExtent.php | 12 +- .../PostgreSql/STGeographyFromText.php | 10 +- .../Functions/PostgreSql/STGeomFromEWKT.php | 10 +- .../Functions/PostgreSql/STGeomFromText.php | 12 +- .../AST/Functions/PostgreSql/STGeometryN.php | 12 +- .../Functions/PostgreSql/STIntersection.php | 12 +- .../AST/Functions/PostgreSql/STIntersects.php | 12 +- .../AST/Functions/PostgreSql/STLength.php | 12 +- .../PostgreSql/STLineCrossingDirection.php | 12 +- .../PostgreSql/STLineInterpolatePoint.php | 12 +- .../PostgreSql/STLineLocatePoint.php | 12 +- .../Functions/PostgreSql/STLineSubstring.php | 12 +- .../AST/Functions/PostgreSql/STMakeBox2D.php | 12 +- .../Functions/PostgreSql/STMakeEnvelope.php | 15 +- .../AST/Functions/PostgreSql/STMakeLine.php | 12 +- .../AST/Functions/PostgreSql/STMakePoint.php | 12 +- .../AST/Functions/PostgreSql/STOverlaps.php | 11 +- .../AST/Functions/PostgreSql/STPerimeter.php | 12 +- .../AST/Functions/PostgreSql/STPoint.php | 12 +- .../AST/Functions/PostgreSql/STScale.php | 11 +- .../AST/Functions/PostgreSql/STSetSRID.php | 12 +- .../AST/Functions/PostgreSql/STSimplify.php | 31 +- .../AST/Functions/PostgreSql/STSnapToGrid.php | 16 +- .../AST/Functions/PostgreSql/STSplit.php | 12 +- .../AST/Functions/PostgreSql/STStartPoint.php | 12 +- .../AST/Functions/PostgreSql/STSummary.php | 12 +- .../AST/Functions/PostgreSql/STTouches.php | 12 +- .../AST/Functions/PostgreSql/STTransform.php | 31 +- .../AST/Functions/PostgreSql/STTranslate.php | 12 +- .../AST/Functions/PostgreSql/STUnion.php | 12 +- .../AST/Functions/PostgreSql/STWithin.php | 12 +- .../Query/AST/Functions/PostgreSql/STX.php | 12 +- .../Query/AST/Functions/PostgreSql/STY.php | 12 +- .../Functions/ReturnsGeometryInterface.php | 6 +- .../Spatial/ORM/Query/GeometryWalker.php | 13 +- .../Spatial/PHP/Types/AbstractGeometry.php | 224 ++++---- .../Spatial/PHP/Types/AbstractLineString.php | 3 +- .../PHP/Types/AbstractMultiLineString.php | 54 +- .../Spatial/PHP/Types/AbstractMultiPoint.php | 69 +-- .../PHP/Types/AbstractMultiPolygon.php | 54 +- lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php | 140 ++--- .../Spatial/PHP/Types/AbstractPolygon.php | 56 +- .../Types/Geography/GeographyInterface.php | 17 +- .../PHP/Types/Geography/LineString.php | 4 +- .../Spatial/PHP/Types/Geography/Point.php | 9 +- .../Spatial/PHP/Types/Geography/Polygon.php | 4 +- .../PHP/Types/Geometry/GeometryInterface.php | 21 +- .../Spatial/PHP/Types/Geometry/LineString.php | 6 +- .../PHP/Types/Geometry/MultiLineString.php | 6 +- .../Spatial/PHP/Types/Geometry/MultiPoint.php | 6 +- .../PHP/Types/Geometry/MultiPolygon.php | 6 +- .../Spatial/PHP/Types/Geometry/Point.php | 6 +- .../Spatial/PHP/Types/Geometry/Polygon.php | 6 +- phpcs.xml.dist | 1 - .../Tests/DBAL/Platform/PlatformTest.php | 23 +- .../DBAL/Types/Geography/GeoPointSridTest.php | 11 +- .../Types/Geography/GeoPolygonTypeTest.php | 77 +-- .../Tests/DBAL/Types/GeographyTypeTest.php | 78 +-- .../Types/Geometry/LineStringTypeTest.php | 49 +- .../Types/Geometry/MultiPolygonTypeTest.php | 118 ++-- .../DBAL/Types/Geometry/PointTypeTest.php | 35 +- .../DBAL/Types/Geometry/PolygonTypeTest.php | 77 +-- .../Tests/DBAL/Types/GeometryTypeTest.php | 86 +-- .../Spatial/Tests/DBAL/Types/SchemaTest.php | 21 +- tests/CrEOF/Spatial/Tests/FileSQLLogger.php | 11 +- .../Tests/Fixtures/GeoLineStringEntity.php | 40 +- .../Tests/Fixtures/GeoPointSridEntity.php | 39 +- .../Tests/Fixtures/GeoPolygonEntity.php | 40 +- .../Tests/Fixtures/GeographyEntity.php | 42 +- .../Spatial/Tests/Fixtures/GeometryEntity.php | 45 +- .../Tests/Fixtures/LineStringEntity.php | 40 +- .../Tests/Fixtures/MultiPolygonEntity.php | 38 +- .../Tests/Fixtures/NoHintGeometryEntity.php | 44 +- .../Spatial/Tests/Fixtures/PointEntity.php | 40 +- .../Spatial/Tests/Fixtures/PolygonEntity.php | 40 +- .../Query/AST/Functions/MySql/AreaTest.php | 121 ++-- .../AST/Functions/MySql/AsBinaryTest.php | 25 +- .../Query/AST/Functions/MySql/AsTextTest.php | 23 +- .../AST/Functions/MySql/ContainsTest.php | 83 +-- .../AST/Functions/MySql/DisjointTest.php | 105 ++-- .../AST/Functions/MySql/EnvelopeTest.php | 99 ++-- .../Query/AST/Functions/MySql/GLengthTest.php | 41 +- .../AST/Functions/MySql/GeomFromTextTest.php | 35 +- .../AST/Functions/MySql/MBRContainsTest.php | 83 +-- .../AST/Functions/MySql/MBRDisjointTest.php | 105 ++-- .../AST/Functions/MySql/StartPointTest.php | 55 +- .../AST/Functions/PostgreSql/GeometryTest.php | 18 +- .../AST/Functions/PostgreSql/STAreaTest.php | 105 ++-- .../Functions/PostgreSql/STAsBinaryTest.php | 23 +- .../AST/Functions/PostgreSql/STAsTextTest.php | 23 +- .../Functions/PostgreSql/STCentroidTest.php | 27 +- .../PostgreSql/STClosestPointTest.php | 27 +- .../Functions/PostgreSql/STCollectTest.php | 16 +- .../PostgreSql/STContainsProperlyTest.php | 45 +- .../Functions/PostgreSql/STContainsTest.php | 47 +- .../Functions/PostgreSql/STCoveredByTest.php | 45 +- .../AST/Functions/PostgreSql/STCoversTest.php | 45 +- .../Functions/PostgreSql/STCrossesTest.php | 59 +- .../Functions/PostgreSql/STDisjointTest.php | 63 ++- .../PostgreSql/STDistanceSphereTest.php | 17 +- .../Functions/PostgreSql/STDistanceTest.php | 77 +-- .../Functions/PostgreSql/STEnvelopeTest.php | 63 ++- .../PostgreSql/STGeomFromTextTest.php | 33 +- .../AST/Functions/PostgreSql/STLengthTest.php | 27 +- .../STLineCrossingDirectionTest.php | 45 +- .../PostgreSql/STMakeEnvelopeTest.php | 23 +- .../Functions/PostgreSql/STOverlapsTest.php | 27 +- .../Functions/PostgreSql/STSnapToGridTest.php | 53 +- .../Functions/PostgreSql/STStartPointTest.php | 55 +- .../Functions/PostgreSql/STSummaryTest.php | 127 +++-- .../Tests/ORM/Query/GeometryWalkerTest.php | 48 +- .../Spatial/Tests/ORM/Query/WrappingTest.php | 21 +- tests/CrEOF/Spatial/Tests/OrmMockTestCase.php | 57 +- tests/CrEOF/Spatial/Tests/OrmTestCase.php | 531 +++++++++--------- .../Tests/PHP/Types/Geography/PointTest.php | 292 +++++----- .../PHP/Types/Geometry/LineStringTest.php | 188 ++++--- .../Types/Geometry/MultiLineStringTest.php | 372 ++++++------ .../PHP/Types/Geometry/MultiPointTest.php | 188 ++++--- .../PHP/Types/Geometry/MultiPolygonTest.php | 498 ++++++++-------- .../Tests/PHP/Types/Geometry/PointTest.php | 278 ++++----- .../Tests/PHP/Types/Geometry/PolygonTest.php | 374 ++++++------ tests/CrEOF/Spatial/Tests/TestInit.php | 32 +- 222 files changed, 4415 insertions(+), 4036 deletions(-) diff --git a/.gitignore b/.gitignore index d8a7996a..2b4c2c32 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ +.phpcs-cache +.php_cs.cache composer.lock vendor/ diff --git a/.php_cs.dist b/.php_cs.dist index c7c31a25..fe86157a 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -7,8 +7,8 @@ $finder = PhpCsFixer\Finder::create() ; $header = <<setCacheFile(__DIR__.'/var/cache/.php_cs.cache') +// ->setCacheFile(__DIR__.'/.php_cs.cache') ->setRules([ '@DoctrineAnnotation' => true, '@PhpCsFixer' => true, diff --git a/CHANGELOG.md b/CHANGELOG.md index 893ce856..04f4028c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] ### Added +- Needed PHP extension added in composer.json - Project fork from creof/doctrine-spatial2 - Adding support of PHP7.2, PHP7.3, PHP7.4 - Removing deprecations of doctrine2 diff --git a/composer.json b/composer.json index 673e8220..b2a32b37 100644 --- a/composer.json +++ b/composer.json @@ -15,10 +15,13 @@ ], "license": "MIT", "require": { - "doctrine/orm": ">2.7", + "php": "^7.2", + "ext-json": "*", + "ext-mbstring": "*", "creof/geo-parser": "~2.0", "creof/wkt-parser": "~2.0", - "creof/wkb-parser": "~2.0" + "creof/wkb-parser": "~2.0", + "doctrine/orm": ">2.7" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.16", diff --git a/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php b/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php index 09afb184..e52ac1a9 100644 --- a/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php +++ b/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT @@ -39,77 +40,70 @@ abstract class AbstractPlatform implements PlatformInterface { /** - * @param AbstractSpatialType $type - * @param string $sqlExpr + * @param string $sqlExpr * * @return GeometryInterface */ - public function convertStringToPHPValue(AbstractSpatialType $type, $sqlExpr) + public function convertBinaryToPHPValue(AbstractSpatialType $type, $sqlExpr) { - $parser = new StringParser($sqlExpr); + $parser = new BinaryParser($sqlExpr); return $this->newObjectFromValue($type, $parser->parse()); } /** - * @param AbstractSpatialType $type - * @param string $sqlExpr + * @param string $sqlExpr * * @return GeometryInterface */ - public function convertBinaryToPHPValue(AbstractSpatialType $type, $sqlExpr) + public function convertStringToPHPValue(AbstractSpatialType $type, $sqlExpr) { - $parser = new BinaryParser($sqlExpr); + $parser = new StringParser($sqlExpr); return $this->newObjectFromValue($type, $parser->parse()); } /** - * @param AbstractSpatialType $type - * @param GeometryInterface $value - * * @return string */ public function convertToDatabaseValue(AbstractSpatialType $type, GeometryInterface $value) { - return sprintf('%s(%s)', strtoupper($value->getType()), $value); + return sprintf('%s(%s)', mb_strtoupper($value->getType()), $value); } /** * Get an array of database types that map to this Doctrine type. * - * @param AbstractSpatialType $type - * * @return string[] */ public function getMappedDatabaseTypes(AbstractSpatialType $type) { - $sqlType = strtolower($type->getSQLType()); + $sqlType = mb_strtolower($type->getSQLType()); - if ($type instanceof GeographyType && $sqlType !== 'geography') { + if ($type instanceof GeographyType && 'geography' !== $sqlType) { $sqlType = sprintf('geography(%s)', $sqlType); } - return array($sqlType); + return [$sqlType]; } /** - * Create spatial object from parsed value + * Create spatial object from parsed value. * - * @param AbstractSpatialType $type - * @param array $value + * @param array $value * - * @return GeometryInterface * @throws \CrEOF\Spatial\Exception\InvalidValueException + * + * @return GeometryInterface */ private function newObjectFromValue(AbstractSpatialType $type, $value) { $typeFamily = $type->getTypeFamily(); - $typeName = strtoupper($value['type']); + $typeName = mb_strtoupper($value['type']); $constName = sprintf('CrEOF\Spatial\PHP\Types\Geometry\GeometryInterface::%s', $typeName); - if (! defined($constName)) { + if (!defined($constName)) { // @codeCoverageIgnoreStart throw new InvalidValueException(sprintf('Unsupported %s type "%s".', $typeFamily, $typeName)); // @codeCoverageIgnoreEnd diff --git a/lib/CrEOF/Spatial/DBAL/Platform/MySql.php b/lib/CrEOF/Spatial/DBAL/Platform/MySql.php index 4444fca4..8caabaa1 100644 --- a/lib/CrEOF/Spatial/DBAL/Platform/MySql.php +++ b/lib/CrEOF/Spatial/DBAL/Platform/MySql.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT @@ -35,24 +36,17 @@ class MySql extends AbstractPlatform { /** - * Gets the SQL declaration snippet for a field of this type. - * - * @param array $fieldDeclaration + * @param string $sqlExpr * * @return string */ - public function getSQLDeclaration(array $fieldDeclaration) + public function convertToDatabaseValueSQL(AbstractSpatialType $type, $sqlExpr) { - if ($fieldDeclaration['type']->getSQLType() === GeographyInterface::GEOGRAPHY) { - return 'GEOMETRY'; - } - - return strtoupper($fieldDeclaration['type']->getSQLType()); + return sprintf('GeomFromText(%s)', $sqlExpr); } /** - * @param AbstractSpatialType $type - * @param string $sqlExpr + * @param string $sqlExpr * * @return string */ @@ -62,13 +56,16 @@ public function convertToPHPValueSQL(AbstractSpatialType $type, $sqlExpr) } /** - * @param AbstractSpatialType $type - * @param string $sqlExpr + * Gets the SQL declaration snippet for a field of this type. * * @return string */ - public function convertToDatabaseValueSQL(AbstractSpatialType $type, $sqlExpr) + public function getSQLDeclaration(array $fieldDeclaration) { - return sprintf('GeomFromText(%s)', $sqlExpr); + if (GeographyInterface::GEOGRAPHY === $fieldDeclaration['type']->getSQLType()) { + return 'GEOMETRY'; + } + + return mb_strtoupper($fieldDeclaration['type']->getSQLType()); } } diff --git a/lib/CrEOF/Spatial/DBAL/Platform/PlatformInterface.php b/lib/CrEOF/Spatial/DBAL/Platform/PlatformInterface.php index 9cf54970..943143f3 100644 --- a/lib/CrEOF/Spatial/DBAL/Platform/PlatformInterface.php +++ b/lib/CrEOF/Spatial/DBAL/Platform/PlatformInterface.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT @@ -35,58 +36,47 @@ interface PlatformInterface { /** - * @param AbstractSpatialType $type - * @param string $sqlExpr + * @param string $sqlExpr * * @return GeometryInterface */ public function convertBinaryToPHPValue(AbstractSpatialType $type, $sqlExpr); /** - * @param AbstractSpatialType $type - * @param string $sqlExpr + * @param string $sqlExpr * * @return GeometryInterface */ public function convertStringToPHPValue(AbstractSpatialType $type, $sqlExpr); /** - * @param AbstractSpatialType $type - * @param GeometryInterface $value - * * @return string */ public function convertToDatabaseValue(AbstractSpatialType $type, GeometryInterface $value); /** - * @param AbstractSpatialType $type - * @param string $sqlExpr + * @param string $sqlExpr * * @return string */ public function convertToDatabaseValueSQL(AbstractSpatialType $type, $sqlExpr); /** - * @param AbstractSpatialType $type - * @param string $sqlExpr + * @param string $sqlExpr * * @return string */ public function convertToPHPValueSQL(AbstractSpatialType $type, $sqlExpr); /** - * Gets the SQL declaration snippet for a field of this type. - * - * @param array $fieldDeclaration - * - * @return string + * @return string[] */ - public function getSQLDeclaration(array $fieldDeclaration); + public function getMappedDatabaseTypes(AbstractSpatialType $type); /** - * @param AbstractSpatialType $type + * Gets the SQL declaration snippet for a field of this type. * - * @return string[] + * @return string */ - public function getMappedDatabaseTypes(AbstractSpatialType $type); + public function getSQLDeclaration(array $fieldDeclaration); } diff --git a/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php b/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php index c4ef2827..007f2ab1 100644 --- a/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php +++ b/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT */ class PostgreSql extends AbstractPlatform { - const DEFAULT_SRID = 4326; + public const DEFAULT_SRID = 4326; /** - * Gets the SQL declaration snippet for a field of this type. + * @param string $sqlExpr * - * @param array $fieldDeclaration + * @throws InvalidValueException * - * @return string + * @return GeometryInterface */ - public function getSQLDeclaration(array $fieldDeclaration) + public function convertBinaryToPHPValue(AbstractSpatialType $type, $sqlExpr) { - $typeFamily = $fieldDeclaration['type']->getTypeFamily(); - $sqlType = $fieldDeclaration['type']->getSQLType(); - - if ($typeFamily === $sqlType) { - return $sqlType; + if (!is_resource($sqlExpr)) { + throw new InvalidValueException(sprintf('Invalid resource value "%s"', $sqlExpr)); } - if (isset($fieldDeclaration['srid'])) { - return sprintf('%s(%s,%d)', $typeFamily, $sqlType, $fieldDeclaration['srid']); - } + $sqlExpr = stream_get_contents($sqlExpr); - return sprintf('%s(%s)', $typeFamily, $sqlType); + return parent::convertBinaryToPHPValue($type, $sqlExpr); } /** - * @param AbstractSpatialType $type - * @param string $sqlExpr - * * @return string */ - public function convertToPHPValueSQL(AbstractSpatialType $type, $sqlExpr) + public function convertToDatabaseValue(AbstractSpatialType $type, GeometryInterface $value) { - if ($type instanceof GeographyType) { - return sprintf('ST_AsEWKT(%s)', $sqlExpr); + $sridSQL = null; + + if ($type instanceof GeographyType && null === $value->getSrid()) { + $value->setSrid(self::DEFAULT_SRID); } - return sprintf('ST_AsEWKB(%s)', $sqlExpr); + if (null !== ($srid = $value->getSrid()) || $type instanceof GeographyType) { + $sridSQL = sprintf('SRID=%d;', $srid); + } + + return sprintf('%s%s', $sridSQL, parent::convertToDatabaseValue($type, $value)); } /** - * @param AbstractSpatialType $type - * @param string $sqlExpr + * @param string $sqlExpr * * @return string */ @@ -92,41 +90,37 @@ public function convertToDatabaseValueSQL(AbstractSpatialType $type, $sqlExpr) } /** - * @param AbstractSpatialType $type - * @param string $sqlExpr + * @param string $sqlExpr * - * @return GeometryInterface - * @throws InvalidValueException + * @return string */ - public function convertBinaryToPHPValue(AbstractSpatialType $type, $sqlExpr) + public function convertToPHPValueSQL(AbstractSpatialType $type, $sqlExpr) { - if (! is_resource($sqlExpr)) { - throw new InvalidValueException(sprintf('Invalid resource value "%s"', $sqlExpr)); + if ($type instanceof GeographyType) { + return sprintf('ST_AsEWKT(%s)', $sqlExpr); } - $sqlExpr = stream_get_contents($sqlExpr); - - return parent::convertBinaryToPHPValue($type, $sqlExpr); + return sprintf('ST_AsEWKB(%s)', $sqlExpr); } /** - * @param AbstractSpatialType $type - * @param GeometryInterface $value + * Gets the SQL declaration snippet for a field of this type. * * @return string */ - public function convertToDatabaseValue(AbstractSpatialType $type, GeometryInterface $value) + public function getSQLDeclaration(array $fieldDeclaration) { - $sridSQL = null; + $typeFamily = $fieldDeclaration['type']->getTypeFamily(); + $sqlType = $fieldDeclaration['type']->getSQLType(); - if ($type instanceof GeographyType && null === $value->getSrid()) { - $value->setSrid(self::DEFAULT_SRID); + if ($typeFamily === $sqlType) { + return $sqlType; } - if (($srid = $value->getSrid()) !== null || $type instanceof GeographyType) { - $sridSQL = sprintf('SRID=%d;', $srid); + if (isset($fieldDeclaration['srid'])) { + return sprintf('%s(%s,%d)', $typeFamily, $sqlType, $fieldDeclaration['srid']); } - return sprintf('%s%s', $sridSQL, parent::convertToDatabaseValue($type, $value)); + return sprintf('%s(%s)', $typeFamily, $sqlType); } } diff --git a/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php b/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php index 8ff00e3d..1c3aa0fb 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT */ abstract class AbstractSpatialType extends Type { - const PLATFORM_MYSQL = 'MySql'; - const PLATFORM_POSTGRESQL = 'PostgreSql'; - - /** - * @return string - */ - public function getTypeFamily() - { - return $this instanceof GeographyType ? GeographyInterface::GEOGRAPHY : GeometryInterface::GEOMETRY; - } - - /** - * Gets the SQL name of this type. - * - * @return string - */ - public function getSQLType() - { - $class = get_class($this); - $start = strrpos($class, '\\') + 1; - $len = strlen($class) - $start - 4; - - return substr($class, strrpos($class, '\\') + 1, $len); - } + public const PLATFORM_MYSQL = 'MySql'; + public const PLATFORM_POSTGRESQL = 'PostgreSql'; /** * @return bool @@ -75,44 +54,30 @@ public function canRequireSQLConversion() /** * Converts a value from its PHP representation to its database representation of this type. * - * @param mixed $value - * @param AbstractPlatform $platform + * @param mixed $value * - * @return mixed * @throws InvalidValueException * @throws UnsupportedPlatformException + * + * @return mixed */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { - if ($value === null) { + if (null === $value) { return $value; } - if (! ($value instanceof GeometryInterface)) { + if (!($value instanceof GeometryInterface)) { throw new InvalidValueException('Geometry column values must implement GeometryInterface'); } return $this->getSpatialPlatform($platform)->convertToDatabaseValue($this, $value); } - /** - * Modifies the SQL expression (identifier, parameter) to convert to a PHP value. - * - * @param string $sqlExpr - * @param AbstractPlatform $platform - * - * @return string - */ - public function convertToPHPValueSQL($sqlExpr, $platform) - { - return $this->getSpatialPlatform($platform)->convertToPHPValueSQL($this, $sqlExpr); - } - /** * Modifies the SQL expression (identifier, parameter) to convert to a database value. * - * @param string $sqlExpr - * @param AbstractPlatform $platform + * @param string $sqlExpr * * @return string */ @@ -124,8 +89,7 @@ public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform) /** * Converts a value from its database representation to its PHP representation of this type. * - * @param mixed $value - * @param AbstractPlatform $platform + * @param mixed $value * * @return mixed */ @@ -142,6 +106,29 @@ public function convertToPHPValue($value, AbstractPlatform $platform) return $this->getSpatialPlatform($platform)->convertBinaryToPHPValue($this, $value); } + /** + * Modifies the SQL expression (identifier, parameter) to convert to a PHP value. + * + * @param string $sqlExpr + * @param AbstractPlatform $platform + * + * @return string + */ + public function convertToPHPValueSQL($sqlExpr, $platform) + { + return $this->getSpatialPlatform($platform)->convertToPHPValueSQL($this, $sqlExpr); + } + + /** + * Get an array of database types that map to this Doctrine type. + * + * @return array + */ + public function getMappedDatabaseTypes(AbstractPlatform $platform) + { + return $this->getSpatialPlatform($platform)->getMappedDatabaseTypes($this); + } + /** * Gets the name of this type. * @@ -155,9 +142,6 @@ public function getName() /** * Gets the SQL declaration snippet for a field of this type. * - * @param array $fieldDeclaration - * @param AbstractPlatform $platform - * * @return string */ public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) @@ -166,15 +150,25 @@ public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $pla } /** - * Get an array of database types that map to this Doctrine type. - * - * @param AbstractPlatform $platform + * Gets the SQL name of this type. * - * @return array + * @return string */ - public function getMappedDatabaseTypes(AbstractPlatform $platform) + public function getSQLType() { - return $this->getSpatialPlatform($platform)->getMappedDatabaseTypes($this); + $class = get_class($this); + $start = mb_strrpos($class, '\\') + 1; + $len = mb_strlen($class) - $start - 4; + + return mb_substr($class, mb_strrpos($class, '\\') + 1, $len); + } + + /** + * @return string + */ + public function getTypeFamily() + { + return $this instanceof GeographyType ? GeographyInterface::GEOGRAPHY : GeometryInterface::GEOMETRY; } /** @@ -183,8 +177,6 @@ public function getMappedDatabaseTypes(AbstractPlatform $platform) * one of those types as commented, which will have Doctrine use an SQL * comment to typehint the actual Doctrine Type. * - * @param AbstractPlatform $platform - * * @return bool */ public function requiresSQLCommentHint(AbstractPlatform $platform) @@ -194,21 +186,20 @@ public function requiresSQLCommentHint(AbstractPlatform $platform) } /** - * @param AbstractPlatform $platform + * @throws UnsupportedPlatformException * * @return PlatformInterface - * @throws UnsupportedPlatformException */ private function getSpatialPlatform(AbstractPlatform $platform) { - $const = sprintf('self::PLATFORM_%s', strtoupper($platform->getName())); + $const = sprintf('self::PLATFORM_%s', mb_strtoupper($platform->getName())); - if (! defined($const)) { + if (!defined($const)) { throw new UnsupportedPlatformException(sprintf('DBAL platform "%s" is not currently supported.', $platform->getName())); } $class = sprintf('CrEOF\Spatial\DBAL\Platform\%s', constant($const)); - return new $class; + return new $class(); } } diff --git a/lib/CrEOF/Spatial/DBAL/Types/Geography/LineStringType.php b/lib/CrEOF/Spatial/DBAL/Types/Geography/LineStringType.php index 043f5bc5..3bef9965 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/Geography/LineStringType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/Geography/LineStringType.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT */ class LineStringType extends GeographyType { - } diff --git a/lib/CrEOF/Spatial/DBAL/Types/Geography/PointType.php b/lib/CrEOF/Spatial/DBAL/Types/Geography/PointType.php index 1582ecf1..dfd6bfe3 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/Geography/PointType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/Geography/PointType.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT */ class PointType extends GeographyType { - } diff --git a/lib/CrEOF/Spatial/DBAL/Types/Geography/PolygonType.php b/lib/CrEOF/Spatial/DBAL/Types/Geography/PolygonType.php index d3c9542b..0a12b747 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/Geography/PolygonType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/Geography/PolygonType.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT */ class PolygonType extends GeographyType { - } diff --git a/lib/CrEOF/Spatial/DBAL/Types/GeographyType.php b/lib/CrEOF/Spatial/DBAL/Types/GeographyType.php index 8dc4b207..1992ea47 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/GeographyType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/GeographyType.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT */ class GeographyType extends AbstractSpatialType { - } diff --git a/lib/CrEOF/Spatial/DBAL/Types/Geometry/LineStringType.php b/lib/CrEOF/Spatial/DBAL/Types/Geometry/LineStringType.php index 5ebf63b1..d3c43bf5 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/Geometry/LineStringType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/Geometry/LineStringType.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT */ class LineStringType extends GeometryType { - } diff --git a/lib/CrEOF/Spatial/DBAL/Types/Geometry/MultiPolygonType.php b/lib/CrEOF/Spatial/DBAL/Types/Geometry/MultiPolygonType.php index 1883bcba..6655f1c9 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/Geometry/MultiPolygonType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/Geometry/MultiPolygonType.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT */ class MultiPolygonType extends GeometryType { - } diff --git a/lib/CrEOF/Spatial/DBAL/Types/Geometry/PointType.php b/lib/CrEOF/Spatial/DBAL/Types/Geometry/PointType.php index 980e121f..af0df088 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/Geometry/PointType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/Geometry/PointType.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT */ class PointType extends GeometryType { - } diff --git a/lib/CrEOF/Spatial/DBAL/Types/Geometry/PolygonType.php b/lib/CrEOF/Spatial/DBAL/Types/Geometry/PolygonType.php index 963f88f6..72fb86fd 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/Geometry/PolygonType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/Geometry/PolygonType.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT */ class PolygonType extends GeometryType { - } diff --git a/lib/CrEOF/Spatial/DBAL/Types/GeometryType.php b/lib/CrEOF/Spatial/DBAL/Types/GeometryType.php index 5534b665..7183fe4e 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/GeometryType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/GeometryType.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT */ class GeometryType extends AbstractSpatialType { - } diff --git a/lib/CrEOF/Spatial/Exception/InvalidValueException.php b/lib/CrEOF/Spatial/Exception/InvalidValueException.php index 5ec11dc4..825cc0c6 100644 --- a/lib/CrEOF/Spatial/Exception/InvalidValueException.php +++ b/lib/CrEOF/Spatial/Exception/InvalidValueException.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT */ class InvalidValueException extends Exception { - } diff --git a/lib/CrEOF/Spatial/Exception/UnsupportedPlatformException.php b/lib/CrEOF/Spatial/Exception/UnsupportedPlatformException.php index 1f85c5ee..d9fdcff7 100644 --- a/lib/CrEOF/Spatial/Exception/UnsupportedPlatformException.php +++ b/lib/CrEOF/Spatial/Exception/UnsupportedPlatformException.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT */ class UnsupportedPlatformException extends Exception { - } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php index cd8b0d3f..e1233209 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT @@ -45,14 +46,14 @@ abstract class AbstractSpatialDQLFunction extends FunctionNode protected $functionName; /** - * @var array + * @var Node[] */ - protected $platforms = array(); + protected $geomExpr = []; /** - * @var Node[] + * @var int */ - protected $geomExpr = array(); + protected $maxGeomExpr; /** * @var int @@ -60,13 +61,25 @@ abstract class AbstractSpatialDQLFunction extends FunctionNode protected $minGeomExpr; /** - * @var int + * @var array */ - protected $maxGeomExpr; + protected $platforms = []; /** - * @param Parser $parser + * @return string */ + public function getSql(SqlWalker $sqlWalker) + { + $this->validatePlatform($sqlWalker->getConnection()->getDatabasePlatform()); + + $arguments = []; + foreach ($this->geomExpr as $expression) { + $arguments[] = $expression->dispatch($sqlWalker); + } + + return sprintf('%s(%s)', $this->functionName, implode(', ', $arguments)); + } + public function parse(Parser $parser) { $lexer = $parser->getLexer(); @@ -76,7 +89,7 @@ public function parse(Parser $parser) $this->geomExpr[] = $parser->ArithmeticPrimary(); - while (count($this->geomExpr) < $this->minGeomExpr || (($this->maxGeomExpr === null || count($this->geomExpr) < $this->maxGeomExpr) && $lexer->lookahead['type'] != Lexer::T_CLOSE_PARENTHESIS)) { + while (count($this->geomExpr) < $this->minGeomExpr || ((null === $this->maxGeomExpr || count($this->geomExpr) < $this->maxGeomExpr) && Lexer::T_CLOSE_PARENTHESIS != $lexer->lookahead['type'])) { $parser->match(Lexer::T_COMMA); $this->geomExpr[] = $parser->ArithmeticPrimary(); @@ -86,25 +99,6 @@ public function parse(Parser $parser) } /** - * @param SqlWalker $sqlWalker - * - * @return string - */ - public function getSql(SqlWalker $sqlWalker) - { - $this->validatePlatform($sqlWalker->getConnection()->getDatabasePlatform()); - - $arguments = array(); - foreach ($this->geomExpr as $expression) { - $arguments[] = $expression->dispatch($sqlWalker); - } - - return sprintf('%s(%s)', $this->functionName, implode(', ', $arguments)); - } - - /** - * @param AbstractPlatform $platform - * * @throws UnsupportedPlatformException */ protected function validatePlatform(AbstractPlatform $platform) diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Area.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Area.php index 8ba84155..940ea9a7 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Area.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Area.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class Area extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'Area'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php index 2c1943d8..9044219b 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class AsBinary extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { - protected $platforms = array('mysql'); - protected $functionName = 'AsBinary'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsText.php index 6649e8eb..e0af9d9d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsText.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class AsText extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { - protected $platforms = array('mysql'); - protected $functionName = 'AsText'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Buffer.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Buffer.php index 89ede61b..5b63d87e 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Buffer.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Buffer.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class Buffer extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'Buffer'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; -} + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; +} diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Centroid.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Centroid.php index a55e3369..b556cbc3 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Centroid.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Centroid.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class Centroid extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'Centroid'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Contains.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Contains.php index c4822f0e..74c55747 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Contains.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Contains.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class Contains extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'Contains'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Crosses.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Crosses.php index 2925436c..eea40c64 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Crosses.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Crosses.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class Crosses extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'Crosses'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Dimension.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Dimension.php index 662f614e..509b2f75 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Dimension.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Dimension.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class Dimension extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'Dimension'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Disjoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Disjoint.php index eaa840c8..c8edffcd 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Disjoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Disjoint.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class Disjoint extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'Disjoint'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Distance.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Distance.php index 6a8ed183..f3bfc1b1 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Distance.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Distance.php @@ -1,7 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ -class Distance extends AbstractSpatialDQLFunction { - - protected $platforms = array('mysql'); +class Distance extends AbstractSpatialDQLFunction +{ protected $functionName = 'Distance'; - protected $minGeomExpr = 2; protected $maxGeomExpr = 2; - + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/DistanceFromMultyLine.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/DistanceFromMultyLine.php index 4fa73678..f48df292 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/DistanceFromMultyLine.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/DistanceFromMultyLine.php @@ -1,21 +1,42 @@ - * @license http://mdhheydari.mit-license.org MIT */ class EndPoint extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'EndPoint'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Envelope.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Envelope.php index 8b14bc59..61930196 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Envelope.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Envelope.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class Envelope extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'Envelope'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Equals.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Equals.php index 5748ba9d..b4d60597 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Equals.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Equals.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class Equals extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'Equals'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/ExteriorRing.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/ExteriorRing.php index a5f6be47..ddc952d0 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/ExteriorRing.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/ExteriorRing.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class ExteriorRing extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'ExteriorRing'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GLength.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GLength.php index 8eed83b5..3d8dd91e 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GLength.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GLength.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class GLength extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'GLength'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeodistPt.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeodistPt.php index f029799c..c95860c2 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeodistPt.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeodistPt.php @@ -1,21 +1,42 @@ - * @license http://dlambert.mit-license.org MIT */ class GeomFromText extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'GeomFromText'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeometryType.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeometryType.php index fc4a89ee..e68a1d4a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeometryType.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeometryType.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class GeometryType extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'GeometryType'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/InteriorRingN.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/InteriorRingN.php index 48bfa683..d2efa49a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/InteriorRingN.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/InteriorRingN.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class InteriorRingN extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'InteriorRingN'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Intersects.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Intersects.php index f139cb1f..32565b30 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Intersects.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Intersects.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class Intersects extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'Intersects'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsClosed.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsClosed.php index 5dd17d55..85965b11 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsClosed.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsClosed.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class IsClosed extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'IsClosed'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsEmpty.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsEmpty.php index 0900d5c6..f7cd3799 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsEmpty.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsEmpty.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class IsEmpty extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'IsEmpty'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsSimple.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsSimple.php index b70370c5..c775a71a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsSimple.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsSimple.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class IsSimple extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'IsSimple'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineString.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineString.php index d6998fc9..16bc1e48 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineString.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineString.php @@ -1,6 +1,7 @@ * @license http://opensource.org/licenses/MIT MIT */ class LineString extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'LineString'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineStringFromWKB.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineStringFromWKB.php index b2aa1239..0481babf 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineStringFromWKB.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineStringFromWKB.php @@ -1,5 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class MBRContains extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'MBRContains'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRDisjoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRDisjoint.php index 42a97ff5..a06adf23 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRDisjoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRDisjoint.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class MBRDisjoint extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'MBRDisjoint'; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBREqual.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBREqual.php index bcf3025d..cf662033 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBREqual.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBREqual.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class MBREqual extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'MBREqual'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRIntersects.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRIntersects.php index 86183242..2743be25 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRIntersects.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRIntersects.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class MBRIntersects extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'MBRIntersects'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBROverlaps.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBROverlaps.php index 50e6bdcc..d0360f5a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBROverlaps.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBROverlaps.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class MBROverlaps extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'MBROverlaps'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRTouches.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRTouches.php index 509ade41..24f444f9 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRTouches.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRTouches.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class MBRTouches extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'MBRTouches'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRWithin.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRWithin.php index 3cbcf91d..574e0d23 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRWithin.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRWithin.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class MBRWithin extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'MBRWithin'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumInteriorRings.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumInteriorRings.php index b0155d6d..9e4d71cc 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumInteriorRings.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumInteriorRings.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class NumInteriorRings extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'NumInteriorRings'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumPoints.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumPoints.php index 360b46aa..80a880bd 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumPoints.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumPoints.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class NumPoints extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'NumPoints'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Overlaps.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Overlaps.php index 4df13fc4..218b2bf1 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Overlaps.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Overlaps.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class Overlaps extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'Overlaps'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Point.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Point.php index 4181b242..a261ed0e 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Point.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Point.php @@ -1,5 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class PointN extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'PointN'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/SRID.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/SRID.php index 99943e50..75c5aa5f 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/SRID.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/SRID.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class SRID extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'SRID'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STBuffer.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STBuffer.php index d9e5df18..d7053700 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STBuffer.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STBuffer.php @@ -1,7 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ -class STContains extends AbstractSpatialDQLFunction { - - protected $platforms = array('mysql'); +class STContains extends AbstractSpatialDQLFunction +{ protected $functionName = 'ST_Contains'; - protected $minGeomExpr = 2; protected $maxGeomExpr = 2; - + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STCrosses.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STCrosses.php index 484424ed..f903c2c2 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STCrosses.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STCrosses.php @@ -1,7 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ -class STCrosses extends AbstractSpatialDQLFunction { - - protected $platforms = array('mysql'); +class STCrosses extends AbstractSpatialDQLFunction +{ protected $functionName = 'ST_Crosses'; - protected $minGeomExpr = 2; protected $maxGeomExpr = 2; - + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDisjoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDisjoint.php index a055dcac..28f20b4a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDisjoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDisjoint.php @@ -1,7 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ -class STDisjoint extends AbstractSpatialDQLFunction { - - protected $platforms = array('mysql'); +class STDisjoint extends AbstractSpatialDQLFunction +{ protected $functionName = 'ST_Disjoint'; - protected $minGeomExpr = 2; protected $maxGeomExpr = 2; - + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistance.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistance.php index 04e6a561..035f8c05 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistance.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistance.php @@ -1,7 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ -class STDistance extends AbstractSpatialDQLFunction { - - protected $platforms = array('mysql'); +class STDistance extends AbstractSpatialDQLFunction +{ protected $functionName = 'ST_Distance'; - protected $minGeomExpr = 2; protected $maxGeomExpr = 2; - + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STEquals.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STEquals.php index 0e9bcabd..0591b702 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STEquals.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STEquals.php @@ -1,7 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ -class STEquals extends AbstractSpatialDQLFunction { - - protected $platforms = array('mysql'); +class STEquals extends AbstractSpatialDQLFunction +{ protected $functionName = 'ST_Equals'; - protected $minGeomExpr = 2; protected $maxGeomExpr = 2; - + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STIntersects.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STIntersects.php index 0ca84ecf..b45d51de 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STIntersects.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STIntersects.php @@ -1,7 +1,7 @@ * @license http://mit-license.org MIT */ -class STOverlaps extends AbstractSpatialDQLFunction { - - protected $platforms = array('mysql'); +class STOverlaps extends AbstractSpatialDQLFunction +{ protected $functionName = 'ST_Overlaps'; - protected $minGeomExpr = 2; protected $maxGeomExpr = 2; - + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STTouches.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STTouches.php index 6a0f5c8a..62b42827 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STTouches.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STTouches.php @@ -1,7 +1,7 @@ * @license http://mit-license.org MIT */ -class STTouches extends AbstractSpatialDQLFunction { - - protected $platforms = array('mysql'); +class STTouches extends AbstractSpatialDQLFunction +{ protected $functionName = 'ST_Touches'; - protected $minGeomExpr = 2; protected $maxGeomExpr = 2; - + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STWithin.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STWithin.php index 074a6d1b..6315476d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STWithin.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STWithin.php @@ -1,7 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ -class STWithin extends AbstractSpatialDQLFunction { - - protected $platforms = array('mysql'); +class STWithin extends AbstractSpatialDQLFunction +{ protected $functionName = 'ST_Within'; - protected $minGeomExpr = 2; protected $maxGeomExpr = 2; - + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/StartPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/StartPoint.php index c446cb0a..2a2dfab9 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/StartPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/StartPoint.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class StartPoint extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'StartPoint'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Touches.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Touches.php index f7d6f75c..2f2a44ba 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Touches.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Touches.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class Touches extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'Touches'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Within.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Within.php index 6daf07c4..68229147 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Within.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Within.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class Within extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'Within'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/X.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/X.php index 3df16e6e..5da80048 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/X.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/X.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class X extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'X'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Y.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Y.php index 39d592e2..3b36b421 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Y.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Y.php @@ -1,7 +1,7 @@ * @license http://mdhheydari.mit-license.org MIT */ class Y extends AbstractSpatialDQLFunction { - protected $platforms = array('mysql'); - protected $functionName = 'Y'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php index 7899bf6f..97b99ae0 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class Geometry extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'geometry'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STArea.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STArea.php index a3339fa6..c5fb8bfe 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STArea.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STArea.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STArea extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Area'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsBinary.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsBinary.php index f4be365d..aa2aa1a6 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsBinary.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsBinary.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STAsBinary extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_AsBinary'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsGeoJson.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsGeoJson.php index 06fc116e..c41d7161 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsGeoJson.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsGeoJson.php @@ -1,6 +1,7 @@ * @license http://mit-license.org MIT */ class STAsGeoJson extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_AsGeoJson'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsText.php index cef89c14..3c0c1358 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsText.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STAsText extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_AsText'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAzimuth.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAzimuth.php index c6cff74f..7e68de80 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAzimuth.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAzimuth.php @@ -1,6 +1,7 @@ * @license http:// mit-license.org MIT */ class STAzimuth extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Azimuth'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBoundary.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBoundary.php index 047f1c3f..61ccdfdf 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBoundary.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBoundary.php @@ -1,6 +1,7 @@ * @license http://mit-license.org MIT */ class STBoundary extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Boundary'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBuffer.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBuffer.php index 2be385bd..9e62a63a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBuffer.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBuffer.php @@ -1,19 +1,40 @@ * @license http://dlambert.mit-license.org MIT */ class STCentroid extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Centroid'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STClosestPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STClosestPoint.php index c101ad8b..04982ef1 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STClosestPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STClosestPoint.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STClosestPoint extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_ClosestPoint'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php index c6d9de83..d8e82f54 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STCollect extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Collect'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContains.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContains.php index afa6145a..f9ca3fd6 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContains.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContains.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STContains extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Contains'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContainsProperly.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContainsProperly.php index 0e202678..ff971dff 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContainsProperly.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContainsProperly.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STContainsProperly extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_ContainsProperly'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCoveredBy.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCoveredBy.php index 0555363e..aa3b3941 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCoveredBy.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCoveredBy.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STCoveredBy extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_CoveredBy'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCovers.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCovers.php index aa77742d..2239b900 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCovers.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCovers.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STCovers extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Covers'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCrosses.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCrosses.php index 64c62690..c0ba9ee1 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCrosses.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCrosses.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STCrosses extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Crosses'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDWithin.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDWithin.php index 63950056..876f7be9 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDWithin.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDWithin.php @@ -1,6 +1,7 @@ * @license http:// mit-license.org MIT */ class STDifference extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Difference'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDisjoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDisjoint.php index ad0ee216..c46ab635 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDisjoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDisjoint.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STDisjoint extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Disjoint'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistance.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistance.php index d72b6a15..467b2663 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistance.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistance.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STDistance extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Distance'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 3; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistanceSphere.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistanceSphere.php index ac4ff382..d67ed707 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistanceSphere.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistanceSphere.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STDistanceSphere extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Distance_Sphere'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEndPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEndPoint.php index 782925a8..e9da13de 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEndPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEndPoint.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STEndPoint extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_EndPoint'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEnvelope.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEnvelope.php index 50b0c3f8..f37beaf4 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEnvelope.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEnvelope.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STEnvelope extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Envelope'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExpand.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExpand.php index 35eb7e8c..93cb10fb 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExpand.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExpand.php @@ -1,19 +1,40 @@ * @license http://mit-license.org MIT */ class STExtent extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Extent'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeographyFromText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeographyFromText.php index d0cb658e..465cab7f 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeographyFromText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeographyFromText.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT */ class STGeographyFromText extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_GeographyFromText'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromEWKT.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromEWKT.php index 8e0a7111..04daef68 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromEWKT.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromEWKT.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT */ class STGeomFromEWKT extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_GeomFromEWKT'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromText.php index 45936b94..4eec7d95 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromText.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STGeomFromText extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_GeomFromText'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeometryN.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeometryN.php index b94b528d..90698ddf 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeometryN.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeometryN.php @@ -1,6 +1,7 @@ * @license http:// mit-license.org MIT */ class STGeometryN extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_GeometryN'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersection.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersection.php index c1b73f2c..942b37f5 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersection.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersection.php @@ -1,6 +1,7 @@ * @license http://mit-license.org MIT */ class STIntersection extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Intersection'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersects.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersects.php index f1d662f2..0b433a90 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersects.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersects.php @@ -1,6 +1,7 @@ * @license http://mit-license.org MIT */ class STIntersects extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Intersects'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLength.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLength.php index 0fe49c48..8678e107 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLength.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLength.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STLength extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Length'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirection.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirection.php index aa753ef6..0ca44369 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirection.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirection.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STLineCrossingDirection extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_LineCrossingDirection'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineInterpolatePoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineInterpolatePoint.php index d8bee82a..2d9d2dae 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineInterpolatePoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineInterpolatePoint.php @@ -1,6 +1,7 @@ * @license http://mit-license.org MIT */ class STLineInterpolatePoint extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Line_Interpolate_Point'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineLocatePoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineLocatePoint.php index 63e21c3d..1bec1639 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineLocatePoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineLocatePoint.php @@ -1,6 +1,7 @@ * @license http://mit-license.org MIT */ class STLineLocatePoint extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Line_Locate_Point'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineSubstring.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineSubstring.php index 2f0f50dd..73a02044 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineSubstring.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineSubstring.php @@ -1,6 +1,7 @@ * @license http://mit-license.org MIT */ class STLineSubstring extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Line_Substring'; - protected $minGeomExpr = 3; - protected $maxGeomExpr = 3; + + protected $minGeomExpr = 3; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeBox2D.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeBox2D.php index 3b8038ab..a9ac7498 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeBox2D.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeBox2D.php @@ -1,6 +1,7 @@ * @license http://mit-license.org MIT */ class STMakeBox2D extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_MakeBox2D'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelope.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelope.php index e1854f45..efbec7c7 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelope.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelope.php @@ -1,7 +1,7 @@ * @license http://mit-license.org MIT */ class STMakeLine extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_MakeLine'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakePoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakePoint.php index bc9b4732..f19f2945 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakePoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakePoint.php @@ -1,6 +1,7 @@ * @license http://mit-license.org MIT */ class STPoint extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Point'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STScale.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STScale.php index b5e3ad30..eb7532d4 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STScale.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STScale.php @@ -1,6 +1,7 @@ * @license http://mit-license.org MIT */ class STScale extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Scale'; - protected $minGeomExpr = 3; - protected $maxGeomExpr = 3; + protected $minGeomExpr = 3; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSetSRID.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSetSRID.php index 0c3f86ac..3771afd7 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSetSRID.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSetSRID.php @@ -1,6 +1,7 @@ * @license http://mit-license.org MIT */ class STSetSRID extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_SetSRID'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSimplify.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSimplify.php index 4904a345..e46cf43d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSimplify.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSimplify.php @@ -1,19 +1,40 @@ geomExpr[] = $parser->ArithmeticFactor(); // 2nd signature - if ($lexer->lookahead['type'] === Lexer::T_COMMA) { + if (Lexer::T_COMMA === $lexer->lookahead['type']) { $parser->match(Lexer::T_COMMA); $this->geomExpr[] = $parser->ArithmeticFactor(); } // 3rd signature - if ($lexer->lookahead['type'] === Lexer::T_COMMA) { + if (Lexer::T_COMMA === $lexer->lookahead['type']) { $parser->match(Lexer::T_COMMA); $this->geomExpr[] = $parser->ArithmeticFactor(); @@ -80,7 +80,7 @@ public function parse(Parser $parser) $this->geomExpr[] = $parser->ArithmeticFactor(); // 4th signature - if ($lexer->lookahead['type'] === Lexer::T_COMMA) { + if (Lexer::T_COMMA === $lexer->lookahead['type']) { // sizeM $parser->match(Lexer::T_COMMA); $this->geomExpr[] = $parser->ArithmeticFactor(); diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSplit.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSplit.php index 1362dc95..54d657d6 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSplit.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSplit.php @@ -1,6 +1,7 @@ * @license http:// mit-license.org MIT */ class STSplit extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Split'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STStartPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STStartPoint.php index 2d2b6174..48c91a97 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STStartPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STStartPoint.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STStartPoint extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_StartPoint'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSummary.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSummary.php index f0f616b8..d60da357 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSummary.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSummary.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class STSummary extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Summary'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTouches.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTouches.php index 0a9ddd98..3be87f57 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTouches.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTouches.php @@ -1,6 +1,7 @@ * @license http://mit-license.org MIT */ class STTouches extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Touches'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTransform.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTransform.php index 2b0ce638..7561335a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTransform.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTransform.php @@ -1,19 +1,40 @@ * @license http:// mit-license.org MIT */ class STTranslate extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Translate'; - protected $minGeomExpr = 3; - protected $maxGeomExpr = 4; + + protected $minGeomExpr = 3; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STUnion.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STUnion.php index 20e9e93f..067e73c5 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STUnion.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STUnion.php @@ -1,6 +1,7 @@ * @license http://mit-license.org MIT */ class STUnion extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Union'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STWithin.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STWithin.php index c13c89c5..3968be82 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STWithin.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STWithin.php @@ -1,6 +1,7 @@ * @license http://mit-license.org MIT */ class STWithin extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Within'; - protected $minGeomExpr = 2; - protected $maxGeomExpr = 2; + + protected $minGeomExpr = 2; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STX.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STX.php index 554f3951..9602c940 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STX.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STX.php @@ -1,6 +1,7 @@ * @license http:// mit-license.org MIT */ class STX extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_X'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STY.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STY.php index af8047cf..f3da97c7 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STY.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STY.php @@ -1,6 +1,7 @@ * @license http:// mit-license.org MIT */ class STY extends AbstractSpatialDQLFunction { - protected $platforms = array('postgresql'); - protected $functionName = 'ST_Y'; - protected $minGeomExpr = 1; - protected $maxGeomExpr = 1; + + protected $minGeomExpr = 1; + protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/ReturnsGeometryInterface.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/ReturnsGeometryInterface.php index a92610ee..d377d48a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/ReturnsGeometryInterface.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/ReturnsGeometryInterface.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ interface ReturnsGeometryInterface { - } diff --git a/lib/CrEOF/Spatial/ORM/Query/GeometryWalker.php b/lib/CrEOF/Spatial/ORM/Query/GeometryWalker.php index a19fe2b3..c50032d5 100644 --- a/lib/CrEOF/Spatial/ORM/Query/GeometryWalker.php +++ b/lib/CrEOF/Spatial/ORM/Query/GeometryWalker.php @@ -1,6 +1,7 @@ expression; - $sql = parent::walkSelectExpression($selectExpression); + $sql = parent::walkSelectExpression($selectExpression); if ($expr instanceof ReturnsGeometryInterface && !$selectExpression->hiddenAliasResultVariable) { - $alias = trim(strrchr($sql, ' ')); + $alias = trim(mb_strrchr($sql, ' ')); $this->rsm->typeMappings[$alias] = 'geometry'; } diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php b/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php index adc5a21e..c4e6d222 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT @@ -40,21 +41,32 @@ abstract class AbstractGeometry implements GeometryInterface protected $srid; /** - * @return array + * @return int|null */ - abstract public function toArray(); + public function getSrid() + { + return $this->srid; + } /** - * @return string + * @param mixed $srid + * + * @return self */ - public function __toString() + public function setSrid($srid) { - $type = strtoupper($this->getType()); - $method = 'toString' . $type; + if (null !== $srid) { + $this->srid = (int) $srid; + } - return $this->$method($this->toArray()); + return $this; } + /** + * @return array + */ + abstract public function toArray(); + /** * @return string */ @@ -62,76 +74,42 @@ public function toJson() { $json['type'] = $this->getType(); $json['coordinates'] = $this->toArray(); - return json_encode($json); - } - /** - * @return null|int - */ - public function getSrid() - { - return $this->srid; + return json_encode($json); } /** - * @param mixed $srid - * - * @return self + * @return string */ - public function setSrid($srid) + protected function getNamespace() { - if ($srid !== null) { - $this->srid = (int) $srid; - } + $class = get_class($this); - return $this; + return mb_substr($class, 0, mb_strrpos($class, '\\') - mb_strlen($class)); } /** - * @param AbstractPoint|array $point + * @param AbstractLineString|AbstractPoint[]|array[] $lineString * - * @return array - * @throws InvalidValueException + * @return array[] */ - protected function validatePointValue($point) + protected function validateLineStringValue($lineString) { - switch (true) { - case ($point instanceof AbstractPoint): - return $point->toArray(); - break; - case (is_array($point) && count($point) == 2 && is_numeric($point[0]) && is_numeric($point[1])): - return array_values($point); - break; - default: - throw new InvalidValueException(sprintf('Invalid %s Point value of type "%s"', $this->getType(), (is_object($point) ? get_class($point) : gettype($point)))); - } + return $this->validateMultiPointValue($lineString); } /** - * @param AbstractLineString|array[] $ring + * @param AbstractLineString[] $lineStrings * - * @return array[] - * @throws InvalidValueException + * @return array */ - protected function validateRingValue($ring) + protected function validateMultiLineStringValue(array $lineStrings) { - switch (true) { - case ($ring instanceof AbstractLineString): - $ring = $ring->toArray(); - break; - case (is_array($ring)): - break; - default: - throw new InvalidValueException(sprintf('Invalid %s LineString value of type "%s"', $this->getType(), (is_object($ring) ? get_class($ring) : gettype($ring)))); - } - - $ring = $this->validateLineStringValue($ring); - - if ($ring[0] !== end($ring)) { - throw new InvalidValueException(sprintf('Invalid polygon, ring "(%s)" is not closed', $this->toStringLineString($ring))); + foreach ($lineStrings as &$lineString) { + $lineString = $this->validateLineStringValue($lineString); } - return $ring; + return $lineStrings; } /** @@ -153,78 +131,109 @@ protected function validateMultiPointValue($points) } /** - * @param AbstractLineString|AbstractPoint[]|array[] $lineString + * @param AbstractPolygon[] $polygons * - * @return array[] + * @return array */ - protected function validateLineStringValue($lineString) + protected function validateMultiPolygonValue(array $polygons) { - return $this->validateMultiPointValue($lineString); + foreach ($polygons as &$polygon) { + if ($polygon instanceof GeometryInterface) { + $polygon = $polygon->toArray(); + } + $polygon = $this->validatePolygonValue($polygon); + } + + return $polygons; } /** - * @param AbstractLineString[] $rings + * @param AbstractPoint|array $point + * + * @throws InvalidValueException * * @return array */ - protected function validatePolygonValue(array $rings) + protected function validatePointValue($point) { - foreach ($rings as &$ring) { - $ring = $this->validateRingValue($ring); + switch (true) { + case $point instanceof AbstractPoint: + return $point->toArray(); + break; + case is_array($point) && 2 == count($point) && is_numeric($point[0]) && is_numeric($point[1]): + return array_values($point); + break; + default: + throw new InvalidValueException(sprintf('Invalid %s Point value of type "%s"', $this->getType(), (is_object($point) ? get_class($point) : gettype($point)))); } - - return $rings; } /** - * @param AbstractPolygon[] $polygons + * @param AbstractLineString[] $rings * * @return array */ - protected function validateMultiPolygonValue(array $polygons) + protected function validatePolygonValue(array $rings) { - foreach ($polygons as &$polygon) { - if ($polygon instanceof GeometryInterface) { - $polygon = $polygon->toArray(); - } - $polygon = $this->validatePolygonValue($polygon); + foreach ($rings as &$ring) { + $ring = $this->validateRingValue($ring); } - return $polygons; + return $rings; } /** - * @param AbstractLineString[] $lineStrings + * @param AbstractLineString|array[] $ring * - * @return array + * @throws InvalidValueException + * + * @return array[] */ - protected function validateMultiLineStringValue(array $lineStrings) + protected function validateRingValue($ring) { - foreach ($lineStrings as &$lineString) { - $lineString = $this->validateLineStringValue($lineString); + switch (true) { + case $ring instanceof AbstractLineString: + $ring = $ring->toArray(); + break; + case is_array($ring): + break; + default: + throw new InvalidValueException(sprintf('Invalid %s LineString value of type "%s"', $this->getType(), (is_object($ring) ? get_class($ring) : gettype($ring)))); } - return $lineStrings; + $ring = $this->validateLineStringValue($ring); + + if ($ring[0] !== end($ring)) { + throw new InvalidValueException(sprintf('Invalid polygon, ring "(%s)" is not closed', $this->toStringLineString($ring))); + } + + return $ring; } /** + * @param array[] $lineString + * * @return string */ - protected function getNamespace() + private function toStringLineString(array $lineString) { - $class = get_class($this); - - return substr($class, 0, strrpos($class, '\\') - strlen($class)); + return $this->toStringMultiPoint($lineString); } /** - * @param array $point + * @param array[] $multiLineString * * @return string */ - private function toStringPoint(array $point) + private function toStringMultiLineString(array $multiLineString) { - return vsprintf('%s %s', $point); + $strings = null; + + foreach ($multiLineString as $lineString) { + $strings[] = '('.$this->toStringLineString($lineString).')'; + } + + return implode(',', $strings); } /** @@ -234,7 +243,7 @@ private function toStringPoint(array $point) */ private function toStringMultiPoint(array $multiPoint) { - $strings = array(); + $strings = []; foreach ($multiPoint as $point) { $strings[] = $this->toStringPoint($point); @@ -244,29 +253,27 @@ private function toStringMultiPoint(array $multiPoint) } /** - * @param array[] $lineString + * @param array[] $multiPolygon * * @return string */ - private function toStringLineString(array $lineString) + private function toStringMultiPolygon(array $multiPolygon) { - return $this->toStringMultiPoint($lineString); + $strings = null; + + foreach ($multiPolygon as $polygon) { + $strings[] = '('.$this->toStringPolygon($polygon).')'; + } + + return implode(',', $strings); } /** - * @param array[] $multiLineString - * * @return string */ - private function toStringMultiLineString(array $multiLineString) + private function toStringPoint(array $point) { - $strings = null; - - foreach ($multiLineString as $lineString) { - $strings[] = '(' . $this->toStringLineString($lineString) . ')'; - } - - return implode(',', $strings); + return vsprintf('%s %s', $point); } /** @@ -280,18 +287,13 @@ private function toStringPolygon(array $polygon) } /** - * @param array[] $multiPolygon - * * @return string */ - private function toStringMultiPolygon(array $multiPolygon) + public function __toString() { - $strings = null; - - foreach ($multiPolygon as $polygon) { - $strings[] = '(' . $this->toStringPolygon($polygon) . ')'; - } + $type = mb_strtoupper($this->getType()); + $method = 'toString'.$type; - return implode(',', $strings); + return $this->{$method}($this->toArray()); } } diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractLineString.php b/lib/CrEOF/Spatial/PHP/Types/AbstractLineString.php index 6118f851..cd7096c4 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractLineString.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractLineString.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiLineString.php b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiLineString.php index 44fe1c56..bd7fc3ec 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiLineString.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiLineString.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT @@ -32,18 +33,19 @@ abstract class AbstractMultiLineString extends AbstractGeometry { /** - * @var array[] $lineStrings + * @var array[] */ - protected $lineStrings = array(); + protected $lineStrings = []; /** * @param AbstractLineString[]|array[] $rings - * @param null|int $srid + * @param int|null $srid */ public function __construct(array $rings, $srid = null) { $this->setLineStrings($rings) - ->setSrid($srid); + ->setSrid($srid) + ; } /** @@ -58,14 +60,30 @@ public function addLineString($lineString) return $this; } + /** + * @param int $index + * + * @return AbstractLineString + */ + public function getLineString($index) + { + if (-1 == $index) { + $index = count($this->lineStrings) - 1; + } + + $lineStringClass = $this->getNamespace().'\LineString'; + + return new $lineStringClass($this->lineStrings[$index], $this->srid); + } + /** * @return AbstractLineString[] */ public function getLineStrings() { - $lineStrings = array(); + $lineStrings = []; - for ($i = 0; $i < count($this->lineStrings); $i++) { + for ($i = 0; $i < count($this->lineStrings); ++$i) { $lineStrings[] = $this->getLineString($i); } @@ -73,19 +91,11 @@ public function getLineStrings() } /** - * @param int $index - * - * @return AbstractLineString + * @return string */ - public function getLineString($index) + public function getType() { - if ($index == -1) { - $index = count($this->lineStrings) - 1; - } - - $lineStringClass = $this->getNamespace() . '\LineString'; - - return new $lineStringClass($this->lineStrings[$index], $this->srid); + return self::MULTILINESTRING; } /** @@ -100,14 +110,6 @@ public function setLineStrings(array $lineStrings) return $this; } - /** - * @return string - */ - public function getType() - { - return self::MULTILINESTRING; - } - /** * @return array[] */ diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPoint.php b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPoint.php index ea21b949..c9d6886d 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPoint.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPoint.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT @@ -34,55 +35,31 @@ abstract class AbstractMultiPoint extends AbstractGeometry { /** - * @var array[] $points + * @var array[] */ - protected $points = array(); + protected $points = []; /** * @param AbstractPoint[]|array[] $points - * @param null|int $srid + * @param int|null $srid */ public function __construct(array $points, $srid = null) { $this->setPoints($points) - ->setSrid($srid); + ->setSrid($srid) + ; } /** * @param AbstractPoint|array $point * - * @return self * @throws InvalidValueException - */ - public function addPoint($point) - { - $this->points[] = $this->validatePointValue($point); - - return $this; - } - - /** - * @return AbstractPoint[] - */ - public function getPoints() - { - $points = array(); - - for ($i = 0; $i < count($this->points); $i++) { - $points[] = $this->getPoint($i); - } - - return $points; - } - - /** - * @param AbstractPoint[]|array[] $points * * @return self */ - public function setPoints($points) + public function addPoint($point) { - $this->points = $this->validateMultiPointValue($points); + $this->points[] = $this->validatePointValue($point); return $this; } @@ -103,11 +80,25 @@ public function getPoint($index) break; } - $pointClass = $this->getNamespace() . '\Point'; + $pointClass = $this->getNamespace().'\Point'; return new $pointClass($point[0], $point[1], $this->srid); } + /** + * @return AbstractPoint[] + */ + public function getPoints() + { + $points = []; + + for ($i = 0; $i < count($this->points); ++$i) { + $points[] = $this->getPoint($i); + } + + return $points; + } + /** * @return string */ @@ -116,6 +107,18 @@ public function getType() return self::MULTIPOINT; } + /** + * @param AbstractPoint[]|array[] $points + * + * @return self + */ + public function setPoints($points) + { + $this->points = $this->validateMultiPointValue($points); + + return $this; + } + /** * @return array[] */ diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPolygon.php b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPolygon.php index 6823c17a..28954404 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPolygon.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPolygon.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT @@ -32,18 +33,19 @@ abstract class AbstractMultiPolygon extends AbstractGeometry { /** - * @var array[] $polygons + * @var array[] */ - protected $polygons = array(); + protected $polygons = []; /** * @param AbstractPolygon[]|array[] $polygons - * @param null|int $srid + * @param int|null $srid */ public function __construct(array $polygons, $srid = null) { $this->setPolygons($polygons) - ->setSrid($srid); + ->setSrid($srid) + ; } /** @@ -58,20 +60,6 @@ public function addPolygon($polygon) return $this; } - /** - * @return AbstractPolygon[] - */ - public function getPolygons() - { - $polygons = array(); - - for ($i = 0; $i < count($this->polygons); $i++) { - $polygons[] = $this->getPolygon($i); - } - - return $polygons; - } - /** * @param int $index * @@ -83,21 +71,23 @@ public function getPolygon($index) $index = count($this->polygons) - 1; } - $polygonClass = $this->getNamespace() . '\Polygon'; + $polygonClass = $this->getNamespace().'\Polygon'; return new $polygonClass($this->polygons[$index], $this->srid); } /** - * @param AbstractPolygon[] $polygons - * - * @return self + * @return AbstractPolygon[] */ - public function setPolygons(array $polygons) + public function getPolygons() { - $this->polygons = $this->validateMultiPolygonValue($polygons); + $polygons = []; - return $this; + for ($i = 0; $i < count($this->polygons); ++$i) { + $polygons[] = $this->getPolygon($i); + } + + return $polygons; } /** @@ -108,6 +98,18 @@ public function getType() return self::MULTIPOLYGON; } + /** + * @param AbstractPolygon[] $polygons + * + * @return self + */ + public function setPolygons(array $polygons) + { + $this->polygons = $this->validateMultiPolygonValue($polygons); + + return $this; + } + /** * @return array[] */ diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php b/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php index cc9d6c4f..9debf706 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php @@ -1,5 +1,6 @@ validateArguments(func_get_args()); - call_user_func_array(array($this, 'construct'), $argv); + call_user_func_array([$this, 'construct'], $argv); } /** - * @param mixed $x - * - * @return self - * @throws InvalidValueException + * @return float */ - public function setX($x) + public function getLatitude() { - $parser = new Parser($x); - - try { - $this->x = (float) $parser->parse(); - } catch (RangeException $e) { - throw new InvalidValueException($e->getMessage(), $e->getCode(), $e->getPrevious()); - } catch (UnexpectedValueException $e) { - throw new InvalidValueException($e->getMessage(), $e->getCode(), $e->getPrevious()); - } - - return $this; + return $this->getY(); } /** * @return float */ - public function getX() + public function getLongitude() { - return $this->x; + return $this->getX(); } /** - * @param mixed $y - * - * @return self - * @throws InvalidValueException + * @return string */ - public function setY($y) + public function getType() { - $parser = new Parser($y); - - try { - $this->y = (float) $parser->parse(); - } catch (RangeException $e) { - throw new InvalidValueException($e->getMessage(), $e->getCode(), $e->getPrevious()); - } catch (UnexpectedValueException $e) { - throw new InvalidValueException($e->getMessage(), $e->getCode(), $e->getPrevious()); - } + return self::POINT; + } - return $this; + /** + * @return float + */ + public function getX() + { + return $this->x; } /** @@ -114,7 +97,6 @@ public function getY() return $this->y; } - /** * @param mixed $latitude * @@ -125,14 +107,6 @@ public function setLatitude($latitude) return $this->setY($latitude); } - /** - * @return float - */ - public function getLatitude() - { - return $this->getY(); - } - /** * @param mixed $longitude * @@ -144,19 +118,47 @@ public function setLongitude($longitude) } /** - * @return float + * @param mixed $x + * + * @throws InvalidValueException + * + * @return self */ - public function getLongitude() + public function setX($x) { - return $this->getX(); + $parser = new Parser($x); + + try { + $this->x = (float) $parser->parse(); + } catch (RangeException $e) { + throw new InvalidValueException($e->getMessage(), $e->getCode(), $e->getPrevious()); + } catch (UnexpectedValueException $e) { + throw new InvalidValueException($e->getMessage(), $e->getCode(), $e->getPrevious()); + } + + return $this; } /** - * @return string + * @param mixed $y + * + * @throws InvalidValueException + * + * @return self */ - public function getType() + public function setY($y) { - return self::POINT; + $parser = new Parser($y); + + try { + $this->y = (float) $parser->parse(); + } catch (RangeException $e) { + throw new InvalidValueException($e->getMessage(), $e->getCode(), $e->getPrevious()); + } catch (UnexpectedValueException $e) { + throw new InvalidValueException($e->getMessage(), $e->getCode(), $e->getPrevious()); + } + + return $this; } /** @@ -164,14 +166,28 @@ public function getType() */ public function toArray() { - return array($this->x, $this->y); + return [$this->x, $this->y]; + } + + /** + * @param int $x + * @param int $y + * @param int|null $srid + */ + protected function construct($x, $y, $srid = null) + { + $this->setX($x) + ->setY($y) + ->setSrid($srid) + ; } /** * @param array $argv * - * @return array * @throws InvalidValueException + * + * @return array */ protected function validateArguments(array $argv = null) { @@ -182,7 +198,7 @@ protected function validateArguments(array $argv = null) } if (2 == $argc) { - if (is_array($argv[0]) && (is_numeric($argv[1]) || is_null($argv[1]) || is_string($argv[1]))) { + if (is_array($argv[0]) && (is_numeric($argv[1]) || null === $argv[1] || is_string($argv[1]))) { $argv[0][] = $argv[1]; return $argv[0]; @@ -194,7 +210,7 @@ protected function validateArguments(array $argv = null) } if (3 == $argc) { - if ((is_numeric($argv[0]) || is_string($argv[0])) && (is_numeric($argv[1]) || is_string($argv[1])) && (is_numeric($argv[2]) || is_null($argv[2]) || is_string($argv[2]))) { + if ((is_numeric($argv[0]) || is_string($argv[0])) && (is_numeric($argv[1]) || is_string($argv[1])) && (is_numeric($argv[2]) || null === $argv[2] || is_string($argv[2]))) { return $argv; } } @@ -209,16 +225,4 @@ protected function validateArguments(array $argv = null) throw new InvalidValueException(sprintf('Invalid parameters passed to %s::%s: %s', get_class($this), '__construct', implode(', ', $argv))); } - - /** - * @param int $x - * @param int $y - * @param null|int $srid - */ - protected function construct($x, $y, $srid = null) - { - $this->setX($x) - ->setY($y) - ->setSrid($srid); - } } diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractPolygon.php b/lib/CrEOF/Spatial/PHP/Types/AbstractPolygon.php index 0acf4bf2..8db61cd8 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractPolygon.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractPolygon.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT @@ -32,23 +33,26 @@ abstract class AbstractPolygon extends AbstractGeometry { /** - * @var array[] $rings + * @var array[] */ - protected $rings = array(); + protected $rings = []; /** * @param AbstractLineString[]|array[] $rings - * @param null|int $srid + * @param int|null $srid */ public function __construct(array $rings, $srid = null) { $this->setRings($rings) - ->setSrid($srid); + ->setSrid($srid) + ; } /** * @param AbstractLineString|array[] $ring * + * @throws \CrEOF\Spatial\Exception\InvalidValueException + * * @return self */ public function addRing($ring) @@ -58,20 +62,6 @@ public function addRing($ring) return $this; } - /** - * @return AbstractLineString[] - */ - public function getRings() - { - $rings = array(); - - for ($i = 0; $i < count($this->rings); $i++) { - $rings[] = $this->getRing($i); - } - - return $rings; - } - /** * @param int $index * @@ -83,21 +73,23 @@ public function getRing($index) $index = count($this->rings) - 1; } - $lineStringClass = $this->getNamespace() . '\LineString'; + $lineStringClass = $this->getNamespace().'\LineString'; return new $lineStringClass($this->rings[$index], $this->srid); } /** - * @param AbstractLineString[] $rings - * - * @return self + * @return AbstractLineString[] */ - public function setRings(array $rings) + public function getRings() { - $this->rings = $this->validatePolygonValue($rings); + $rings = []; - return $this; + for ($i = 0; $i < count($this->rings); ++$i) { + $rings[] = $this->getRing($i); + } + + return $rings; } /** @@ -108,6 +100,18 @@ public function getType() return self::POLYGON; } + /** + * @param AbstractLineString[] $rings + * + * @return self + */ + public function setRings(array $rings) + { + $this->rings = $this->validatePolygonValue($rings); + + return $this; + } + /** * @return array[] */ diff --git a/lib/CrEOF/Spatial/PHP/Types/Geography/GeographyInterface.php b/lib/CrEOF/Spatial/PHP/Types/Geography/GeographyInterface.php index 8223fb94..d50d5aaa 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geography/GeographyInterface.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geography/GeographyInterface.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ interface GeographyInterface { - const GEOGRAPHY = 'Geography'; + public const GEOGRAPHY = 'Geography'; /** * @return int */ public function getSrid(); + /** + * @return string + */ + public function getType(); + /** * @param int $srid * * @return self */ public function setSrid($srid); - - /** - * @return string - */ - public function getType(); } diff --git a/lib/CrEOF/Spatial/PHP/Types/Geography/LineString.php b/lib/CrEOF/Spatial/PHP/Types/Geography/LineString.php index c3b1144a..511d8ebf 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geography/LineString.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geography/LineString.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT */ class LineString extends AbstractLineString implements GeographyInterface { - } diff --git a/lib/CrEOF/Spatial/PHP/Types/Geography/Point.php b/lib/CrEOF/Spatial/PHP/Types/Geography/Point.php index 62b1b9d8..75a88a3e 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geography/Point.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geography/Point.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT @@ -40,8 +41,9 @@ class Point extends AbstractPoint implements GeographyInterface /** * @param mixed $x * - * @return self * @throws InvalidValueException + * + * @return self */ public function setX($x) { @@ -67,8 +69,9 @@ public function setX($x) /** * @param mixed $y * - * @return self * @throws InvalidValueException + * + * @return self */ public function setY($y) { diff --git a/lib/CrEOF/Spatial/PHP/Types/Geography/Polygon.php b/lib/CrEOF/Spatial/PHP/Types/Geography/Polygon.php index a284cebe..ed2eb8d4 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geography/Polygon.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geography/Polygon.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT */ class Polygon extends AbstractPolygon implements GeographyInterface { - } diff --git a/lib/CrEOF/Spatial/PHP/Types/Geometry/GeometryInterface.php b/lib/CrEOF/Spatial/PHP/Types/Geometry/GeometryInterface.php index b6b06f3b..b22ca120 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geometry/GeometryInterface.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geometry/GeometryInterface.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ interface GeometryInterface { - const GEOMETRY = 'Geometry'; - const POINT = 'Point'; - const LINESTRING = 'LineString'; - const POLYGON = 'Polygon'; - const MULTIPOINT = 'MultiPoint'; - const MULTILINESTRING = 'MultiLineString'; - const MULTIPOLYGON = 'MultiPolygon'; - const GEOMETRYCOLLECTION = 'GeometryCollection'; + public const GEOMETRY = 'Geometry'; + public const GEOMETRYCOLLECTION = 'GeometryCollection'; + public const LINESTRING = 'LineString'; + public const MULTILINESTRING = 'MultiLineString'; + public const MULTIPOINT = 'MultiPoint'; + public const MULTIPOLYGON = 'MultiPolygon'; + public const POINT = 'Point'; + public const POLYGON = 'Polygon'; /** * @return string diff --git a/lib/CrEOF/Spatial/PHP/Types/Geometry/LineString.php b/lib/CrEOF/Spatial/PHP/Types/Geometry/LineString.php index f32812e2..ba9c4fd4 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geometry/LineString.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geometry/LineString.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class LineString extends AbstractLineString { - } diff --git a/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiLineString.php b/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiLineString.php index 83338381..5eb7b604 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiLineString.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiLineString.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class MultiLineString extends AbstractMultiLineString { - } diff --git a/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPoint.php b/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPoint.php index 9a813e3d..7d99b1b3 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPoint.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPoint.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class MultiPoint extends AbstractMultiPoint { - } diff --git a/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPolygon.php b/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPolygon.php index 3035922c..9394285f 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPolygon.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPolygon.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class MultiPolygon extends AbstractMultiPolygon { - } diff --git a/lib/CrEOF/Spatial/PHP/Types/Geometry/Point.php b/lib/CrEOF/Spatial/PHP/Types/Geometry/Point.php index 6700ffd0..137626cc 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geometry/Point.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geometry/Point.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class Point extends AbstractPoint { - } diff --git a/lib/CrEOF/Spatial/PHP/Types/Geometry/Polygon.php b/lib/CrEOF/Spatial/PHP/Types/Geometry/Polygon.php index c0d0d5ed..d3ccc522 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geometry/Polygon.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geometry/Polygon.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ class Polygon extends AbstractPolygon { - } diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 835bdec5..6a809ce2 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -4,7 +4,6 @@ xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"> - diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php index 83464185..9d4219e7 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group geometry + * + * @internal + * @coversNothing */ class PlatformTest extends OrmMockTestCase { - public function setUp() + public function setUp(): void { - if (! Type::hasType('point')) { + if (!Type::hasType('point')) { Type::addType('point', 'CrEOF\Spatial\DBAL\Types\Geometry\PointType'); } parent::setUp(); } - /** - * @expectedException \CrEOF\Spatial\Exception\UnsupportedPlatformException - * @expectedExceptionMessage DBAL platform "YourSQL" is not currently supported. - */ public function testUnsupportedPlatform() { - $metadata = $this->getMockEntityManager()->getClassMetadata('CrEOF\Spatial\Tests\Fixtures\PointEntity'); + $this->expectException(UnsupportedPlatformException::class); + $this->expectExceptionMessage('DBAL platform "YourSQL" is not currently supported.'); + + $metadata = $this->getMockEntityManager()->getClassMetadata('CrEOF\Spatial\Tests\Fixtures\PointEntity'); $schemaTool = new SchemaTool($this->getMockEntityManager()); - $schemaTool->createSchema(array($metadata)); + $schemaTool->createSchema([$metadata]); } } diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php index 82f0a74f..042dad87 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group srid + * + * @internal + * @coversNothing */ class GeoPointSridTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::GEO_POINT_SRID_ENTITY); parent::setUp(); diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php index 88f2b16e..a9694c4f 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group geography + * + * @internal + * @coversNothing */ class GeoPolygonTypeTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::GEO_POLYGON_ENTITY); parent::setUp(); } - public function testNullPolygon() + public function testFindByPolygon() { + $rings = [ + new LineString([ + new Point(0, 0), + new Point(10, 0), + new Point(10, 10), + new Point(0, 10), + new Point(0, 0), + ]), + ]; $entity = new GeoPolygonEntity(); + $entity->setPolygon(new Polygon($rings)); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); - - $id = $entity->getId(); - $this->getEntityManager()->clear(); - $queryEntity = $this->getEntityManager()->getRepository(self::GEO_POLYGON_ENTITY)->find($id); + $result = $this->getEntityManager()->getRepository(self::GEO_POLYGON_ENTITY)->findByPolygon(new Polygon($rings)); - $this->assertEquals($entity, $queryEntity); + $this->assertEquals($entity, $result[0]); } - public function testSolidPolygon() + public function testNullPolygon() { - $rings = array( - new LineString(array( - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0) - )) - ); $entity = new GeoPolygonEntity(); - $entity->setPolygon(new Polygon($rings)); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); @@ -90,22 +90,22 @@ public function testSolidPolygon() public function testPolygonRing() { - $rings = array( - new LineString(array( + $rings = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )), - new LineString(array( + new Point(0, 0), + ]), + new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )) - ); + new Point(5, 5), + ]), + ]; $entity = new GeoPolygonEntity(); $entity->setPolygon(new Polygon($rings)); @@ -121,26 +121,29 @@ public function testPolygonRing() $this->assertEquals($entity, $queryEntity); } - public function testFindByPolygon() + public function testSolidPolygon() { - $rings = array( - new LineString(array( + $rings = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )) - ); + new Point(0, 0), + ]), + ]; $entity = new GeoPolygonEntity(); $entity->setPolygon(new Polygon($rings)); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); + + $id = $entity->getId(); + $this->getEntityManager()->clear(); - $result = $this->getEntityManager()->getRepository(self::GEO_POLYGON_ENTITY)->findByPolygon(new Polygon($rings)); + $queryEntity = $this->getEntityManager()->getRepository(self::GEO_POLYGON_ENTITY)->find($id); - $this->assertEquals($entity, $result[0]); + $this->assertEquals($entity, $queryEntity); } } diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php index 4133566f..95912f2b 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group geography + * + * @internal + * @coversNothing */ class GeographyTypeTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::GEOGRAPHY_ENTITY); parent::setUp(); } - public function testNullGeography() + public function testBadGeographyValue() { + $this->expectException(Error::class); + $entity = new GeographyEntity(); + try { + $entity->setGeography('POINT(0 0)'); + } catch (\TypeError $exception) { + throw new Error( + $exception->getMessage(), + $exception->getCode(), + $exception->getFile(), + $exception->getLine() + ); + } + } + + public function testLineStringGeography() + { + $entity = new GeographyEntity(); + + $entity->setGeography(new LineString( + [ + new Point(0, 0), + new Point(1, 1), + ]) + ); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); @@ -61,11 +90,10 @@ public function testNullGeography() $this->assertEquals($entity, $queryEntity); } - public function testPointGeography() + public function testNullGeography() { $entity = new GeographyEntity(); - $entity->setGeography(new Point(1, 1)); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); @@ -78,16 +106,11 @@ public function testPointGeography() $this->assertEquals($entity, $queryEntity); } - public function testLineStringGeography() + public function testPointGeography() { $entity = new GeographyEntity(); - $entity->setGeography(new LineString( - array( - new Point(0, 0), - new Point(1, 1) - )) - ); + $entity->setGeography(new Point(1, 1)); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); @@ -104,15 +127,15 @@ public function testPolygonGeography() { $entity = new GeographyEntity(); - $rings = array( - new LineString(array( + $rings = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )) - ); + new Point(0, 0), + ]), + ]; $entity->setGeography(new Polygon($rings)); $this->getEntityManager()->persist($entity); @@ -126,23 +149,4 @@ public function testPolygonGeography() $this->assertEquals($entity, $queryEntity); } - - /** - * @expectedException \PHPUnit_Framework_Error - */ - public function testBadGeographyValue() - { - $entity = new GeographyEntity(); - - try { - $entity->setGeography('POINT(0 0)'); - } catch (\TypeError $exception) { - throw new \PHPUnit_Framework_Error( - $exception->getMessage(), - $exception->getCode(), - $exception->getFile(), - $exception->getLine() - ); - } - } } diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php index 85c4a080..4aa94ef7 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group geometry + * + * @internal + * @coversNothing */ class LineStringTypeTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); parent::setUp(); } - public function testNullLineStringType() + public function testFindByLineString() { + $lineString = new LineString( + [ + new Point(0, 0), + new Point(1, 1), + new Point(2, 2), + ] + ); $entity = new LineStringEntity(); + $entity->setLineString($lineString); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); - $id = $entity->getId(); - $this->getEntityManager()->clear(); - $queryEntity = $this->getEntityManager()->getRepository(self::LINESTRING_ENTITY)->find($id); + $result = $this->getEntityManager()->getRepository(self::LINESTRING_ENTITY)->findByLineString($lineString); - $this->assertEquals($entity, $queryEntity); + $this->assertEquals($entity, $result[0]); } public function testLineString() { $lineString = new LineString( - array( + [ new Point(0, 0), new Point(1, 1), - new Point(2, 2) - ) + new Point(2, 2), + ] ); $entity = new LineStringEntity(); @@ -85,25 +94,19 @@ public function testLineString() $this->assertEquals($entity, $queryEntity); } - public function testFindByLineString() + public function testNullLineStringType() { - $lineString = new LineString( - array( - new Point(0, 0), - new Point(1, 1), - new Point(2, 2) - ) - ); $entity = new LineStringEntity(); - $entity->setLineString($lineString); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); + $id = $entity->getId(); + $this->getEntityManager()->clear(); - $result = $this->getEntityManager()->getRepository(self::LINESTRING_ENTITY)->findByLineString($lineString); + $queryEntity = $this->getEntityManager()->getRepository(self::LINESTRING_ENTITY)->find($id); - $this->assertEquals($entity, $result[0]); + $this->assertEquals($entity, $queryEntity); } } diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php index 8003cfa6..9051d9ff 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group geometry + * + * @internal + * @coversNothing */ class MultiPolygonTypeTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::MULTIPOLYGON_ENTITY); parent::setUp(); } - public function testNullMultiPolygon() + public function testFindByMultiPolygon() { + $polygons = [ + new Polygon( + [ + new LineString( + [ + new Point(0, 0), + new Point(10, 0), + new Point(10, 10), + new Point(0, 10), + new Point(0, 0), + ] + ), + ] + ), + new Polygon( + [ + new LineString( + [ + new Point(5, 5), + new Point(7, 5), + new Point(7, 7), + new Point(5, 7), + new Point(5, 5), + ] + ), + ] + ), + ]; $entity = new MultiPolygonEntity(); + $entity->setMultiPolygon(new MultiPolygon($polygons)); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); - - $id = $entity->getId(); - $this->getEntityManager()->clear(); - $queryEntity = $this->getEntityManager()->getRepository(self::MULTIPOLYGON_ENTITY)->find($id); + $result = $this->getEntityManager()->getRepository(self::MULTIPOLYGON_ENTITY)->findByMultiPolygon(new MultiPolygon($polygons)); - $this->assertEquals($entity, $queryEntity); + $this->assertEquals($entity, $result[0]); } public function testMultiPolygon() { - $polygons = array( + $polygons = [ new Polygon( - array( + [ new LineString( - array( + [ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - ) - ) - ) + new Point(0, 0), + ] + ), + ] ), new Polygon( - array( + [ new LineString( - array( + [ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - ) - ) - ) - ) - ); + new Point(5, 5), + ] + ), + ] + ), + ]; $entity = new MultiPolygonEntity(); $entity->setMultiPolygon(new MultiPolygon($polygons)); @@ -108,46 +137,19 @@ public function testMultiPolygon() $this->assertEquals($entity, $queryEntity); } - - public function testFindByMultiPolygon() + public function testNullMultiPolygon() { - $polygons = array( - new Polygon( - array( - new LineString( - array( - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0) - ) - ) - ) - ), - new Polygon( - array( - new LineString( - array( - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5) - ) - ) - ) - ) - ); $entity = new MultiPolygonEntity(); - $entity->setMultiPolygon(new MultiPolygon($polygons)); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); + + $id = $entity->getId(); + $this->getEntityManager()->clear(); - $result = $this->getEntityManager()->getRepository(self::MULTIPOLYGON_ENTITY)->findByMultiPolygon(new MultiPolygon($polygons)); + $queryEntity = $this->getEntityManager()->getRepository(self::MULTIPOLYGON_ENTITY)->find($id); - $this->assertEquals($entity, $result[0]); + $this->assertEquals($entity, $queryEntity); } } diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php index 9e1c9095..8c92a48e 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group geometry + * + * @internal + * @coversNothing */ class PointTypeTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POINT_ENTITY); parent::setUp(); } - public function testNullPoint() + public function testFindByPoint() { + $point = new Point(1, 1); $entity = new PointEntity(); + $entity->setPoint($point); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); - $id = $entity->getId(); - $this->getEntityManager()->clear(); - $queryEntity = $this->getEntityManager()->getRepository(self::POINT_ENTITY)->find($id); + $result = $this->getEntityManager()->getRepository(self::POINT_ENTITY)->findByPoint($point); - $this->assertEquals($entity, $queryEntity); + $this->assertEquals($entity, $result[0]); } - public function testPoint() + public function testNullPoint() { - $point = new Point(1, 1); $entity = new PointEntity(); - $entity->setPoint($point); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); @@ -78,19 +79,21 @@ public function testPoint() $this->assertEquals($entity, $queryEntity); } - public function testFindByPoint() + public function testPoint() { - $point = new Point(1, 1); + $point = new Point(1, 1); $entity = new PointEntity(); $entity->setPoint($point); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); + $id = $entity->getId(); + $this->getEntityManager()->clear(); - $result = $this->getEntityManager()->getRepository(self::POINT_ENTITY)->findByPoint($point); + $queryEntity = $this->getEntityManager()->getRepository(self::POINT_ENTITY)->find($id); - $this->assertEquals($entity, $result[0]); + $this->assertEquals($entity, $queryEntity); } } diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php index 3411b5de..f700cd7e 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group geometry + * + * @internal + * @coversNothing */ class PolygonTypeTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); parent::setUp(); } - public function testNullPolygon() + public function testFindByPolygon() { + $rings = [ + new LineString([ + new Point(0, 0), + new Point(10, 0), + new Point(10, 10), + new Point(0, 10), + new Point(0, 0), + ]), + ]; $entity = new PolygonEntity(); + $entity->setPolygon(new Polygon($rings)); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); - - $id = $entity->getId(); - $this->getEntityManager()->clear(); - $queryEntity = $this->getEntityManager()->getRepository(self::POLYGON_ENTITY)->find($id); + $result = $this->getEntityManager()->getRepository(self::POLYGON_ENTITY)->findByPolygon(new Polygon($rings)); - $this->assertEquals($entity, $queryEntity); + $this->assertEquals($entity, $result[0]); } - public function testSolidPolygon() + public function testNullPolygon() { - $rings = array( - new LineString(array( - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0) - )) - ); $entity = new PolygonEntity(); - $entity->setPolygon(new Polygon($rings)); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); @@ -90,22 +90,22 @@ public function testSolidPolygon() public function testPolygonRing() { - $rings = array( - new LineString(array( + $rings = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )), - new LineString(array( + new Point(0, 0), + ]), + new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )) - ); + new Point(5, 5), + ]), + ]; $entity = new PolygonEntity(); $entity->setPolygon(new Polygon($rings)); @@ -121,26 +121,29 @@ public function testPolygonRing() $this->assertEquals($entity, $queryEntity); } - public function testFindByPolygon() + public function testSolidPolygon() { - $rings = array( - new LineString(array( + $rings = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )) - ); + new Point(0, 0), + ]), + ]; $entity = new PolygonEntity(); $entity->setPolygon(new Polygon($rings)); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); + + $id = $entity->getId(); + $this->getEntityManager()->clear(); - $result = $this->getEntityManager()->getRepository(self::POLYGON_ENTITY)->findByPolygon(new Polygon($rings)); + $queryEntity = $this->getEntityManager()->getRepository(self::POLYGON_ENTITY)->find($id); - $this->assertEquals($entity, $result[0]); + $this->assertEquals($entity, $queryEntity); } } diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php index 50aac305..5e7e17b6 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group geometry + * + * @internal + * @coversNothing */ class GeometryTypeTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::GEOMETRY_ENTITY); $this->usesEntity(self::NO_HINT_GEOMETRY_ENTITY); parent::setUp(); } - public function testNullGeometry() + public function testBadGeometryValue() + { + $this->expectException(\CrEOF\Spatial\Exception\InvalidValueException::class); + $this->expectExceptionMessage('Geometry column values must implement GeometryInterface'); + + $entity = new NoHintGeometryEntity(); + + $entity->setGeometry('POINT(0 0)'); + $this->getEntityManager()->persist($entity); + $this->getEntityManager()->flush(); + } + + public function testLineStringGeometry() { $entity = new GeometryEntity(); + $entity->setGeometry(new LineString( + [ + new Point(0, 0), + new Point(1, 1), + ]) + ); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); @@ -64,11 +85,10 @@ public function testNullGeometry() $this->assertEquals($entity, $queryEntity); } - public function testPointGeometry() + public function testNullGeometry() { $entity = new GeometryEntity(); - $entity->setGeometry(new Point(1, 1)); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); @@ -81,16 +101,11 @@ public function testPointGeometry() $this->assertEquals($entity, $queryEntity); } - /** - * @group srid - */ - public function testPointGeometryWithSrid() + public function testPointGeometry() { $entity = new GeometryEntity(); - $point = new Point(1, 1); - $point->setSrid(200); - $entity->setGeometry($point); + $entity->setGeometry(new Point(1, 1)); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); @@ -106,12 +121,12 @@ public function testPointGeometryWithSrid() /** * @group srid */ - public function testPointGeometryWithZeroSrid() + public function testPointGeometryWithSrid() { $entity = new GeometryEntity(); - $point = new Point(1, 1); + $point = new Point(1, 1); - $point->setSrid(0); + $point->setSrid(200); $entity->setGeometry($point); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); @@ -125,16 +140,16 @@ public function testPointGeometryWithZeroSrid() $this->assertEquals($entity, $queryEntity); } - public function testLineStringGeometry() + /** + * @group srid + */ + public function testPointGeometryWithZeroSrid() { $entity = new GeometryEntity(); + $point = new Point(1, 1); - $entity->setGeometry(new LineString( - array( - new Point(0, 0), - new Point(1, 1) - )) - ); + $point->setSrid(0); + $entity->setGeometry($point); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); @@ -151,15 +166,15 @@ public function testPolygonGeometry() { $entity = new GeometryEntity(); - $rings = array( - new LineString(array( + $rings = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )) - ); + new Point(0, 0), + ]), + ]; $entity->setGeometry(new Polygon($rings)); $this->getEntityManager()->persist($entity); @@ -173,17 +188,4 @@ public function testPolygonGeometry() $this->assertEquals($entity, $queryEntity); } - - /** - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage Geometry column values must implement GeometryInterface - */ - public function testBadGeometryValue() - { - $entity = new NoHintGeometryEntity(); - - $entity->setGeometry('POINT(0 0)'); - $this->getEntityManager()->persist($entity); - $this->getEntityManager()->flush(); - } } diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php index 7a92b5fd..23737675 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT + * + * @internal + * @coversNothing */ class SchemaTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::GEOMETRY_ENTITY); $this->usesEntity(self::POINT_ENTITY); @@ -43,7 +46,7 @@ protected function setUp() $this->usesEntity(self::POLYGON_ENTITY); $this->usesEntity(self::MULTIPOLYGON_ENTITY); - if ($this->getPlatform()->getName() === 'postgresql') { + if ('postgresql' === $this->getPlatform()->getName()) { $this->usesEntity(self::GEOGRAPHY_ENTITY); $this->usesEntity(self::GEO_POINT_SRID_ENTITY); $this->usesEntity(self::GEO_LINESTRING_ENTITY); @@ -59,9 +62,9 @@ public function testDoctrineTypeMapping() foreach ($this->getAllClassMetadata() as $metadata) { foreach ($metadata->getFieldNames() as $fieldName) { - $doctrineType = $metadata->getTypeOfField($fieldName); - $type = Type::getType($doctrineType); - $databaseTypes = $type->getMappedDatabaseTypes($platform); + $doctrineType = $metadata->getTypeOfField($fieldName); + $type = Type::getType($doctrineType); + $databaseTypes = $type->getMappedDatabaseTypes($platform); foreach ($databaseTypes as $databaseType) { $typeMapping = $this->getPlatform()->getDoctrineTypeMapping($databaseType); @@ -84,7 +87,7 @@ public function testSchemaReverseMapping() */ private function getAllClassMetadata() { - $metadata = array(); + $metadata = []; foreach (array_keys($this->getUsedEntityClasses()) as $entityClass) { $metadata[] = $this->getEntityManager()->getClassMetadata($entityClass); diff --git a/tests/CrEOF/Spatial/Tests/FileSQLLogger.php b/tests/CrEOF/Spatial/Tests/FileSQLLogger.php index e623d6e8..f8f03b33 100644 --- a/tests/CrEOF/Spatial/Tests/FileSQLLogger.php +++ b/tests/CrEOF/Spatial/Tests/FileSQLLogger.php @@ -1,6 +1,7 @@ filename, $sql . PHP_EOL, FILE_APPEND); + file_put_contents($this->filename, $sql.PHP_EOL, FILE_APPEND); if ($params) { - file_put_contents($this->filename, var_export($params, true) . PHP_EOL, FILE_APPEND); + file_put_contents($this->filename, var_export($params, true).PHP_EOL, FILE_APPEND); } if ($types) { - file_put_contents($this->filename, var_export($types, true) . PHP_EOL, FILE_APPEND); + file_put_contents($this->filename, var_export($types, true).PHP_EOL, FILE_APPEND); } } diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/GeoLineStringEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/GeoLineStringEntity.php index 865d1c80..16907888 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/GeoLineStringEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/GeoLineStringEntity.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT * * @Entity - * @Table() + * @Table */ class GeoLineStringEntity { /** - * @var int $id + * @var int * * @Id * @GeneratedValue(strategy="AUTO") @@ -46,14 +52,14 @@ class GeoLineStringEntity protected $id; /** - * @var LineString $lineString + * @var LineString * * @Column(type="geolinestring", nullable=true) */ protected $lineString; /** - * Get id + * Get id. * * @return int */ @@ -63,26 +69,24 @@ public function getId() } /** - * Set lineString + * Get lineString. * - * @param LineString $lineString - * - * @return self + * @return LineString */ - public function setLineString(LineString $lineString) + public function getLineString() { - $this->lineString = $lineString; - - return $this; + return $this->lineString; } /** - * Get lineString + * Set lineString. * - * @return LineString + * @return self */ - public function getLineString() + public function setLineString(LineString $lineString) { - return $this->lineString; + $this->lineString = $lineString; + + return $this; } } diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/GeoPointSridEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/GeoPointSridEntity.php index a43439d1..3392020c 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/GeoPointSridEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/GeoPointSridEntity.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT @@ -36,7 +41,7 @@ class GeoPointSridEntity { /** - * @var int $id + * @var int * * @Id * @GeneratedValue(strategy="AUTO") @@ -45,14 +50,14 @@ class GeoPointSridEntity protected $id; /** - * @var Point $point + * @var Point * - * @Column(type="geopoint", nullable=true, options={"srid"="4326"}) + * @Column(type="geopoint", nullable=true, options={"srid": "4326"}) */ protected $point; /** - * Get id + * Get id. * * @return int */ @@ -62,26 +67,24 @@ public function getId() } /** - * Set geography + * Get geography. * - * @param Point $point - * - * @return self + * @return Point */ - public function setPoint(Point $point) + public function getPoint() { - $this->point = $point; - - return $this; + return $this->point; } /** - * Get geography + * Set geography. * - * @return Point + * @return self */ - public function getPoint() + public function setPoint(Point $point) { - return $this->point; + $this->point = $point; + + return $this; } } diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/GeoPolygonEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/GeoPolygonEntity.php index ab9d8c77..ea66a6ed 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/GeoPolygonEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/GeoPolygonEntity.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT * * @Entity - * @Table() + * @Table */ class GeoPolygonEntity { /** - * @var int $id + * @var int * * @Id * @GeneratedValue(strategy="AUTO") @@ -46,14 +52,14 @@ class GeoPolygonEntity protected $id; /** - * @var Polygon $polygon + * @var Polygon * * @Column(type="geopolygon", nullable=true) */ protected $polygon; /** - * Get id + * Get id. * * @return int */ @@ -63,26 +69,24 @@ public function getId() } /** - * Set polygon + * Get polygon. * - * @param Polygon $polygon - * - * @return self + * @return Polygon */ - public function setPolygon(Polygon $polygon) + public function getPolygon() { - $this->polygon = $polygon; - - return $this; + return $this->polygon; } /** - * Get polygon + * Set polygon. * - * @return Polygon + * @return self */ - public function getPolygon() + public function setPolygon(Polygon $polygon) { - return $this->polygon; + $this->polygon = $polygon; + + return $this; } } diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/GeographyEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/GeographyEntity.php index 13f4d631..c5b13cbb 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/GeographyEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/GeographyEntity.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT @@ -36,7 +41,13 @@ class GeographyEntity { /** - * @var int $id + * @var GeographyInterface + * + * @Column(type="geography", nullable=true) + */ + protected $geography; + /** + * @var int * * @Id * @GeneratedValue(strategy="AUTO") @@ -45,14 +56,17 @@ class GeographyEntity protected $id; /** - * @var GeographyInterface $geography + * Get geography. * - * @Column(type="geography", nullable=true) + * @return GeographyInterface */ - protected $geography; + public function getGeography() + { + return $this->geography; + } /** - * Get id + * Get id. * * @return int */ @@ -62,9 +76,7 @@ public function getId() } /** - * Set geography - * - * @param GeographyInterface $geography + * Set geography. * * @return self */ @@ -74,14 +86,4 @@ public function setGeography(GeographyInterface $geography) return $this; } - - /** - * Get geography - * - * @return GeographyInterface - */ - public function getGeography() - { - return $this->geography; - } } diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/GeometryEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/GeometryEntity.php index 76692117..30c9b77d 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/GeometryEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/GeometryEntity.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT * * @Entity - * @Table() + * @Table */ class GeometryEntity { /** - * @var int $id + * @var GeometryInterface + * + * @Column(type="geometry", nullable=true) + */ + protected $geometry; + /** + * @var int * * @Id * @GeneratedValue(strategy="AUTO") @@ -46,14 +58,17 @@ class GeometryEntity protected $id; /** - * @var GeometryInterface $geometry + * Get geometry. * - * @Column(type="geometry", nullable=true) + * @return GeometryInterface */ - protected $geometry; + public function getGeometry() + { + return $this->geometry; + } /** - * Get id + * Get id. * * @return int */ @@ -63,9 +78,7 @@ public function getId() } /** - * Set geometry - * - * @param GeometryInterface $geometry + * Set geometry. * * @return self */ @@ -75,14 +88,4 @@ public function setGeometry(GeometryInterface $geometry) return $this; } - - /** - * Get geometry - * - * @return GeometryInterface - */ - public function getGeometry() - { - return $this->geometry; - } } diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/LineStringEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/LineStringEntity.php index 0f9f34bf..1ad21c17 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/LineStringEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/LineStringEntity.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT * * @Entity - * @Table() + * @Table */ class LineStringEntity { /** - * @var int $id + * @var int * * @Id * @GeneratedValue(strategy="AUTO") @@ -46,14 +52,14 @@ class LineStringEntity protected $id; /** - * @var LineString $lineString + * @var LineString * * @Column(type="linestring", nullable=true) */ protected $lineString; /** - * Get id + * Get id. * * @return int */ @@ -63,26 +69,24 @@ public function getId() } /** - * Set lineString + * Get lineString. * - * @param LineString $lineString - * - * @return self + * @return LineString */ - public function setLineString(LineString $lineString) + public function getLineString() { - $this->lineString = $lineString; - - return $this; + return $this->lineString; } /** - * Get lineString + * Set lineString. * - * @return LineString + * @return self */ - public function getLineString() + public function setLineString(LineString $lineString) { - return $this->lineString; + $this->lineString = $lineString; + + return $this; } } diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/MultiPolygonEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/MultiPolygonEntity.php index 9b142c98..adca307a 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/MultiPolygonEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/MultiPolygonEntity.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @Entity - * @Table() + * @Table */ class MultiPolygonEntity { /** - * @var int $id + * @var int * * @Id * @GeneratedValue(strategy="AUTO") @@ -46,14 +52,14 @@ class MultiPolygonEntity protected $id; /** - * @var MultiPolygon $multiPolygon + * @var MultiPolygon * * @Column(type="multipolygon", nullable=true) */ protected $multiPolygon; /** - * Get id + * Get id. * * @return int */ @@ -63,26 +69,24 @@ public function getId() } /** - * Set multipolygon + * Get multipolygon. * - * @param MultiPolygon $multiPolygon - * - * @return self + * @return MultiPolygon */ - public function setMultiPolygon(MultiPolygon $multiPolygon) + public function getMultiPolygon() { - $this->multiPolygon = $multiPolygon; - - return $this; + return $this->multiPolygon; } /** - * Get multipolygon + * Set multipolygon. * - * @return MultiPolygon + * @return self */ - public function getMultiPolygon() + public function setMultiPolygon(MultiPolygon $multiPolygon) { - return $this->multiPolygon; + $this->multiPolygon = $multiPolygon; + + return $this; } } diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/NoHintGeometryEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/NoHintGeometryEntity.php index 5c73fdac..05273261 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/NoHintGeometryEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/NoHintGeometryEntity.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT * * @Entity - * @Table() + * @Table */ class NoHintGeometryEntity { /** - * @var int $id + * @var mixed + * + * @Column(type="geometry", nullable=true) + */ + protected $geometry; + /** + * @var int * * @Id * @GeneratedValue(strategy="AUTO") @@ -44,14 +57,17 @@ class NoHintGeometryEntity protected $id; /** - * @var mixed $geometry + * Get geometry. * - * @Column(type="geometry", nullable=true) + * @return mixed */ - protected $geometry; + public function getGeometry() + { + return $this->geometry; + } /** - * Get id + * Get id. * * @return int */ @@ -61,7 +77,7 @@ public function getId() } /** - * Set geometry + * Set geometry. * * @param mixed $geometry * @@ -73,14 +89,4 @@ public function setGeometry($geometry) return $this; } - - /** - * Get geometry - * - * @return mixed - */ - public function getGeometry() - { - return $this->geometry; - } } diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/PointEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/PointEntity.php index 0d0de346..b9743bad 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/PointEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/PointEntity.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT * * @Entity - * @Table() + * @Table */ class PointEntity { /** - * @var int $id + * @var int * * @Id * @GeneratedValue(strategy="AUTO") @@ -46,14 +52,14 @@ class PointEntity protected $id; /** - * @var Point $point + * @var Point * * @Column(type="point", nullable=true) */ protected $point; /** - * Get id + * Get id. * * @return int */ @@ -63,26 +69,24 @@ public function getId() } /** - * Set point + * Get point. * - * @param Point $point - * - * @return self + * @return Point */ - public function setPoint(Point $point) + public function getPoint() { - $this->point = $point; - - return $this; + return $this->point; } /** - * Get point + * Set point. * - * @return Point + * @return self */ - public function getPoint() + public function setPoint(Point $point) { - return $this->point; + $this->point = $point; + + return $this; } } diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/PolygonEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/PolygonEntity.php index bd995455..30d8305e 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/PolygonEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/PolygonEntity.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT * * @Entity - * @Table() + * @Table */ class PolygonEntity { /** - * @var int $id + * @var int * * @Id * @GeneratedValue(strategy="AUTO") @@ -46,14 +52,14 @@ class PolygonEntity protected $id; /** - * @var Polygon $polygon + * @var Polygon * * @Column(type="polygon", nullable=true) */ protected $polygon; /** - * Get id + * Get id. * * @return int */ @@ -63,26 +69,24 @@ public function getId() } /** - * Set polygon + * Get polygon. * - * @param Polygon $polygon - * - * @return self + * @return Polygon */ - public function setPolygon(Polygon $polygon) + public function getPolygon() { - $this->polygon = $polygon; - - return $this; + return $this->polygon; } /** - * Get polygon + * Set polygon. * - * @return Polygon + * @return self */ - public function getPolygon() + public function setPolygon(Polygon $polygon) { - return $this->polygon; + $this->polygon = $polygon; + + return $this; } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php index c307556f..78e0c483 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class AreaTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); $this->supportsPlatform('mysql'); @@ -51,158 +54,158 @@ protected function setUp() /** * @group geometry */ - public function testSelectArea() + public function testAreaWhere() { $entity1 = new PolygonEntity(); - $rings1 = array( - new LineString(array( + $rings1 = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )) - ); + new Point(0, 0), + ]), + ]; $entity1->setPolygon(new Polygon($rings1)); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $rings2 = array( - new LineString(array( + $rings2 = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )), - new LineString(array( + new Point(0, 0), + ]), + new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )) - ); + new Point(5, 5), + ]), + ]; $entity2->setPolygon(new Polygon($rings2)); $this->getEntityManager()->persist($entity2); $entity3 = new PolygonEntity(); - $rings3 = array( - new LineString(array( + $rings3 = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 20), new Point(0, 20), new Point(10, 10), - new Point(0, 0) - )) - ); + new Point(0, 0), + ]), + ]; $entity3->setPolygon(new Polygon($rings3)); $this->getEntityManager()->persist($entity3); $entity4 = new PolygonEntity(); - $rings4 = array( - new LineString(array( + $rings4 = [ + new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )) - ); + new Point(5, 5), + ]), + ]; $entity4->setPolygon(new Polygon($rings4)); $this->getEntityManager()->persist($entity4); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT Area(p.polygon) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Area(p.polygon) < 50'); $result = $query->getResult(); - $this->assertEquals(100, $result[0][1]); - $this->assertEquals(96, $result[1][1]); - $this->assertEquals(100, $result[2][1]); - $this->assertEquals(4, $result[3][1]); + $this->assertCount(1, $result); + $this->assertEquals($entity4, $result[0]); } /** * @group geometry */ - public function testAreaWhere() + public function testSelectArea() { $entity1 = new PolygonEntity(); - $rings1 = array( - new LineString(array( + $rings1 = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )) - ); + new Point(0, 0), + ]), + ]; $entity1->setPolygon(new Polygon($rings1)); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $rings2 = array( - new LineString(array( + $rings2 = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )), - new LineString(array( + new Point(0, 0), + ]), + new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )) - ); + new Point(5, 5), + ]), + ]; $entity2->setPolygon(new Polygon($rings2)); $this->getEntityManager()->persist($entity2); $entity3 = new PolygonEntity(); - $rings3 = array( - new LineString(array( + $rings3 = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 20), new Point(0, 20), new Point(10, 10), - new Point(0, 0) - )) - ); + new Point(0, 0), + ]), + ]; $entity3->setPolygon(new Polygon($rings3)); $this->getEntityManager()->persist($entity3); $entity4 = new PolygonEntity(); - $rings4 = array( - new LineString(array( + $rings4 = [ + new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )) - ); + new Point(5, 5), + ]), + ]; $entity4->setPolygon(new Polygon($rings4)); $this->getEntityManager()->persist($entity4); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Area(p.polygon) < 50'); + $query = $this->getEntityManager()->createQuery('SELECT Area(p.polygon) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($entity4, $result[0]); + $this->assertEquals(100, $result[0][1]); + $this->assertEquals(96, $result[1][1]); + $this->assertEquals(100, $result[2][1]); + $this->assertEquals(4, $result[3][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php index 2ec88a57..e9ee526e 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class AsBinaryTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); $this->supportsPlatform('mysql'); @@ -52,16 +55,16 @@ protected function setUp() */ public function testAsBinary() { - $lineString1 = array( + $lineString1 = [ new Point(0, 0), new Point(2, 2), - new Point(5, 5) - ); - $lineString2 = array( + new Point(5, 5), + ]; + $lineString2 = [ new Point(3, 3), new Point(4, 15), - new Point(5, 22) - ); + new Point(5, 22), + ]; $entity1 = new LineStringEntity(); $entity1->setLineString(new LineString($lineString1)); @@ -74,8 +77,8 @@ public function testAsBinary() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT AsBinary(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); - $result = $query->getResult(); + $query = $this->getEntityManager()->createQuery('SELECT AsBinary(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); + $result = $query->getResult(); $string1 = '010200000003000000000000000000000000000000000000000000000000000040000000000000004000000000000014400000000000001440'; $string2 = '0102000000030000000000000000000840000000000000084000000000000010400000000000002e4000000000000014400000000000003640'; $binary1 = pack('H*', $string1); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php index e093257f..f5437cfb 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class AsTextTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); $this->supportsPlatform('mysql'); @@ -52,16 +55,16 @@ protected function setUp() */ public function testAsText() { - $lineString1 = array( + $lineString1 = [ new Point(0, 0), new Point(2, 2), - new Point(5, 5) - ); - $lineString2 = array( + new Point(5, 5), + ]; + $lineString2 = [ new Point(3, 3), new Point(4, 15), - new Point(5, 22) - ); + new Point(5, 22), + ]; $entity1 = new LineStringEntity(); $entity1->setLineString(new LineString($lineString1)); @@ -74,7 +77,7 @@ public function testAsText() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT AsText(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); + $query = $this->getEntityManager()->createQuery('SELECT AsText(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); $result = $query->getResult(); $this->assertEquals('LINESTRING(0 0,2 2,5 5)', $result[0][1]); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php index d3ad2a3c..20654880 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class ContainsTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); $this->usesType('point'); @@ -52,97 +55,97 @@ protected function setUp() /** * @group geometry */ - public function testSelectContains() + public function testContainsWhereParameter() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )); - $lineString2 = new LineString(array( + new Point(0, 0), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); + new Point(5, 5), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString2))); + $entity2->setPolygon(new Polygon([$lineString1, $lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, Contains(p.polygon, GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Contains(p.polygon, GeomFromText(:p1)) = 1'); + + $query->setParameter('p1', 'POINT(6 6)', 'string'); + + $result = $query->getResult(); + + $this->assertCount(2, $result); + $this->assertEquals($entity1, $result[0]); + $this->assertEquals($entity2, $result[1]); + $this->getEntityManager()->clear(); + + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Contains(p.polygon, GeomFromText(:p1)) = 1'); $query->setParameter('p1', 'POINT(2 2)', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0][0]); - $this->assertEquals(1, $result[0][1]); - $this->assertEquals($entity2, $result[1][0]); - $this->assertEquals(0, $result[1][1]); + $this->assertEquals($entity1, $result[0]); + $this->assertEquals($entity2, $result[1]); } /** * @group geometry */ - public function testContainsWhereParameter() + public function testSelectContains() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )); - $lineString2 = new LineString(array( + new Point(0, 0), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); + new Point(5, 5), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString1, $lineString2))); + $entity2->setPolygon(new Polygon([$lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Contains(p.polygon, GeomFromText(:p1)) = 1'); - - $query->setParameter('p1', 'POINT(6 6)', 'string'); - - $result = $query->getResult(); - - $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0]); - $this->assertEquals($entity2, $result[1]); - $this->getEntityManager()->clear(); - - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Contains(p.polygon, GeomFromText(:p1)) = 1'); + $query = $this->getEntityManager()->createQuery('SELECT p, Contains(p.polygon, GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); $query->setParameter('p1', 'POINT(2 2)', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0]); - $this->assertEquals($entity2, $result[1]); + $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals(1, $result[0][1]); + $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals(0, $result[1][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php index b1e3432b..29d86208 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class DisjointTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); $this->supportsPlatform('mysql'); @@ -51,126 +54,126 @@ protected function setUp() /** * @group geometry */ - public function testSelectDisjoint() + public function testDisjointWhereParameter() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )); - $lineString2 = new LineString(array( + new Point(0, 0), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); - $lineString3 = new LineString(array( + new Point(5, 5), + ]); + $lineString3 = new LineString([ new Point(15, 15), new Point(17, 15), new Point(17, 17), new Point(15, 17), - new Point(15, 15) - )); + new Point(15, 15), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString2))); + $entity2->setPolygon(new Polygon([$lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $entity3 = new PolygonEntity(); - $entity3->setPolygon(new Polygon(array($lineString3))); + $entity3->setPolygon(new Polygon([$lineString3])); $this->getEntityManager()->persist($entity3); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, Disjoint(p.polygon, GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Disjoint(p.polygon, GeomFromText(:p1)) = 1'); $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); $result = $query->getResult(); - $this->assertCount(3, $result); - $this->assertEquals($entity1, $result[0][0]); - $this->assertEquals(0, $result[0][1]); - $this->assertEquals($entity2, $result[1][0]); - $this->assertEquals(0, $result[1][1]); - $this->assertEquals($entity3, $result[2][0]); - $this->assertEquals(1, $result[2][1]); + $this->assertCount(1, $result); + $this->assertEquals($entity3, $result[0]); + $this->getEntityManager()->clear(); + + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Disjoint(p.polygon, GeomFromText(:p1)) = 1'); + + $query->setParameter('p1', 'POLYGON((15 15,17 15,17 17,15 17,15 15))', 'string'); + + $result = $query->getResult(); + + $this->assertCount(2, $result); + $this->assertEquals($entity1, $result[0]); + $this->assertEquals($entity2, $result[1]); } /** * @group geometry */ - public function testDisjointWhereParameter() + public function testSelectDisjoint() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )); - $lineString2 = new LineString(array( + new Point(0, 0), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); - $lineString3 = new LineString(array( + new Point(5, 5), + ]); + $lineString3 = new LineString([ new Point(15, 15), new Point(17, 15), new Point(17, 17), new Point(15, 17), - new Point(15, 15) - )); + new Point(15, 15), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString2))); + $entity2->setPolygon(new Polygon([$lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $entity3 = new PolygonEntity(); - $entity3->setPolygon(new Polygon(array($lineString3))); + $entity3->setPolygon(new Polygon([$lineString3])); $this->getEntityManager()->persist($entity3); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Disjoint(p.polygon, GeomFromText(:p1)) = 1'); + $query = $this->getEntityManager()->createQuery('SELECT p, Disjoint(p.polygon, GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($entity3, $result[0]); - $this->getEntityManager()->clear(); - - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Disjoint(p.polygon, GeomFromText(:p1)) = 1'); - - $query->setParameter('p1', 'POLYGON((15 15,17 15,17 17,15 17,15 15))', 'string'); - - $result = $query->getResult(); - - $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0]); - $this->assertEquals($entity2, $result[1]); + $this->assertCount(3, $result); + $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals(0, $result[0][1]); + $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals(0, $result[1][1]); + $this->assertEquals($entity3, $result[2][0]); + $this->assertEquals(1, $result[2][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php index ff05f614..53f6999c 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class EnvelopeTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); $this->supportsPlatform('mysql'); @@ -51,101 +54,101 @@ protected function setUp() /** * @group geometry */ - public function testSelectEnvelope() + public function testEnvelopeWhereParameter() { $entity1 = new PolygonEntity(); - $rings1 = array( - new LineString(array( + $rings1 = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )) - ); + new Point(0, 0), + ]), + new LineString([ + new Point(5, 5), + new Point(7, 5), + new Point(7, 7), + new Point(5, 7), + new Point(5, 5), + ]), + ]; $entity1->setPolygon(new Polygon($rings1)); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $rings2 = array( - new LineString(array( - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0) - )), - new LineString(array( + $rings2 = [ + new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )) - ); + new Point(5, 5), + ]), + ]; $entity2->setPolygon(new Polygon($rings2)); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT AsText(Envelope(p.polygon)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Envelope(p.polygon) = GeomFromText(:p1)'); + + $query->setParameter('p1', 'POLYGON((0 0,10 0,10 10,0 10,0 0))', 'string'); + $result = $query->getResult(); - $this->assertEquals('POLYGON((0 0,10 0,10 10,0 10,0 0))', $result[0][1]); - $this->assertEquals('POLYGON((0 0,10 0,10 10,0 10,0 0))', $result[1][1]); + $this->assertCount(1, $result); + $this->assertEquals($entity1, $result[0]); } /** * @group geometry */ - public function testEnvelopeWhereParameter() + public function testSelectEnvelope() { $entity1 = new PolygonEntity(); - $rings1 = array( - new LineString(array( + $rings1 = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )), - new LineString(array( - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5) - )) - ); + new Point(0, 0), + ]), + ]; $entity1->setPolygon(new Polygon($rings1)); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $rings2 = array( - new LineString(array( + $rings2 = [ + new LineString([ + new Point(0, 0), + new Point(10, 0), + new Point(10, 10), + new Point(0, 10), + new Point(0, 0), + ]), + new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )) - ); + new Point(5, 5), + ]), + ]; $entity2->setPolygon(new Polygon($rings2)); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Envelope(p.polygon) = GeomFromText(:p1)'); - - $query->setParameter('p1', 'POLYGON((0 0,10 0,10 10,0 10,0 0))', 'string'); - + $query = $this->getEntityManager()->createQuery('SELECT AsText(Envelope(p.polygon)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($entity1, $result[0]); + $this->assertEquals('POLYGON((0 0,10 0,10 10,0 10,0 0))', $result[0][1]); + $this->assertEquals('POLYGON((0 0,10 0,10 10,0 10,0 0))', $result[1][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php index 9764d221..bdd86b68 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class GLengthTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); $this->supportsPlatform('mysql'); @@ -50,52 +53,52 @@ protected function setUp() /** * @group geometry */ - public function testSelectGLength() + public function testGLengthWhereParameter() { $entity = new LineStringEntity(); - $entity->setLineString(new LineString(array( + $entity->setLineString(new LineString([ new Point(0, 0), new Point(1, 1), - new Point(2, 2) - ))); + new Point(2, 2), + ])); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l, GLength(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); + $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE GLength(GeomFromText(:p1)) > GLength(l.lineString)'); + + $query->setParameter('p1', 'LINESTRING(0 0,1 1,2 2,3 3,4 4,5 5)', 'string'); + $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity, $result[0][0]); - $this->assertEquals(2.82842712474619, $result[0][1]); + $this->assertEquals($entity, $result[0]); } /** * @group geometry */ - public function testGLengthWhereParameter() + public function testSelectGLength() { $entity = new LineStringEntity(); - $entity->setLineString(new LineString(array( + $entity->setLineString(new LineString([ new Point(0, 0), new Point(1, 1), - new Point(2, 2) - ))); + new Point(2, 2), + ])); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE GLength(GeomFromText(:p1)) > GLength(l.lineString)'); - - $query->setParameter('p1', 'LINESTRING(0 0,1 1,2 2,3 3,4 4,5 5)', 'string'); - + $query = $this->getEntityManager()->createQuery('SELECT l, GLength(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity, $result[0]); + $this->assertEquals($entity, $result[0][0]); + $this->assertEquals(2.82842712474619, $result[0][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php index a610c385..f4da8274 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class GeomFromTextTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::GEOMETRY_ENTITY); $this->usesType('point'); @@ -51,18 +54,24 @@ protected function setUp() /** * @group geometry */ - public function testPoint() + public function testLineString() { + $value = [ + new Point(0, 0), + new Point(5, 5), + new Point(10, 10), + ]; + $entity1 = new GeometryEntity(); - $entity1->setGeometry(new Point(5, 5)); + $entity1->setGeometry(new LineString($value)); $this->getEntityManager()->persist($entity1); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT g FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g WHERE g.geometry = GeomFromText(:p1)'); + $query = $this->getEntityManager()->createQuery('SELECT g FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g WHERE g.geometry = GeomFromText(:p1)'); - $query->setParameter('p1', 'POINT(5 5)', 'string'); + $query->setParameter('p1', 'LINESTRING(0 0,5 5,10 10)', 'string'); $result = $query->getResult(); @@ -73,24 +82,18 @@ public function testPoint() /** * @group geometry */ - public function testLineString() + public function testPoint() { - $value = array( - new Point(0, 0), - new Point(5, 5), - new Point(10, 10) - ); - $entity1 = new GeometryEntity(); - $entity1->setGeometry(new LineString($value)); + $entity1->setGeometry(new Point(5, 5)); $this->getEntityManager()->persist($entity1); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery('SELECT g FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g WHERE g.geometry = GeomFromText(:p1)'); - $query->setParameter('p1', 'LINESTRING(0 0,5 5,10 10)', 'string'); + $query->setParameter('p1', 'POINT(5 5)', 'string'); $result = $query->getResult(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php index b3c6b373..2fe9fbec 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class MBRContainsTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); $this->usesType('point'); @@ -52,97 +55,97 @@ protected function setUp() /** * @group geometry */ - public function testSelectMBRContains() + public function testMBRContainsWhereParameter() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )); - $lineString2 = new LineString(array( + new Point(0, 0), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); + new Point(5, 5), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString2))); + $entity2->setPolygon(new Polygon([$lineString1, $lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, MBRContains(p.polygon, GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE MBRContains(p.polygon, GeomFromText(:p1)) = 1'); + + $query->setParameter('p1', 'POINT(6 6)', 'string'); + + $result = $query->getResult(); + + $this->assertCount(2, $result); + $this->assertEquals($entity1, $result[0]); + $this->assertEquals($entity2, $result[1]); + $this->getEntityManager()->clear(); + + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE MBRContains(p.polygon, GeomFromText(:p1)) = 1'); $query->setParameter('p1', 'POINT(2 2)', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0][0]); - $this->assertEquals(1, $result[0][1]); - $this->assertEquals($entity2, $result[1][0]); - $this->assertEquals(0, $result[1][1]); + $this->assertEquals($entity1, $result[0]); + $this->assertEquals($entity2, $result[1]); } /** * @group geometry */ - public function testMBRContainsWhereParameter() + public function testSelectMBRContains() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )); - $lineString2 = new LineString(array( + new Point(0, 0), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); + new Point(5, 5), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString1, $lineString2))); + $entity2->setPolygon(new Polygon([$lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE MBRContains(p.polygon, GeomFromText(:p1)) = 1'); - - $query->setParameter('p1', 'POINT(6 6)', 'string'); - - $result = $query->getResult(); - - $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0]); - $this->assertEquals($entity2, $result[1]); - $this->getEntityManager()->clear(); - - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE MBRContains(p.polygon, GeomFromText(:p1)) = 1'); + $query = $this->getEntityManager()->createQuery('SELECT p, MBRContains(p.polygon, GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); $query->setParameter('p1', 'POINT(2 2)', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0]); - $this->assertEquals($entity2, $result[1]); + $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals(1, $result[0][1]); + $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals(0, $result[1][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php index cfbba1e8..28b3bcb2 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class MBRDisjointTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); $this->supportsPlatform('mysql'); @@ -51,126 +54,126 @@ protected function setUp() /** * @group geometry */ - public function testSelectMBRDisjoint() + public function testMBRDisjointWhereParameter() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )); - $lineString2 = new LineString(array( + new Point(0, 0), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); - $lineString3 = new LineString(array( + new Point(5, 5), + ]); + $lineString3 = new LineString([ new Point(15, 15), new Point(17, 15), new Point(17, 17), new Point(15, 17), - new Point(15, 15) - )); + new Point(15, 15), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString2))); + $entity2->setPolygon(new Polygon([$lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $entity3 = new PolygonEntity(); - $entity3->setPolygon(new Polygon(array($lineString3))); + $entity3->setPolygon(new Polygon([$lineString3])); $this->getEntityManager()->persist($entity3); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, MBRDisjoint(p.polygon, GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE MBRDisjoint(p.polygon, GeomFromText(:p1)) = 1'); $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); $result = $query->getResult(); - $this->assertCount(3, $result); - $this->assertEquals($entity1, $result[0][0]); - $this->assertEquals(0, $result[0][1]); - $this->assertEquals($entity2, $result[1][0]); - $this->assertEquals(0, $result[1][1]); - $this->assertEquals($entity3, $result[2][0]); - $this->assertEquals(1, $result[2][1]); + $this->assertCount(1, $result); + $this->assertEquals($entity3, $result[0]); + $this->getEntityManager()->clear(); + + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE MBRDisjoint(p.polygon, GeomFromText(:p1)) = 1'); + + $query->setParameter('p1', 'POLYGON((15 15,17 15,17 17,15 17,15 15))', 'string'); + + $result = $query->getResult(); + + $this->assertCount(2, $result); + $this->assertEquals($entity1, $result[0]); + $this->assertEquals($entity2, $result[1]); } /** * @group geometry */ - public function testMBRDisjointWhereParameter() + public function testSelectMBRDisjoint() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )); - $lineString2 = new LineString(array( + new Point(0, 0), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); - $lineString3 = new LineString(array( + new Point(5, 5), + ]); + $lineString3 = new LineString([ new Point(15, 15), new Point(17, 15), new Point(17, 17), new Point(15, 17), - new Point(15, 15) - )); + new Point(15, 15), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString2))); + $entity2->setPolygon(new Polygon([$lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $entity3 = new PolygonEntity(); - $entity3->setPolygon(new Polygon(array($lineString3))); + $entity3->setPolygon(new Polygon([$lineString3])); $this->getEntityManager()->persist($entity3); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE MBRDisjoint(p.polygon, GeomFromText(:p1)) = 1'); + $query = $this->getEntityManager()->createQuery('SELECT p, MBRDisjoint(p.polygon, GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($entity3, $result[0]); - $this->getEntityManager()->clear(); - - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE MBRDisjoint(p.polygon, GeomFromText(:p1)) = 1'); - - $query->setParameter('p1', 'POLYGON((15 15,17 15,17 17,15 17,15 15))', 'string'); - - $result = $query->getResult(); - - $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0]); - $this->assertEquals($entity2, $result[1]); + $this->assertCount(3, $result); + $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals(0, $result[0][1]); + $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals(0, $result[1][1]); + $this->assertEquals($entity3, $result[2][0]); + $this->assertEquals(1, $result[2][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php index 08898086..b7374e6c 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class StartPointTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); $this->usesType('point'); @@ -53,11 +56,11 @@ protected function setUp() */ public function testStartPointSelect() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(2, 2), - new Point(5, 5) - )); + new Point(5, 5), + ]); $entity1 = new LineStringEntity(); $entity1->setLineString($lineString1); @@ -75,18 +78,18 @@ public function testStartPointSelect() /** * @group geometry */ - public function testStartPointWhereComparePoint() + public function testStartPointWhereCompareLineString() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(2, 2), - new Point(5, 5) - )); - $lineString2 = new LineString(array( + new Point(5, 5), + ]); + $lineString2 = new LineString([ new Point(3, 3), new Point(4, 15), - new Point(5, 22) - )); + new Point(5, 22), + ]); $entity1 = new LineStringEntity(); $entity1->setLineString($lineString1); @@ -99,31 +102,31 @@ public function testStartPointWhereComparePoint() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE StartPoint(l.lineString) = GeomFromText(:p1)'); + $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE StartPoint(l.lineString) = StartPoint(GeomFromText(:p1))'); - $query->setParameter('p1', 'POINT(0 0)', 'string'); + $query->setParameter('p1', 'LINESTRING(3 3,4 15,5 22)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity1, $result[0]); + $this->assertEquals($entity2, $result[0]); } /** * @group geometry */ - public function testStartPointWhereCompareLineString() + public function testStartPointWhereComparePoint() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(2, 2), - new Point(5, 5) - )); - $lineString2 = new LineString(array( + new Point(5, 5), + ]); + $lineString2 = new LineString([ new Point(3, 3), new Point(4, 15), - new Point(5, 22) - )); + new Point(5, 22), + ]); $entity1 = new LineStringEntity(); $entity1->setLineString($lineString1); @@ -136,13 +139,13 @@ public function testStartPointWhereCompareLineString() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE StartPoint(l.lineString) = StartPoint(GeomFromText(:p1))'); + $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE StartPoint(l.lineString) = GeomFromText(:p1)'); - $query->setParameter('p1', 'LINESTRING(3 3,4 15,5 22)', 'string'); + $query->setParameter('p1', 'POINT(0 0)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity2, $result[0]); + $this->assertEquals($entity1, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php index f00dec32..151bf7ab 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class GeometryTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POINT_ENTITY); $this->supportsPlatform('postgresql'); @@ -63,10 +67,10 @@ public function testSelectGeometry() $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(geometry(p.point)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); $result = $query->getResult(); - $expected = array( - array(1 => 'POINT(1 2)'), - array(1 => 'POINT(-2 3)'), - ); + $expected = [ + [1 => 'POINT(1 2)'], + [1 => 'POINT(-2 3)'], + ]; $this->assertEquals($expected, $result); } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php index e5cb48fe..bbed4100 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STAreaTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); $this->supportsPlatform('postgresql'); @@ -54,72 +57,72 @@ protected function setUp() public function testSelectSTArea() { $entity1 = new PolygonEntity(); - $rings1 = array( - new LineString(array( + $rings1 = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )) - ); + new Point(0, 0), + ]), + ]; $entity1->setPolygon(new Polygon($rings1)); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $rings2 = array( - new LineString(array( + $rings2 = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )), - new LineString(array( + new Point(0, 0), + ]), + new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )) - ); + new Point(5, 5), + ]), + ]; $entity2->setPolygon(new Polygon($rings2)); $this->getEntityManager()->persist($entity2); $entity3 = new PolygonEntity(); - $rings3 = array( - new LineString(array( + $rings3 = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 20), new Point(0, 20), new Point(10, 10), - new Point(0, 0) - )) - ); + new Point(0, 0), + ]), + ]; $entity3->setPolygon(new Polygon($rings3)); $this->getEntityManager()->persist($entity3); $entity4 = new PolygonEntity(); - $rings4 = array( - new LineString(array( + $rings4 = [ + new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )) - ); + new Point(5, 5), + ]), + ]; $entity4->setPolygon(new Polygon($rings4)); $this->getEntityManager()->persist($entity4); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT ST_Area(p.polygon) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery('SELECT ST_Area(p.polygon) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); $result = $query->getResult(); $this->assertEquals(100, $result[0][1]); @@ -134,72 +137,72 @@ public function testSelectSTArea() public function testSTAreaWhere() { $entity1 = new PolygonEntity(); - $rings1 = array( - new LineString(array( + $rings1 = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )) - ); + new Point(0, 0), + ]), + ]; $entity1->setPolygon(new Polygon($rings1)); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $rings2 = array( - new LineString(array( + $rings2 = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )), - new LineString(array( + new Point(0, 0), + ]), + new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )) - ); + new Point(5, 5), + ]), + ]; $entity2->setPolygon(new Polygon($rings2)); $this->getEntityManager()->persist($entity2); $entity3 = new PolygonEntity(); - $rings3 = array( - new LineString(array( + $rings3 = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 20), new Point(0, 20), new Point(10, 10), - new Point(0, 0) - )) - ); + new Point(0, 0), + ]), + ]; $entity3->setPolygon(new Polygon($rings3)); $this->getEntityManager()->persist($entity3); $entity4 = new PolygonEntity(); - $rings4 = array( - new LineString(array( + $rings4 = [ + new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )) - ); + new Point(5, 5), + ]), + ]; $entity4->setPolygon(new Polygon($rings4)); $this->getEntityManager()->persist($entity4); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Area(p.polygon) < 50'); + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Area(p.polygon) < 50'); $result = $query->getResult(); $this->assertCount(1, $result); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php index d209ae07..aee7cc3d 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STAsBinaryTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); $this->supportsPlatform('postgresql'); @@ -52,16 +55,16 @@ protected function setUp() */ public function testSTAsBinary() { - $lineString1 = array( + $lineString1 = [ new Point(0, 0), new Point(2, 2), - new Point(5, 5) - ); - $lineString2 = array( + new Point(5, 5), + ]; + $lineString2 = [ new Point(3, 3), new Point(4, 15), - new Point(5, 22) - ); + new Point(5, 22), + ]; $entity1 = new LineStringEntity(); $entity1->setLineString(new LineString($lineString1)); @@ -74,7 +77,7 @@ public function testSTAsBinary() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT ST_AsBinary(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); + $query = $this->getEntityManager()->createQuery('SELECT ST_AsBinary(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); $result = $query->getResult(); $this->assertEquals('010200000003000000000000000000000000000000000000000000000000000040000000000000004000000000000014400000000000001440', bin2hex(stream_get_contents($result[0][1]))); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php index 9ce56abd..c81c5111 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STAsTextTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); $this->supportsPlatform('postgresql'); @@ -52,16 +55,16 @@ protected function setUp() */ public function testSTAsText() { - $lineString1 = array( + $lineString1 = [ new Point(0, 0), new Point(2, 2), - new Point(5, 5) - ); - $lineString2 = array( + new Point(5, 5), + ]; + $lineString2 = [ new Point(3, 3), new Point(4, 15), - new Point(5, 22) - ); + new Point(5, 22), + ]; $entity1 = new LineStringEntity(); $entity1->setLineString(new LineString($lineString1)); @@ -74,7 +77,7 @@ public function testSTAsText() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); + $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); $result = $query->getResult(); $this->assertEquals('LINESTRING(0 0,2 2,5 5)', $result[0][1]); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php index 14e1564a..42b44de8 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STCentroidTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); $this->supportsPlatform('postgresql'); @@ -53,33 +56,33 @@ protected function setUp() */ public function testSelectSTCentroid() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(6, 6), new Point(10, 6), new Point(10, 10), new Point(6, 10), - new Point(6, 6) - )); - $lineString2 = new LineString(array( + new Point(6, 6), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); + new Point(5, 5), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString2))); + $entity2->setPolygon(new Polygon([$lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_AsText(ST_Centroid(p.polygon)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery('SELECT p, ST_AsText(ST_Centroid(p.polygon)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); $result = $query->getResult(); $this->assertCount(2, $result); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php index 5813e44b..3836f7f1 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STClosestPointTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); $this->usesType('point'); @@ -54,33 +57,33 @@ protected function setUp() */ public function testSelectSTClosestPoint() { - $ring1 = new LineString(array( + $ring1 = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )); - $ring2 = new LineString(array( + new Point(0, 0), + ]); + $ring2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); + new Point(5, 5), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($ring1))); + $entity1->setPolygon(new Polygon([$ring1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($ring2))); + $entity2->setPolygon(new Polygon([$ring2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_AsText(ST_ClosestPoint(p.polygon, ST_GeomFromText(:p1))) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery('SELECT p, ST_AsText(ST_ClosestPoint(p.polygon, ST_GeomFromText(:p1))) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); $query->setParameter('p1', 'POINT(2 2)', 'string'); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php index 330853df..7cd8d91c 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STCollectTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POINT_ENTITY); $this->supportsPlatform('postgresql'); @@ -60,9 +64,9 @@ public function testSelectSTCollect() $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(ST_Collect(geometry(p.point), ST_GeomFromText(\'POINT(-2 3)\'))) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); $result = $query->getResult(); - $expected = array( - array(1 => 'MULTIPOINT(1 2,-2 3)'), - ); + $expected = [ + [1 => 'MULTIPOINT(1 2,-2 3)'], + ]; $this->assertEquals($expected, $result); } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php index 0cfe17d8..6c5c99cc 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STContainsProperlyTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); $this->supportsPlatform('postgresql'); @@ -53,33 +56,33 @@ protected function setUp() */ public function testSelectSTContainsProperly() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )); - $lineString2 = new LineString(array( + new Point(0, 0), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); + new Point(5, 5), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString2))); + $entity2->setPolygon(new Polygon([$lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_ContainsProperly(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery('SELECT p, ST_ContainsProperly(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); $query->setParameter('p1', 'LINESTRING(5 5,7 5,7 7,5 7,5 5)', 'string'); @@ -97,33 +100,33 @@ public function testSelectSTContainsProperly() */ public function testSTContainsProperlyWhereParameter() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )); - $lineString2 = new LineString(array( + new Point(0, 0), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); + new Point(5, 5), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString2))); + $entity2->setPolygon(new Polygon([$lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_ContainsProperly(p.polygon, ST_GeomFromText(:p1)) = true'); + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_ContainsProperly(p.polygon, ST_GeomFromText(:p1)) = true'); $query->setParameter('p1', 'LINESTRING(5 5,7 5,7 7,5 7,5 5)', 'string'); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php index c9835234..05469d0c 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STContainsTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); $this->usesType('point'); @@ -54,33 +57,33 @@ protected function setUp() */ public function testSelectSTContains() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )); - $lineString2 = new LineString(array( + new Point(0, 0), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); + new Point(5, 5), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString2))); + $entity2->setPolygon(new Polygon([$lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_Contains(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery('SELECT p, ST_Contains(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); $query->setParameter('p1', 'POINT(2 2)', 'string'); @@ -98,33 +101,33 @@ public function testSelectSTContains() */ public function testSTContainsWhereParameter() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )); - $lineString2 = new LineString(array( + new Point(0, 0), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); + new Point(5, 5), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString1, $lineString2))); + $entity2->setPolygon(new Polygon([$lineString1, $lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Contains(p.polygon, ST_GeomFromText(:p1)) = true'); + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Contains(p.polygon, ST_GeomFromText(:p1)) = true'); $query->setParameter('p1', 'POINT(6 6)', 'string'); @@ -134,7 +137,7 @@ public function testSTContainsWhereParameter() $this->assertEquals($entity1, $result[0]); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Contains(p.polygon, ST_GeomFromText(:p1)) = true'); + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Contains(p.polygon, ST_GeomFromText(:p1)) = true'); $query->setParameter('p1', 'POINT(2 2)', 'string'); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php index eeab7f15..1781fa86 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STCoveredByTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); $this->supportsPlatform('postgresql'); @@ -53,33 +56,33 @@ protected function setUp() */ public function testSelectSTCoveredBy() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(6, 6), new Point(10, 6), new Point(10, 10), new Point(6, 10), - new Point(6, 6) - )); - $lineString2 = new LineString(array( + new Point(6, 6), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); + new Point(5, 5), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString2))); + $entity2->setPolygon(new Polygon([$lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_CoveredBy(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery('SELECT p, ST_CoveredBy(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); @@ -97,33 +100,33 @@ public function testSelectSTCoveredBy() */ public function testSTCoveredByWhereParameter() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(6, 6), new Point(10, 6), new Point(10, 10), new Point(6, 10), - new Point(6, 6) - )); - $lineString2 = new LineString(array( + new Point(6, 6), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); + new Point(5, 5), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString2))); + $entity2->setPolygon(new Polygon([$lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_CoveredBy(p.polygon, ST_GeomFromText(:p1)) = true'); + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_CoveredBy(p.polygon, ST_GeomFromText(:p1)) = true'); $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php index 4fe0528f..75814c92 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STCoversTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); $this->supportsPlatform('postgresql'); @@ -53,33 +56,33 @@ protected function setUp() */ public function testSelectSTCovers() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(6, 6), new Point(10, 6), new Point(10, 10), new Point(6, 10), - new Point(6, 6) - )); - $lineString2 = new LineString(array( + new Point(6, 6), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); + new Point(5, 5), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString2))); + $entity2->setPolygon(new Polygon([$lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_Covers(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery('SELECT p, ST_Covers(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); @@ -97,33 +100,33 @@ public function testSelectSTCovers() */ public function testSTCoversWhereParameter() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(6, 6), new Point(10, 6), new Point(10, 10), new Point(6, 10), - new Point(6, 6) - )); - $lineString2 = new LineString(array( + new Point(6, 6), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); + new Point(5, 5), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString2))); + $entity2->setPolygon(new Polygon([$lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Covers(p.polygon, ST_GeomFromText(:p1)) = true'); + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Covers(p.polygon, ST_GeomFromText(:p1)) = true'); $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php index ca9e46dd..c0f12217 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STCrossesTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); $this->supportsPlatform('postgresql'); @@ -52,37 +55,37 @@ protected function setUp() */ public function testSelectSTCrosses() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), - new Point(10, 10) - )); - $lineString2 = new LineString(array( + new Point(10, 10), + ]); + $lineString2 = new LineString([ new Point(0, 10), - new Point(15, 0) - )); - $lineString3 = new LineString(array( + new Point(15, 0), + ]); + $lineString3 = new LineString([ new Point(2, 0), - new Point(12, 10) - )); + new Point(12, 10), + ]); $entity1 = new LineStringEntity(); $entity1->setLineString($lineString1); $this->getEntityManager()->persist($entity1); - $entity2 = new LineStringEntity(); + $entity2 = new LineStringEntity(); $entity2->setLineString($lineString2); $this->getEntityManager()->persist($entity2); - $entity3 = new LineStringEntity(); + $entity3 = new LineStringEntity(); $entity3->setLineString($lineString3); $this->getEntityManager()->persist($entity3); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l, ST_Crosses(l.lineString, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); + $query = $this->getEntityManager()->createQuery('SELECT l, ST_Crosses(l.lineString, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); $query->setParameter('p1', 'LINESTRING(0 0, 10 10)', 'string'); @@ -102,37 +105,37 @@ public function testSelectSTCrosses() */ public function testSTCrossesWhereParameter() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), - new Point(10, 10) - )); - $lineString2 = new LineString(array( + new Point(10, 10), + ]); + $lineString2 = new LineString([ new Point(0, 10), - new Point(15, 0) - )); - $lineString3 = new LineString(array( + new Point(15, 0), + ]); + $lineString3 = new LineString([ new Point(2, 0), - new Point(12, 10) - )); + new Point(12, 10), + ]); $entity1 = new LineStringEntity(); $entity1->setLineString($lineString1); $this->getEntityManager()->persist($entity1); - $entity2 = new LineStringEntity(); + $entity2 = new LineStringEntity(); $entity2->setLineString($lineString2); $this->getEntityManager()->persist($entity2); - $entity3 = new LineStringEntity(); + $entity3 = new LineStringEntity(); $entity3->setLineString($lineString3); $this->getEntityManager()->persist($entity3); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_Crosses(l.lineString, ST_GeomFromText(:p1)) = true'); + $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_Crosses(l.lineString, ST_GeomFromText(:p1)) = true'); $query->setParameter('p1', 'LINESTRING(0 0, 10 10)', 'string'); @@ -142,7 +145,7 @@ public function testSTCrossesWhereParameter() $this->assertEquals($entity2, $result[0]); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_Crosses(l.lineString, ST_GeomFromText(:p1)) = true'); + $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_Crosses(l.lineString, ST_GeomFromText(:p1)) = true'); $query->setParameter('p1', 'LINESTRING(2 0, 12 10)', 'string'); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php index 335a3e63..baf6e452 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STDisjointTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); $this->supportsPlatform('postgresql'); @@ -53,47 +56,47 @@ protected function setUp() */ public function testSelectSTDisjoint() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )); - $lineString2 = new LineString(array( + new Point(0, 0), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); - $lineString3 = new LineString(array( + new Point(5, 5), + ]); + $lineString3 = new LineString([ new Point(15, 15), new Point(17, 15), new Point(17, 17), new Point(15, 17), - new Point(15, 15) - )); + new Point(15, 15), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString2))); + $entity2->setPolygon(new Polygon([$lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $entity3 = new PolygonEntity(); - $entity3->setPolygon(new Polygon(array($lineString3))); + $entity3->setPolygon(new Polygon([$lineString3])); $this->getEntityManager()->persist($entity3); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_Disjoint(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery('SELECT p, ST_Disjoint(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); @@ -113,47 +116,47 @@ public function testSelectSTDisjoint() */ public function testSTDisjointWhereParameter() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )); - $lineString2 = new LineString(array( + new Point(0, 0), + ]); + $lineString2 = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )); - $lineString3 = new LineString(array( + new Point(5, 5), + ]); + $lineString3 = new LineString([ new Point(15, 15), new Point(17, 15), new Point(17, 17), new Point(15, 17), - new Point(15, 15) - )); + new Point(15, 15), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString2))); + $entity2->setPolygon(new Polygon([$lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $entity3 = new PolygonEntity(); - $entity3->setPolygon(new Polygon(array($lineString3))); + $entity3->setPolygon(new Polygon([$lineString3])); $this->getEntityManager()->persist($entity3); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Disjoint(p.polygon, ST_GeomFromText(:p1)) = true'); + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Disjoint(p.polygon, ST_GeomFromText(:p1)) = true'); $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); @@ -163,7 +166,7 @@ public function testSTDisjointWhereParameter() $this->assertEquals($entity3, $result[0]); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Disjoint(p.polygon, ST_GeomFromText(:p1)) = true'); + $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Disjoint(p.polygon, ST_GeomFromText(:p1)) = true'); $query->setParameter('p1', 'POLYGON((15 15,17 15,17 17,15 17,15 15))', 'string'); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php index 09afa0e5..7e914537 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STDistanceSphereTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POINT_ENTITY); $this->supportsPlatform('postgresql'); @@ -53,9 +54,9 @@ protected function setUp() */ public function testSelectSTDistanceSphereGeometry() { - $newYork = new Point(-73.938611, 40.664167); + $newYork = new Point(-73.938611, 40.664167); $losAngles = new Point(-118.2430, 34.0522); - $dallas = new Point(-96.803889, 32.782778); + $dallas = new Point(-96.803889, 32.782778); $entity1 = new PointEntity(); @@ -74,7 +75,7 @@ public function testSelectSTDistanceSphereGeometry() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_Distance_Sphere(p.point, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); + $query = $this->getEntityManager()->createQuery('SELECT p, ST_Distance_Sphere(p.point, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); $query->setParameter('p1', 'POINT(-89.4 43.066667)', 'string'); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php index 47e8921e..97899c72 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STDistanceTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POINT_ENTITY); $this->usesEntity(self::GEOGRAPHY_ENTITY); @@ -51,32 +54,32 @@ protected function setUp() } /** - * @group geometry + * @group geography */ - public function testSelectSTDistanceGeometryCartesian() + public function testSelectSTDistanceGeographyCartesian() { - $newYork = new Point(-73.938611, 40.664167); - $losAngles = new Point(-118.2430, 34.0522); - $dallas = new Point(-96.803889, 32.782778); + $newYork = new GeographyPoint(-73.938611, 40.664167); + $losAngles = new GeographyPoint(-118.2430, 34.0522); + $dallas = new GeographyPoint(-96.803889, 32.782778); - $entity1 = new PointEntity(); + $entity1 = new GeographyEntity(); - $entity1->setPoint($newYork); + $entity1->setGeography($newYork); $this->getEntityManager()->persist($entity1); - $entity2 = new PointEntity(); + $entity2 = new GeographyEntity(); - $entity2->setPoint($losAngles); + $entity2->setGeography($losAngles); $this->getEntityManager()->persist($entity2); - $entity3 = new PointEntity(); + $entity3 = new GeographyEntity(); - $entity3->setPoint($dallas); + $entity3->setGeography($dallas); $this->getEntityManager()->persist($entity3); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_Distance(p.point, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); + $query = $this->getEntityManager()->createQuery('SELECT g, ST_Distance(g.geography, ST_GeographyFromText(:p1), false) FROM CrEOF\Spatial\Tests\Fixtures\GeographyEntity g'); $query->setParameter('p1', 'POINT(-89.4 43.066667)', 'string'); @@ -84,11 +87,11 @@ public function testSelectSTDistanceGeometryCartesian() $this->assertCount(3, $result); $this->assertEquals($entity1, $result[0][0]); - $this->assertEquals(15.646934398128, $result[0][1]); + $this->assertEquals(1305895.94823465, $result[0][1]); $this->assertEquals($entity2, $result[1][0]); - $this->assertEquals(30.2188561049899, $result[1][1]); + $this->assertEquals(2684082.08249337, $result[1][1]); $this->assertEquals($entity3, $result[2][0]); - $this->assertEquals(12.6718564262953, $result[2][1]); + $this->assertEquals(1313754.60684762, $result[2][1]); } /** @@ -96,9 +99,9 @@ public function testSelectSTDistanceGeometryCartesian() */ public function testSelectSTDistanceGeographySpheroid() { - $newYork = new GeographyPoint(-73.938611, 40.664167); + $newYork = new GeographyPoint(-73.938611, 40.664167); $losAngles = new GeographyPoint(-118.2430, 34.0522); - $dallas = new GeographyPoint(-96.803889, 32.782778); + $dallas = new GeographyPoint(-96.803889, 32.782778); $entity1 = new GeographyEntity(); @@ -117,7 +120,7 @@ public function testSelectSTDistanceGeographySpheroid() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT g, ST_Distance(g.geography, ST_GeographyFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\GeographyEntity g'); + $query = $this->getEntityManager()->createQuery('SELECT g, ST_Distance(g.geography, ST_GeographyFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\GeographyEntity g'); $query->setParameter('p1', 'POINT(-89.4 43.066667)', 'string'); @@ -133,32 +136,32 @@ public function testSelectSTDistanceGeographySpheroid() } /** - * @group geography + * @group geometry */ - public function testSelectSTDistanceGeographyCartesian() + public function testSelectSTDistanceGeometryCartesian() { - $newYork = new GeographyPoint(-73.938611, 40.664167); - $losAngles = new GeographyPoint(-118.2430, 34.0522); - $dallas = new GeographyPoint(-96.803889, 32.782778); + $newYork = new Point(-73.938611, 40.664167); + $losAngles = new Point(-118.2430, 34.0522); + $dallas = new Point(-96.803889, 32.782778); - $entity1 = new GeographyEntity(); + $entity1 = new PointEntity(); - $entity1->setGeography($newYork); + $entity1->setPoint($newYork); $this->getEntityManager()->persist($entity1); - $entity2 = new GeographyEntity(); + $entity2 = new PointEntity(); - $entity2->setGeography($losAngles); + $entity2->setPoint($losAngles); $this->getEntityManager()->persist($entity2); - $entity3 = new GeographyEntity(); + $entity3 = new PointEntity(); - $entity3->setGeography($dallas); + $entity3->setPoint($dallas); $this->getEntityManager()->persist($entity3); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT g, ST_Distance(g.geography, ST_GeographyFromText(:p1), false) FROM CrEOF\Spatial\Tests\Fixtures\GeographyEntity g'); + $query = $this->getEntityManager()->createQuery('SELECT p, ST_Distance(p.point, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); $query->setParameter('p1', 'POINT(-89.4 43.066667)', 'string'); @@ -166,10 +169,10 @@ public function testSelectSTDistanceGeographyCartesian() $this->assertCount(3, $result); $this->assertEquals($entity1, $result[0][0]); - $this->assertEquals(1305895.94823465, $result[0][1]); + $this->assertEquals(15.646934398128, $result[0][1]); $this->assertEquals($entity2, $result[1][0]); - $this->assertEquals(2684082.08249337, $result[1][1]); + $this->assertEquals(30.2188561049899, $result[1][1]); $this->assertEquals($entity3, $result[2][0]); - $this->assertEquals(1313754.60684762, $result[2][1]); + $this->assertEquals(12.6718564262953, $result[2][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php index c9871aaa..b7ce1646 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STEnvelopeTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); $this->supportsPlatform('postgresql'); @@ -54,43 +57,43 @@ protected function setUp() public function testSelectSTEnvelope() { $entity1 = new PolygonEntity(); - $rings1 = array( - new LineString(array( + $rings1 = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )) - ); + new Point(0, 0), + ]), + ]; $entity1->setPolygon(new Polygon($rings1)); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $rings2 = array( - new LineString(array( + $rings2 = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )), - new LineString(array( + new Point(0, 0), + ]), + new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )) - ); + new Point(5, 5), + ]), + ]; $entity2->setPolygon(new Polygon($rings2)); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(ST_Envelope(p.polygon)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(ST_Envelope(p.polygon)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); $result = $query->getResult(); $this->assertEquals('POLYGON((0 0,0 10,10 10,10 0,0 0))', $result[0][1]); @@ -103,36 +106,36 @@ public function testSelectSTEnvelope() public function testSTEnvelopeWhereParameter() { $entity1 = new PolygonEntity(); - $rings1 = array( - new LineString(array( + $rings1 = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )), - new LineString(array( + new Point(0, 0), + ]), + new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )) - ); + new Point(5, 5), + ]), + ]; $entity1->setPolygon(new Polygon($rings1)); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $rings2 = array( - new LineString(array( + $rings2 = [ + new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - )) - ); + new Point(5, 5), + ]), + ]; $entity2->setPolygon(new Polygon($rings2)); $this->getEntityManager()->persist($entity2); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php index c4d05793..6d9cd005 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STGeomFromTextTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::GEOMETRY_ENTITY); $this->supportsPlatform('postgresql'); @@ -50,18 +53,24 @@ protected function setUp() /** * @group geometry */ - public function testPoint() + public function testLineString() { + $value = [ + new Point(0, 0), + new Point(5, 5), + new Point(10, 10), + ]; + $entity1 = new GeometryEntity(); - $entity1->setGeometry(new Point(5, 5)); + $entity1->setGeometry(new LineString($value)); $this->getEntityManager()->persist($entity1); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery('SELECT g FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g WHERE g.geometry = ST_GeomFromText(:geometry)'); - $query->setParameter('geometry', 'POINT(5 5)', 'string'); + $query->setParameter('geometry', 'LINESTRING(0 0,5 5,10 10)', 'string'); $result = $query->getResult(); @@ -72,24 +81,18 @@ public function testPoint() /** * @group geometry */ - public function testLineString() + public function testPoint() { - $value = array( - new Point(0, 0), - new Point(5, 5), - new Point(10, 10) - ); - $entity1 = new GeometryEntity(); - $entity1->setGeometry(new LineString($value)); + $entity1->setGeometry(new Point(5, 5)); $this->getEntityManager()->persist($entity1); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery('SELECT g FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g WHERE g.geometry = ST_GeomFromText(:geometry)'); - $query->setParameter('geometry', 'LINESTRING(0 0,5 5,10 10)', 'string'); + $query->setParameter('geometry', 'POINT(5 5)', 'string'); $result = $query->getResult(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php index 90753a66..885e5126 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STLengthTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); $this->supportsPlatform('postgresql'); @@ -55,18 +58,18 @@ public function testSelectSTLength() $entity = new LineStringEntity(); $entity->setLineString(new LineString( - array( + [ new Point(0, 0), new Point(1, 1), - new Point(2, 2) - )) + new Point(2, 2), + ]) ); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l, ST_Length(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); + $query = $this->getEntityManager()->createQuery('SELECT l, ST_Length(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); $result = $query->getResult(); $this->assertCount(1, $result); @@ -82,11 +85,11 @@ public function testSTLengthWhereParameter() $entity = new LineStringEntity(); $entity->setLineString(new LineString( - array( - new Point(0, 0), - new Point(1, 1), - new Point(2, 2) - )) + [ + new Point(0, 0), + new Point(1, 1), + new Point(2, 2), + ]) ); $this->getEntityManager()->persist($entity); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php index 96d55267..3e5ddf23 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STLineCrossingDirectionTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); $this->supportsPlatform('postgresql'); @@ -52,21 +55,21 @@ protected function setUp() */ public function testSelectSTLineCrossingDirection() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(8, 15), - new Point(4, 8) - )); - $lineString2 = new LineString(array( + new Point(4, 8), + ]); + $lineString2 = new LineString([ new Point(12, 14), - new Point(3, 4) - )); - $lineString3 = new LineString(array( + new Point(3, 4), + ]); + $lineString3 = new LineString([ new Point(2, 5), new Point(3, 6), new Point(12, 8), new Point(10, 10), - new Point(13, 11) - )); + new Point(13, 11), + ]); $entity1 = new LineStringEntity(); @@ -105,21 +108,21 @@ public function testSelectSTLineCrossingDirection() */ public function testSTLineCrossingDirectionWhereParameter() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(8, 15), - new Point(4, 8) - )); - $lineString2 = new LineString(array( + new Point(4, 8), + ]); + $lineString2 = new LineString([ new Point(12, 14), - new Point(3, 4) - )); - $lineString3 = new LineString(array( + new Point(3, 4), + ]); + $lineString3 = new LineString([ new Point(2, 5), new Point(3, 6), new Point(12, 8), new Point(10, 10), - new Point(13, 11) - )); + new Point(13, 11), + ]); $entity1 = new LineStringEntity(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php index f9b63f0f..dbf517bc 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php @@ -1,5 +1,6 @@ usesEntity(self::POLYGON_ENTITY); $this->supportsPlatform('postgresql'); @@ -54,17 +57,17 @@ protected function setUp() public function testSelectSTMakeEnvelope() { $entity = new PolygonEntity(); - $rings = array( + $rings = [ new LineString( - array( + [ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), new Point(0, 0), - ) + ] ), - ); + ]; $entity->setPolygon(new Polygon($rings)); $this->getEntityManager()->persist($entity); @@ -77,9 +80,9 @@ public function testSelectSTMakeEnvelope() ); $result = $query->getResult(); - $expected = array( - array(1 => 'POLYGON((5 5,5 10,10 10,10 5,5 5))'), - ); + $expected = [ + [1 => 'POLYGON((5 5,5 10,10 10,10 5,5 5))'], + ]; $this->assertEquals($expected, $result); } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php index 787414d7..40d15ca2 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php @@ -1,7 +1,7 @@ usesEntity(self::POLYGON_ENTITY); $this->supportsPlatform('postgresql'); @@ -53,28 +56,28 @@ protected function setUp() */ public function testSelectSTMakeEnvelope() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(2, 0), new Point(2, 2), new Point(0, 2), - new Point(0, 0) - )); - $lineString2 = new LineString(array( + new Point(0, 0), + ]); + $lineString2 = new LineString([ new Point(2, 2), new Point(7, 2), new Point(7, 7), new Point(2, 7), - new Point(2, 2) - )); + new Point(2, 2), + ]); $entity1 = new PolygonEntity(); - $entity1->setPolygon(new Polygon(array($lineString1))); + $entity1->setPolygon(new Polygon([$lineString1])); $this->getEntityManager()->persist($entity1); $entity2 = new PolygonEntity(); - $entity2->setPolygon(new Polygon(array($lineString2))); + $entity2->setPolygon(new Polygon([$lineString2])); $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php index f904dd4a..06f2a54a 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php @@ -1,4 +1,26 @@ usesEntity(self::POINT_ENTITY); $this->supportsPlatform('postgresql'); @@ -39,9 +64,9 @@ public function testSelectSTSnapToGridSignature2Parameters() $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(ST_SnapToGrid(geometry(p.point), 0.5)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); $result = $query->getResult(); - $expected = array( - array(1 => 'POINT(1 2.5)'), - ); + $expected = [ + [1 => 'POINT(1 2.5)'], + ]; $this->assertEquals($expected, $result); } @@ -61,9 +86,9 @@ public function testSelectSTSnapToGridSignature3Parameters() $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(ST_SnapToGrid(geometry(p.point), 0.5, 1)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); $result = $query->getResult(); - $expected = array( - array(1 => 'POINT(1 3)'), - ); + $expected = [ + [1 => 'POINT(1 3)'], + ]; $this->assertEquals($expected, $result); } @@ -83,9 +108,9 @@ public function testSelectSTSnapToGridSignature5Parameters() $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(ST_SnapToGrid(geometry(p.point), 5.55, 6.25, 0.5, 0.5)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); $result = $query->getResult(); - $expected = array( - array(1 => 'POINT(5.05 6.75)'), - ); + $expected = [ + [1 => 'POINT(5.05 6.75)'], + ]; $this->assertEquals($expected, $result); } @@ -105,9 +130,9 @@ public function testSelectSTSnapToGridSignature6Parameters() $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(ST_SnapToGrid(geometry(p.point), geometry(p.point), 0.005, 0.025, 0.5, 0.01)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); $result = $query->getResult(); - $expected = array( - array(1 => 'POINT(5.25 6.55)'), - ); + $expected = [ + [1 => 'POINT(5.25 6.55)'], + ]; $this->assertEquals($expected, $result); } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php index 4698b75c..e0178b08 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STStartPointTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); $this->supportsPlatform('postgresql'); @@ -52,11 +55,11 @@ protected function setUp() */ public function testSTStartPointSelect() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(2, 2), - new Point(5, 5) - )); + new Point(5, 5), + ]); $entity1 = new LineStringEntity(); $entity1->setLineString($lineString1); @@ -74,18 +77,18 @@ public function testSTStartPointSelect() /** * @group geometry */ - public function testSTStartPointWhereComparePoint() + public function testSTStartPointWhereCompareLineString() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(2, 2), - new Point(5, 5) - )); - $lineString2 = new LineString(array( + new Point(5, 5), + ]); + $lineString2 = new LineString([ new Point(3, 3), new Point(4, 15), - new Point(5, 22) - )); + new Point(5, 22), + ]); $entity1 = new LineStringEntity(); $entity1->setLineString($lineString1); @@ -98,31 +101,31 @@ public function testSTStartPointWhereComparePoint() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_StartPoint(l.lineString) = ST_GeomFromText(:p1)'); + $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_StartPoint(l.lineString) = ST_StartPoint(ST_GeomFromText(:p1))'); - $query->setParameter('p1', 'POINT(0 0)', 'string'); + $query->setParameter('p1', 'LINESTRING(3 3, 4 15, 5 22)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity1, $result[0]); + $this->assertEquals($entity2, $result[0]); } /** * @group geometry */ - public function testSTStartPointWhereCompareLineString() + public function testSTStartPointWhereComparePoint() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(2, 2), - new Point(5, 5) - )); - $lineString2 = new LineString(array( + new Point(5, 5), + ]); + $lineString2 = new LineString([ new Point(3, 3), new Point(4, 15), - new Point(5, 22) - )); + new Point(5, 22), + ]); $entity1 = new LineStringEntity(); $entity1->setLineString($lineString1); @@ -135,13 +138,13 @@ public function testSTStartPointWhereCompareLineString() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_StartPoint(l.lineString) = ST_StartPoint(ST_GeomFromText(:p1))'); + $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_StartPoint(l.lineString) = ST_GeomFromText(:p1)'); - $query->setParameter('p1', 'LINESTRING(3 3, 4 15, 5 22)', 'string'); + $query->setParameter('p1', 'POINT(0 0)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity2, $result[0]); + $this->assertEquals($entity1, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php index 4835da2e..3ff15b34 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class STSummaryTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::GEOMETRY_ENTITY); $this->usesEntity(self::GEOGRAPHY_ENTITY); @@ -54,108 +57,108 @@ protected function setUp() } /** - * @group geometry + * @group geography */ - public function testSelectSTSummaryGeometry() + public function testSelectSTSummaryGeography() { - $entity1 = new GeometryEntity(); - $point1 = new Point(5, 5); + $entity1 = new GeographyEntity(); + $point1 = new GeographyPoint(5, 5); - $entity1->setGeometry($point1); + $entity1->setGeography($point1); $this->getEntityManager()->persist($entity1); - $entity2 = new GeometryEntity(); - $lineString2 = new LineString( - array( - array(1, 1), - array(2, 2), - array(3, 3) - ) + $entity2 = new GeographyEntity(); + $lineString2 = new GeographyLineString( + [ + [1, 1], + [2, 2], + [3, 3], + ] ); - $entity2->setGeometry($lineString2); + $entity2->setGeography($lineString2); $this->getEntityManager()->persist($entity2); - $entity3 = new GeometryEntity(); - $polygon3 = new Polygon( - array( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ) - ) + $entity3 = new GeographyEntity(); + $polygon3 = new GeographyPolygon( + [ + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + ] ); - $entity3->setGeometry($polygon3); + $entity3->setGeography($polygon3); $this->getEntityManager()->persist($entity3); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT g, ST_Summary(g.geometry) FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g'); + $query = $this->getEntityManager()->createQuery('SELECT g, ST_Summary(g.geography) FROM CrEOF\Spatial\Tests\Fixtures\GeographyEntity g'); $result = $query->getResult(); $this->assertCount(3, $result); $this->assertEquals($entity1, $result[0][0]); - $this->assertRegExp('/^Point\[[^G]*\]/', $result[0][1]); + $this->assertRegExp('/^Point\[.*G.*\]/', $result[0][1]); $this->assertEquals($entity2, $result[1][0]); - $this->assertRegExp('/^LineString\[[^G]*\]/', $result[1][1]); + $this->assertRegExp('/^LineString\[.*G.*\]/', $result[1][1]); $this->assertEquals($entity3, $result[2][0]); - $this->assertRegExp('/^Polygon\[[^G]*\]/', $result[2][1]); + $this->assertRegExp('/^Polygon\[.*G.*\]/', $result[2][1]); } /** - * @group geography + * @group geometry */ - public function testSelectSTSummaryGeography() + public function testSelectSTSummaryGeometry() { - $entity1 = new GeographyEntity(); - $point1 = new GeographyPoint(5, 5); + $entity1 = new GeometryEntity(); + $point1 = new Point(5, 5); - $entity1->setGeography($point1); + $entity1->setGeometry($point1); $this->getEntityManager()->persist($entity1); - $entity2 = new GeographyEntity(); - $lineString2 = new GeographyLineString( - array( - array(1, 1), - array(2, 2), - array(3, 3) - ) + $entity2 = new GeometryEntity(); + $lineString2 = new LineString( + [ + [1, 1], + [2, 2], + [3, 3], + ] ); - $entity2->setGeography($lineString2); + $entity2->setGeometry($lineString2); $this->getEntityManager()->persist($entity2); - $entity3 = new GeographyEntity(); - $polygon3 = new GeographyPolygon( - array( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ) - ) + $entity3 = new GeometryEntity(); + $polygon3 = new Polygon( + [ + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + ] ); - $entity3->setGeography($polygon3); + $entity3->setGeometry($polygon3); $this->getEntityManager()->persist($entity3); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT g, ST_Summary(g.geography) FROM CrEOF\Spatial\Tests\Fixtures\GeographyEntity g'); + $query = $this->getEntityManager()->createQuery('SELECT g, ST_Summary(g.geometry) FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g'); $result = $query->getResult(); $this->assertCount(3, $result); $this->assertEquals($entity1, $result[0][0]); - $this->assertRegExp('/^Point\[.*G.*\]/', $result[0][1]); + $this->assertRegExp('/^Point\[[^G]*\]/', $result[0][1]); $this->assertEquals($entity2, $result[1][0]); - $this->assertRegExp('/^LineString\[.*G.*\]/', $result[1][1]); + $this->assertRegExp('/^LineString\[[^G]*\]/', $result[1][1]); $this->assertEquals($entity3, $result[2][0]); - $this->assertRegExp('/^Polygon\[.*G.*\]/', $result[2][1]); + $this->assertRegExp('/^Polygon\[[^G]*\]/', $result[2][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php index 388bf4ef..6901a977 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class GeometryWalkerTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); parent::setUp(); @@ -50,16 +54,16 @@ protected function setUp() */ public function testGeometryWalkerBinary() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(2, 2), - new Point(5, 5) - )); - $lineString2 = new LineString(array( + new Point(5, 5), + ]); + $lineString2 = new LineString([ new Point(3, 3), new Point(4, 15), - new Point(5, 22) - )); + new Point(5, 22), + ]); $entity1 = new LineStringEntity(); $entity1->setLineString($lineString1); @@ -74,14 +78,14 @@ public function testGeometryWalkerBinary() switch ($this->getPlatform()->getName()) { case 'mysql': - $asBinary = 'AsBinary'; + $asBinary = 'AsBinary'; $startPoint = 'StartPoint'; - $envelope = 'Envelope'; + $envelope = 'Envelope'; break; default: - $asBinary = 'ST_AsBinary'; + $asBinary = 'ST_AsBinary'; $startPoint = 'ST_StartPoint'; - $envelope = 'ST_Envelope'; + $envelope = 'ST_Envelope'; break; } @@ -107,16 +111,16 @@ public function testGeometryWalkerBinary() */ public function testGeometryWalkerText() { - $lineString1 = new LineString(array( + $lineString1 = new LineString([ new Point(0, 0), new Point(2, 2), - new Point(5, 5) - )); - $lineString2 = new LineString(array( + new Point(5, 5), + ]); + $lineString2 = new LineString([ new Point(3, 3), new Point(4, 15), - new Point(5, 22) - )); + new Point(5, 22), + ]); $entity1 = new LineStringEntity(); $entity1->setLineString($lineString1); @@ -131,14 +135,14 @@ public function testGeometryWalkerText() switch ($this->getPlatform()->getName()) { case 'mysql': - $asText = 'AsText'; + $asText = 'AsText'; $startPoint = 'StartPoint'; - $envelope = 'Envelope'; + $envelope = 'Envelope'; break; default: - $asText = 'ST_AsText'; + $asText = 'ST_AsText'; $startPoint = 'ST_StartPoint'; - $envelope = 'ST_Envelope'; + $envelope = 'ST_Envelope'; break; } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php index 8cea8439..9a4b2227 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group dql + * + * @internal + * @coversNothing */ class WrappingTest extends OrmTestCase { - protected function setUp() + protected function setUp(): void { $this->usesEntity(self::GEOMETRY_ENTITY); $this->usesType('point'); @@ -56,16 +59,16 @@ protected function setUp() */ public function testTypeWrappingSelect() { - $lineString = new LineString(array( + $lineString = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - )); + new Point(0, 0), + ]); $entity = new PolygonEntity(); - $entity->setPolygon(new Polygon(array($lineString))); + $entity->setPolygon(new Polygon([$lineString])); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); @@ -90,7 +93,7 @@ public function testTypeWrappingSelect() $query->setParameter('geometry', new Point(2, 2), 'point'); $query->processParameterValue('geometry'); - $result = $query->getSQL(); + $result = $query->getSQL(); $parameter = '?'; if (Version::compare('2.5') <= 0) { @@ -119,7 +122,7 @@ public function testTypeWrappingWhere() $query->setParameter('geometry', new Point(5, 5), 'point'); $query->processParameterValue('geometry'); - $result = $query->getSQL(); + $result = $query->getSQL(); $parameter = '?'; if (Version::compare('2.5') <= 0) { diff --git a/tests/CrEOF/Spatial/Tests/OrmMockTestCase.php b/tests/CrEOF/Spatial/Tests/OrmMockTestCase.php index ca0a5726..1a5a8628 100644 --- a/tests/CrEOF/Spatial/Tests/OrmMockTestCase.php +++ b/tests/CrEOF/Spatial/Tests/OrmMockTestCase.php @@ -1,4 +1,26 @@ mockEntityManager = $this->getMockEntityManager(); } protected function getMockConnection() { - $driver = $this->getMockBuilder('Doctrine\DBAL\Driver\PDOSqlite\Driver') - ->setMethods(array('getDatabasePlatform')) - ->getMock(); + $driver = $this->getMockBuilder('Doctrine\DBAL\Driver\PDOSqlite\Driver') + ->setMethods(['getDatabasePlatform']) + ->getMock() + ; $platform = $this->getMockBuilder('Doctrine\DBAL\Platforms\SqlitePlatform') - ->setMethods(array('getName')) - ->getMock(); + ->setMethods(['getName']) + ->getMock() + ; $platform->method('getName') - ->willReturn('YourSQL'); + ->willReturn('YourSQL') + ; $driver->method('getDatabasePlatform') - ->willReturn($platform); - - $connection = new Connection(array(), $driver); + ->willReturn($platform) + ; - return $connection; + return new Connection([], $driver); } /** @@ -49,10 +74,10 @@ protected function getMockEntityManager() $config = new Configuration(); - $config->setMetadataCacheImpl(new ArrayCache); - $config->setProxyDir(__DIR__ . '/Proxies'); + $config->setMetadataCacheImpl(new ArrayCache()); + $config->setProxyDir(__DIR__.'/Proxies'); $config->setProxyNamespace('CrEOF\Spatial\Tests\Proxies'); - $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver(array(realpath(__DIR__ . '/Fixtures')), true)); + $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver([realpath(__DIR__.'/Fixtures')], true)); return EntityManager::create($this->getMockConnection(), $config); } diff --git a/tests/CrEOF/Spatial/Tests/OrmTestCase.php b/tests/CrEOF/Spatial/Tests/OrmTestCase.php index 35d1a823..f2f1ea35 100644 --- a/tests/CrEOF/Spatial/Tests/OrmTestCase.php +++ b/tests/CrEOF/Spatial/Tests/OrmTestCase.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT */ -abstract class OrmTestCase extends \PHPUnit_Framework_TestCase +abstract class OrmTestCase extends TestCase { - const GEOMETRY_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\GeometryEntity'; - const NO_HINT_GEOMETRY_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\NoHintGeometryEntity'; - const POINT_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\PointEntity'; - const LINESTRING_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\LineStringEntity'; - const POLYGON_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\PolygonEntity'; - const MULTIPOLYGON_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\MultiPolygonEntity'; - const GEOGRAPHY_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\GeographyEntity'; - const GEO_POINT_SRID_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\GeoPointSridEntity'; - const GEO_LINESTRING_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\GeoLineStringEntity'; - const GEO_POLYGON_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\GeoPolygonEntity'; + public const GEO_LINESTRING_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\GeoLineStringEntity'; + public const GEO_POINT_SRID_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\GeoPointSridEntity'; + public const GEO_POLYGON_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\GeoPolygonEntity'; + public const GEOGRAPHY_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\GeographyEntity'; + public const GEOMETRY_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\GeometryEntity'; + public const LINESTRING_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\LineStringEntity'; + public const MULTIPOLYGON_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\MultiPolygonEntity'; + public const NO_HINT_GEOMETRY_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\NoHintGeometryEntity'; + public const POINT_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\PointEntity'; + public const POLYGON_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\PolygonEntity'; /** - * @var EntityManager + * @var bool[] */ - protected $entityManager; + protected static $addedTypes = []; /** - * @var bool[] + * @var Connection */ - protected $usedTypes = array(); + protected static $connection; /** * @var bool[] */ - protected $usedEntities = array(); + protected static $createdEntities = []; /** - * @var bool[] + * @var array[] */ - protected $supportedPlatforms = array(); + protected static $entities = [ + self::GEOMETRY_ENTITY => [ + 'types' => ['geometry'], + 'table' => 'GeometryEntity', + ], + self::NO_HINT_GEOMETRY_ENTITY => [ + 'types' => ['geometry'], + 'table' => 'NoHintGeometryEntity', + ], + self::POINT_ENTITY => [ + 'types' => ['point'], + 'table' => 'PointEntity', + ], + self::LINESTRING_ENTITY => [ + 'types' => ['linestring'], + 'table' => 'LineStringEntity', + ], + self::POLYGON_ENTITY => [ + 'types' => ['polygon'], + 'table' => 'PolygonEntity', + ], + self::MULTIPOLYGON_ENTITY => [ + 'types' => ['multipolygon'], + 'table' => 'MultiPolygonEntity', + ], + self::GEOGRAPHY_ENTITY => [ + 'types' => ['geography'], + 'table' => 'GeographyEntity', + ], + self::GEO_POINT_SRID_ENTITY => [ + 'types' => ['geopoint'], + 'table' => 'GeoPointSridEntity', + ], + self::GEO_LINESTRING_ENTITY => [ + 'types' => ['geolinestring'], + 'table' => 'GeoLineStringEntity', + ], + self::GEO_POLYGON_ENTITY => [ + 'types' => ['geopolygon'], + 'table' => 'GeoPolygonEntity', + ], + ]; /** - * @var bool[] + * @var string[] */ - protected static $createdEntities = array(); + protected static $types = [ + 'geometry' => 'CrEOF\Spatial\DBAL\Types\GeometryType', + 'point' => 'CrEOF\Spatial\DBAL\Types\Geometry\PointType', + 'linestring' => 'CrEOF\Spatial\DBAL\Types\Geometry\LineStringType', + 'polygon' => 'CrEOF\Spatial\DBAL\Types\Geometry\PolygonType', + 'multipolygon' => 'CrEOF\Spatial\DBAL\Types\Geometry\MultiPolygonType', + 'geography' => 'CrEOF\Spatial\DBAL\Types\GeographyType', + 'geopoint' => 'CrEOF\Spatial\DBAL\Types\Geography\PointType', + 'geolinestring' => 'CrEOF\Spatial\DBAL\Types\Geography\LineStringType', + 'geopolygon' => 'CrEOF\Spatial\DBAL\Types\Geography\PolygonType', + ]; /** - * @var bool[] + * @var EntityManager */ - protected static $addedTypes = array(); + protected $entityManager; /** - * @var Connection + * @var bool[] */ - protected static $connection; + protected $supportedPlatforms = []; /** - * @var array[] + * @var bool[] */ - protected static $entities = array( - self::GEOMETRY_ENTITY => array( - 'types' => array('geometry'), - 'table' => 'GeometryEntity' - ), - self::NO_HINT_GEOMETRY_ENTITY => array( - 'types' => array('geometry'), - 'table' => 'NoHintGeometryEntity' - ), - self::POINT_ENTITY => array( - 'types' => array('point'), - 'table' => 'PointEntity' - ), - self::LINESTRING_ENTITY => array( - 'types' => array('linestring'), - 'table' => 'LineStringEntity' - ), - self::POLYGON_ENTITY => array( - 'types' => array('polygon'), - 'table' => 'PolygonEntity' - ), - self::MULTIPOLYGON_ENTITY => array( - 'types' => array('multipolygon'), - 'table' => 'MultiPolygonEntity' - ), - self::GEOGRAPHY_ENTITY => array( - 'types' => array('geography'), - 'table' => 'GeographyEntity' - ), - self::GEO_POINT_SRID_ENTITY => array( - 'types' => array('geopoint'), - 'table' => 'GeoPointSridEntity' - ), - self::GEO_LINESTRING_ENTITY => array( - 'types' => array('geolinestring'), - 'table' => 'GeoLineStringEntity' - ), - self::GEO_POLYGON_ENTITY => array( - 'types' => array('geopolygon'), - 'table' => 'GeoPolygonEntity' - ) - ); + protected $usedEntities = []; /** - * @var string[] + * @var bool[] */ - protected static $types = array( - 'geometry' => 'CrEOF\Spatial\DBAL\Types\GeometryType', - 'point' => 'CrEOF\Spatial\DBAL\Types\Geometry\PointType', - 'linestring' => 'CrEOF\Spatial\DBAL\Types\Geometry\LineStringType', - 'polygon' => 'CrEOF\Spatial\DBAL\Types\Geometry\PolygonType', - 'multipolygon' => 'CrEOF\Spatial\DBAL\Types\Geometry\MultiPolygonType', - 'geography' => 'CrEOF\Spatial\DBAL\Types\GeographyType', - 'geopoint' => 'CrEOF\Spatial\DBAL\Types\Geography\PointType', - 'geolinestring' => 'CrEOF\Spatial\DBAL\Types\Geography\LineStringType', - 'geopolygon' => 'CrEOF\Spatial\DBAL\Types\Geography\PolygonType' - ); + protected $usedTypes = []; /** * @var SchemaTool */ @@ -162,7 +164,7 @@ abstract class OrmTestCase extends \PHPUnit_Framework_TestCase /** * @throws UnsupportedPlatformException */ - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { static::$connection = static::getConnection(); } @@ -173,14 +175,14 @@ public static function setUpBeforeClass() * * @throws UnsupportedPlatformException */ - protected function setUp() + protected function setUp(): void { - if (count($this->supportedPlatforms) && ! isset($this->supportedPlatforms[$this->getPlatform()->getName()])) { + if (count($this->supportedPlatforms) && !isset($this->supportedPlatforms[$this->getPlatform()->getName()])) { $this->markTestSkipped(sprintf('No support for platform %s in test class %s.', $this->getPlatform()->getName(), get_class($this))); } $this->entityManager = $this->getEntityManager(); - $this->schemaTool = $this->getSchemaTool(); + $this->schemaTool = $this->getSchemaTool(); if ($GLOBALS['opt_mark_sql']) { static::getConnection()->executeQuery(sprintf('SELECT 1 /*%s*//*%s*/', get_class($this), $this->getName())); @@ -194,67 +196,146 @@ protected function setUp() } /** - * @return EntityManager + * Teardown fixtures. */ - protected function getEntityManager() + protected function tearDown(): void { - if (isset($this->entityManager)) { - return $this->entityManager; + $this->sqlLoggerStack->enabled = false; + + foreach (array_keys($this->usedEntities) as $entityName) { + static::getConnection()->executeUpdate(sprintf('DELETE FROM %s', static::$entities[$entityName]['table'])); } - $this->sqlLoggerStack = new DebugStack(); - $this->sqlLoggerStack->enabled = false; + $this->getEntityManager()->clear(); + } - static::getConnection()->getConfiguration()->setSQLLogger($this->sqlLoggerStack); + /** + * @return array + */ + protected static function getCommonConnectionParameters() + { + $connectionParams = [ + 'driver' => $GLOBALS['db_type'], + 'user' => $GLOBALS['db_username'], + 'password' => $GLOBALS['db_password'], + 'host' => $GLOBALS['db_host'], + 'dbname' => null, + 'port' => $GLOBALS['db_port'], + ]; - $config = new Configuration(); + if (isset($GLOBALS['db_server'])) { + $connectionParams['server'] = $GLOBALS['db_server']; + } - $config->setMetadataCacheImpl(new ArrayCache); - $config->setProxyDir(__DIR__ . '/Proxies'); - $config->setProxyNamespace('CrEOF\Spatial\Tests\Proxies'); - $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver(array(realpath(__DIR__ . '/Fixtures')), true)); + if (isset($GLOBALS['db_unix_socket'])) { + $connectionParams['unix_socket'] = $GLOBALS['db_unix_socket']; + } - return EntityManager::create(static::getConnection(), $config); + return $connectionParams; } /** - * @return SchemaTool + * @throws UnsupportedPlatformException + * @throws \Doctrine\DBAL\DBALException + * + * @return Connection */ - protected function getSchemaTool() + protected static function getConnection() { - if (isset($this->schemaTool)) { - return $this->schemaTool; + if (isset(static::$connection)) { + return static::$connection; } - return new SchemaTool($this->getEntityManager()); + $connection = DriverManager::getConnection(static::getConnectionParameters()); + + switch ($connection->getDatabasePlatform()->getName()) { + case 'postgresql': + $connection->exec('CREATE EXTENSION postgis'); + break; + case 'mysql': + break; + default: + throw new UnsupportedPlatformException(sprintf('DBAL platform "%s" is not currently supported.', $connection->getDatabasePlatform()->getName())); + } + + return $connection; } /** - * @param string $typeName + * @throws \Doctrine\DBAL\DBALException + * + * @return array */ - protected function usesType($typeName) + protected static function getConnectionParameters() { - $this->usedTypes[$typeName] = true; + $parameters = static::getCommonConnectionParameters(); + $parameters['dbname'] = $GLOBALS['db_name']; + + $connection = DriverManager::getConnection($parameters); + $dbName = $connection->getDatabase(); + + $connection->close(); + + $tmpConnection = DriverManager::getConnection(static::getCommonConnectionParameters()); + + $tmpConnection->getSchemaManager()->dropAndCreateDatabase($dbName); + $tmpConnection->close(); + + return $parameters; } /** - * @param string $platform + * Using the SQL Logger Stack this method retrieves the current query count executed in this test. + * + * @return int */ - protected function supportsPlatform($platform) + protected function getCurrentQueryCount() { - $this->supportedPlatforms[$platform] = true; + return count($this->sqlLoggerStack->queries); } /** - * @param string $entityClass + * @return EntityManager */ - protected function usesEntity($entityClass) + protected function getEntityManager() { - $this->usedEntities[$entityClass] = true; + if (isset($this->entityManager)) { + return $this->entityManager; + } - foreach (static::$entities[$entityClass]['types'] as $type) { - $this->usesType($type); + $this->sqlLoggerStack = new DebugStack(); + $this->sqlLoggerStack->enabled = false; + + static::getConnection()->getConfiguration()->setSQLLogger($this->sqlLoggerStack); + + $config = new Configuration(); + + $config->setMetadataCacheImpl(new ArrayCache()); + $config->setProxyDir(__DIR__.'/Proxies'); + $config->setProxyNamespace('CrEOF\Spatial\Tests\Proxies'); + $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver([realpath(__DIR__.'/Fixtures')], true)); + + return EntityManager::create(static::getConnection(), $config); + } + + /** + * @return AbstractPlatform + */ + protected function getPlatform() + { + return static::getConnection()->getDatabasePlatform(); + } + + /** + * @return SchemaTool + */ + protected function getSchemaTool() + { + if (isset($this->schemaTool)) { + return $this->schemaTool; } + + return new SchemaTool($this->getEntityManager()); } /** @@ -266,37 +347,68 @@ protected function getUsedEntityClasses() } /** - * Add types used by test to DBAL + * @throws Exception + * + * @todo: This needs cleanup */ - protected function setUpTypes() + protected function onNotSuccessfulTest(Exception $e): void { - foreach (array_keys($this->usedTypes) as $typeName) { - if (! isset(static::$addedTypes[$typeName]) && ! Type::hasType($typeName)) { - Type::addType($typeName, static::$types[$typeName]); + if (!$GLOBALS['opt_use_debug_stack'] || $e instanceof \PHPUnit\Framework\AssertionFailedError) { + throw $e; + } - $type = Type::getType($typeName); + if (isset($this->sqlLoggerStack->queries) && count($this->sqlLoggerStack->queries)) { + $queries = ''; + $count = count($this->sqlLoggerStack->queries) - 1; + $max = max(count($this->sqlLoggerStack->queries) - 25, 0); - // Since doctrineTypeComments may already be initialized check if added type requires comment - if ($type->requiresSQLCommentHint($this->getPlatform()) && ! $this->getPlatform()->isCommentedDoctrineType($type)) { - $this->getPlatform()->markDoctrineTypeCommented(Type::getType($typeName)); - } + for ($i = $count; $i > $max && isset($this->sqlLoggerStack->queries[$i]); --$i) { + $query = $this->sqlLoggerStack->queries[$i]; + $params = array_map(function ($param) { + if (is_object($param)) { + return get_class($param); + } - static::$addedTypes[$typeName] = true; + return sprintf("'%s'", $param); + }, $query['params'] ?: []); + + $queries .= sprintf("%2d. SQL: '%s' Params: %s\n", $i, $query['sql'], implode(', ', $params)); + } + + $trace = $e->getTrace(); + $traceMsg = ''; + + foreach ($trace as $part) { + if (isset($part['file'])) { + if (false !== mb_strpos($part['file'], 'PHPUnit/')) { + // Beginning with PHPUnit files we don't print the trace anymore. + break; + } + + $traceMsg .= sprintf("%s:%s\n", $part['file'], $part['line']); + } } + + $message = sprintf("[%s] %s\n\n", get_class($e), $e->getMessage()); + $message .= sprintf("With queries:\n%s\nTrace:\n%s", $queries, $traceMsg); + + throw new Exception($message, (int) $e->getCode(), $e); } + + throw $e; } /** - * Create entities used by tests + * Create entities used by tests. */ protected function setUpEntities() { - $classes = array(); + $classes = []; foreach (array_keys($this->usedEntities) as $entityClass) { - if (! isset(static::$createdEntities[$entityClass])) { + if (!isset(static::$createdEntities[$entityClass])) { static::$createdEntities[$entityClass] = true; - $classes[] = $this->getEntityManager()->getClassMetadata($entityClass); + $classes[] = $this->getEntityManager()->getClassMetadata($entityClass); } } @@ -306,13 +418,13 @@ protected function setUpEntities() } /** - * Setup DQL functions + * Setup DQL functions. */ protected function setUpFunctions() { $configuration = $this->getEntityManager()->getConfiguration(); - if ($this->getPlatform()->getName() == 'postgresql') { + if ('postgresql' == $this->getPlatform()->getName()) { $configuration->addCustomStringFunction('geometry', 'CrEOF\Spatial\ORM\Query\AST\Functions\PostgreSql\Geometry'); $configuration->addCustomStringFunction('st_asbinary', 'CrEOF\Spatial\ORM\Query\AST\Functions\PostgreSql\STAsBinary'); $configuration->addCustomStringFunction('st_astext', 'CrEOF\Spatial\ORM\Query\AST\Functions\PostgreSql\STAsText'); @@ -342,7 +454,7 @@ protected function setUpFunctions() $configuration->addCustomStringFunction('st_summary', 'CrEOF\Spatial\ORM\Query\AST\Functions\PostgreSql\STSummary'); } - if ($this->getPlatform()->getName() == 'mysql') { + if ('mysql' == $this->getPlatform()->getName()) { $configuration->addCustomNumericFunction('area', 'CrEOF\Spatial\ORM\Query\AST\Functions\MySql\Area'); $configuration->addCustomStringFunction('asbinary', 'CrEOF\Spatial\ORM\Query\AST\Functions\MySql\AsBinary'); $configuration->addCustomStringFunction('astext', 'CrEOF\Spatial\ORM\Query\AST\Functions\MySql\AsText'); @@ -358,162 +470,51 @@ protected function setUpFunctions() } /** - * Teardown fixtures - */ - protected function tearDown() - { - $this->sqlLoggerStack->enabled = false; - - foreach (array_keys($this->usedEntities) as $entityName) { - static::getConnection()->executeUpdate(sprintf('DELETE FROM %s', static::$entities[$entityName]['table'])); - } - - $this->getEntityManager()->clear(); - } - - /** - * @return AbstractPlatform + * Add types used by test to DBAL. */ - protected function getPlatform() - { - return static::getConnection()->getDatabasePlatform(); - } - - /** - * @param \Exception $e - * - * @return void - * - * @throws \Exception - * @todo: This needs cleanup - */ - protected function onNotSuccessfulTest(\Exception $e) + protected function setUpTypes() { - if (! $GLOBALS['opt_use_debug_stack'] || $e instanceof \PHPUnit_Framework_AssertionFailedError) { - throw $e; - } - - if (isset($this->sqlLoggerStack->queries) && count($this->sqlLoggerStack->queries)) { - $queries = ""; - $count = count($this->sqlLoggerStack->queries) - 1; - $max = max(count($this->sqlLoggerStack->queries) - 25, 0); - - for ($i = $count; $i > $max && isset($this->sqlLoggerStack->queries[$i]); $i--) { - $query = $this->sqlLoggerStack->queries[$i]; - $params = array_map(function ($param) { - if (is_object($param)) { - return get_class($param); - } - - return sprintf("'%s'", $param); - }, $query['params'] ?: array()); - - $queries .= sprintf("%2d. SQL: '%s' Params: %s\n", $i, $query['sql'], implode(", ", $params)); - } - - $trace = $e->getTrace(); - $traceMsg = ""; + foreach (array_keys($this->usedTypes) as $typeName) { + if (!isset(static::$addedTypes[$typeName]) && !Type::hasType($typeName)) { + Type::addType($typeName, static::$types[$typeName]); - foreach ($trace as $part) { - if (isset($part['file'])) { - if (strpos($part['file'], "PHPUnit/") !== false) { - // Beginning with PHPUnit files we don't print the trace anymore. - break; - } + $type = Type::getType($typeName); - $traceMsg .= sprintf("%s:%s\n", $part['file'], $part['line']); + // Since doctrineTypeComments may already be initialized check if added type requires comment + if ($type->requiresSQLCommentHint($this->getPlatform()) && !$this->getPlatform()->isCommentedDoctrineType($type)) { + $this->getPlatform()->markDoctrineTypeCommented(Type::getType($typeName)); } - } - $message = sprintf("[%s] %s\n\n", get_class($e), $e->getMessage()); - $message .= sprintf("With queries:\n%s\nTrace:\n%s", $queries, $traceMsg); - - throw new \Exception($message, (int)$e->getCode(), $e); + static::$addedTypes[$typeName] = true; + } } - - throw $e; } /** - * Using the SQL Logger Stack this method retrieves the current query count executed in this test. - * - * @return int + * @param string $platform */ - protected function getCurrentQueryCount() + protected function supportsPlatform($platform) { - return count($this->sqlLoggerStack->queries); + $this->supportedPlatforms[$platform] = true; } /** - * @return Connection - * @throws UnsupportedPlatformException - * @throws \Doctrine\DBAL\DBALException + * @param string $entityClass */ - protected static function getConnection() + protected function usesEntity($entityClass) { - if (isset(static::$connection)) { - return static::$connection; - } - - $connection = DriverManager::getConnection(static::getConnectionParameters()); + $this->usedEntities[$entityClass] = true; - switch ($connection->getDatabasePlatform()->getName()) { - case 'postgresql': - $connection->exec('CREATE EXTENSION postgis'); - break; - case 'mysql': - break; - default: - throw new UnsupportedPlatformException(sprintf('DBAL platform "%s" is not currently supported.', $connection->getDatabasePlatform()->getName())); + foreach (static::$entities[$entityClass]['types'] as $type) { + $this->usesType($type); } - - return $connection; } /** - * @return array - * @throws \Doctrine\DBAL\DBALException - */ - protected static function getConnectionParameters() - { - $parameters = static::getCommonConnectionParameters(); - $parameters['dbname'] = $GLOBALS['db_name']; - - $connection = DriverManager::getConnection($parameters); - $dbName = $connection->getDatabase(); - - $connection->close(); - - $tmpConnection = DriverManager::getConnection(static::getCommonConnectionParameters()); - - $tmpConnection->getSchemaManager()->dropAndCreateDatabase($dbName); - $tmpConnection->close(); - - return $parameters; - } - - /** - * @return array + * @param string $typeName */ - protected static function getCommonConnectionParameters() + protected function usesType($typeName) { - $connectionParams = array( - 'driver' => $GLOBALS['db_type'], - 'user' => $GLOBALS['db_username'], - 'password' => $GLOBALS['db_password'], - 'host' => $GLOBALS['db_host'], - 'dbname' => null, - 'port' => $GLOBALS['db_port'] - ); - - if (isset($GLOBALS['db_server'])) { - $connectionParams['server'] = $GLOBALS['db_server']; - } - - if (isset($GLOBALS['db_unix_socket'])) { - $connectionParams['unix_socket'] = $GLOBALS['db_unix_socket']; - } - - return $connectionParams; + $this->usedTypes[$typeName] = true; } } diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geography/PointTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geography/PointTest.php index d93c4ce5..e38fedd0 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geography/PointTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geography/PointTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group php + * + * @internal + * @coversNothing */ -class PointTest extends \PHPUnit_Framework_TestCase +class PointTest extends TestCase { - public function testGoodNumericPoint() - { - $point1 = new Point(-73.7562317, 42.6525793); - - $this->assertEquals(42.6525793, $point1->getLatitude()); - $this->assertEquals(-73.7562317, $point1->getLongitude()); - } - - public function testGoodStringPoints() + /** + * Test bad string parameters - latitude degrees greater that 90. + */ + public function testBadLatitudeDegrees() { - $point2 = new Point('79:56:55W', '40:26:46N'); - - $this->assertEquals(40.446111111111, $point2->getLatitude()); - $this->assertEquals(-79.948611111111, $point2->getLongitude()); - - $point3 = new Point('79°56\'55"W', '40°26\'46"N'); - - $this->assertEquals(40.446111111111, $point3->getLatitude()); - $this->assertEquals(-79.948611111111, $point3->getLongitude()); - - $point4 = new Point('79° 56\' 55" W', '40° 26\' 46" N'); - - $this->assertEquals(40.446111111111, $point4->getLatitude()); - $this->assertEquals(-79.948611111111, $point4->getLongitude()); - - $point5 = new Point('79°56′55″W', '40°26′46″N'); + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('[Range Error] Error: Degrees out of range -90 to 90 in value "92:26:46N"'); - $this->assertEquals(40.446111111111, $point5->getLatitude()); - $this->assertEquals(-79.948611111111, $point5->getLongitude()); - - $point6 = new Point('79° 56′ 55″ W', '40° 26′ 46″ N'); - - $this->assertEquals(40.446111111111, $point6->getLatitude()); - $this->assertEquals(-79.948611111111, $point6->getLongitude()); - - $point7 = new Point('79:56:55.832W', '40:26:46.543N'); - - $this->assertEquals(40.446261944444, $point7->getLatitude()); - $this->assertEquals(-79.948842222222, $point7->getLongitude()); - - $point8 = new Point('112:4:0W', '33:27:0N'); - - $this->assertEquals(33.45, $point8->getLatitude()); - $this->assertEquals(-112.06666666667, $point8->getLongitude()); + new Point('79:56:55W', '92:26:46N'); } /** - * Test bad string parameters - invalid latitude direction - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage [Syntax Error] line 0, col 8: Error: Expected CrEOF\Geo\String\Lexer::T_INTEGER or CrEOF\Geo\String\Lexer::T_FLOAT, got "Q" in value "84:26:46Q" + * Test bad string parameters - invalid latitude direction. */ public function testBadLatitudeDirection() { - new Point('100:56:55W', '84:26:46Q'); - } + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('[Syntax Error] line 0, col 8: Error: Expected CrEOF\\Geo\\String\\Lexer::T_INTEGER or CrEOF\\Geo\\String\\Lexer::T_FLOAT, got "Q" in value "84:26:46Q"'); - /** - * Test bad string parameters - latitude degrees greater that 90 - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage [Range Error] Error: Degrees out of range -90 to 90 in value "92:26:46N" - */ - public function testBadLatitudeDegrees() - { - new Point('79:56:55W', '92:26:46N'); + new Point('100:56:55W', '84:26:46Q'); } /** - * Test bad string parameters - latitude minutes greater than 59 - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage [Range Error] Error: Minutes greater than 60 in value "84:64:46N" + * Test bad string parameters - latitude minutes greater than 59. */ public function testBadLatitudeMinutes() { + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('[Range Error] Error: Minutes greater than 60 in value "84:64:46N"'); + new Point('108:42:55W', '84:64:46N'); } /** - * Test bad string parameters - latitude seconds greater than 59 - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage [Range Error] Error: Seconds greater than 60 in value "84:23:75N" + * Test bad string parameters - latitude seconds greater than 59. */ public function testBadLatitudeSeconds() { + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('[Range Error] Error: Seconds greater than 60 in value "84:23:75N"'); + new Point('108:42:55W', '84:23:75N'); } /** - * Test bad string parameters - invalid longitude direction - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage [Syntax Error] line 0, col 9: Error: Expected CrEOF\Geo\String\Lexer::T_INTEGER or CrEOF\Geo\String\Lexer::T_FLOAT, got "P" in value "100:56:55P" + * Test bad string parameters - longitude degrees greater than 180. */ - public function testBadLongitudeDirection() + public function testBadLongitudeDegrees() { - new Point('100:56:55P', '84:26:46N'); + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('[Range Error] Error: Degrees out of range -180 to 180 in value "190:56:55W"'); + + new Point('190:56:55W', '84:26:46N'); } /** - * Test bad string parameters - longitude degrees greater than 180 - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage [Range Error] Error: Degrees out of range -180 to 180 in value "190:56:55W" + * Test bad string parameters - invalid longitude direction. */ - public function testBadLongitudeDegrees() + public function testBadLongitudeDirection() { - new Point('190:56:55W', '84:26:46N'); + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('[Syntax Error] line 0, col 9: Error: Expected CrEOF\\Geo\\String\\Lexer::T_INTEGER or CrEOF\\Geo\\String\\Lexer::T_FLOAT, got "P" in value "100:56:55P"'); + + new Point('100:56:55P', '84:26:46N'); } /** - * Test bad string parameters - longitude minutes greater than 59 - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage [Range Error] Error: Minutes greater than 60 in value "108:62:55W" + * Test bad string parameters - longitude minutes greater than 59. */ public function testBadLongitudeMinutes() { + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('[Range Error] Error: Minutes greater than 60 in value "108:62:55W"'); + new Point('108:62:55W', '84:26:46N'); } /** - * Test bad string parameters - longitude seconds greater than 59 - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage [Range Error] Error: Seconds greater than 60 in value "108:53:94W" + * Test bad string parameters - longitude seconds greater than 59. */ public function testBadLongitudeSeconds() { + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('[Range Error] Error: Seconds greater than 60 in value "108:53:94W"'); + new Point('108:53:94W', '84:26:46N'); } - public function testToArray() + /** + * Test bad numeric parameters - latitude greater than 90. + */ + public function testBadNumericGreaterThanLatitude() { - $expected = array(10, 10); - $point = new Point(10, 10); - $result = $point->toArray(); + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('Invalid latitude value "190", must be in range -90 to 90.'); - $this->assertEquals($expected, $result); + new Point(55, 190); } - public function testPointWithSrid() + /** + * Test bad numeric parameters - longitude greater than 180. + */ + public function testBadNumericGreaterThanLongitude() { - $point = new Point(10, 10, 4326); - $result = $point->getSrid(); + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('Invalid longitude value "180.134", must be in range -180 to 180.'); - $this->assertEquals(4326, $result); + new Point(180.134, 54); + } + + /** + * Test bad numeric parameters - latitude less than -90. + */ + public function testBadNumericLessThanLatitude() + { + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('Invalid latitude value "-90.00001", must be in range -90 to 90.'); + + new Point(55, -90.00001); + } + + /** + * Test bad numeric parameters - longitude less than -180. + */ + public function testBadNumericLessThanLongitude() + { + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('Invalid longitude value "-230", must be in range -180 to 180.'); + + new Point(-230, 54); } public function testGetType() { - $point = new Point(10, 10); + $point = new Point(10, 10); $result = $point->getType(); $this->assertEquals('Point', $result); } + public function testGoodNumericPoint() + { + $point = new Point(-73.7562317, 42.6525793); + + $this->assertEquals(42.6525793, $point->getLatitude()); + $this->assertEquals(-73.7562317, $point->getLongitude()); + } + + public function testGoodStringPoints() + { + $point = new Point('79:56:55W', '40:26:46N'); + + $this->assertEquals(40.446111111111, $point->getLatitude()); + $this->assertEquals(-79.948611111111, $point->getLongitude()); + + $point = new Point('79°56\'55"W', '40°26\'46"N'); + + $this->assertEquals(40.446111111111, $point->getLatitude()); + $this->assertEquals(-79.948611111111, $point->getLongitude()); + + $point = new Point('79° 56\' 55" W', '40° 26\' 46" N'); + + $this->assertEquals(40.446111111111, $point->getLatitude()); + $this->assertEquals(-79.948611111111, $point->getLongitude()); + + $point = new Point('79°56′55″W', '40°26′46″N'); + + $this->assertEquals(40.446111111111, $point->getLatitude()); + $this->assertEquals(-79.948611111111, $point->getLongitude()); + + $point = new Point('79° 56′ 55″ W', '40° 26′ 46″ N'); + + $this->assertEquals(40.446111111111, $point->getLatitude()); + $this->assertEquals(-79.948611111111, $point->getLongitude()); + + $point = new Point('79:56:55.832W', '40:26:46.543N'); + + $this->assertEquals(40.446261944444, $point->getLatitude()); + $this->assertEquals(-79.948842222222, $point->getLongitude()); + + $point = new Point('112:4:0W', '33:27:0N'); + + $this->assertEquals(33.45, $point->getLatitude()); + $this->assertEquals(-112.06666666667, $point->getLongitude()); + } + public function testPointFromArrayToString() { $expected = '5 5'; - $point = new Point(array(5, 5)); + $point = new Point([5, 5]); $this->assertEquals($expected, (string) $point); } - /** - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage Invalid parameters passed to CrEOF\Spatial\PHP\Types\Geography\Point::__construct: "5", "5", "5", "5" - */ public function testPointTooManyArguments() { + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('Invalid parameters passed to CrEOF\\Spatial\\PHP\\Types\\Geography\\Point::__construct: "5", "5", "5", "5"'); + new Point(5, 5, 5, 5); } - /** - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage Invalid parameters passed to CrEOF\Spatial\PHP\Types\Geography\Point::__construct: Array, Array, "1234" - */ - public function testPointWrongArgumentTypes() + public function testPointWithSrid() { - new Point(array(), array(), '1234'); - } + $point = new Point(10, 10, 4326); + $result = $point->getSrid(); - /** - * Test bad numeric parameters - latitude greater than 90 - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage Invalid latitude value "190", must be in range -90 to 90. - */ - public function testBadNumericGreaterThanLatitude() - { - $point = new Point(55, 190); + $this->assertEquals(4326, $result); } - /** - * Test bad numeric parameters - latitude less than -90 - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage Invalid latitude value "-90.00001", must be in range -90 to 90. - */ - public function testBadNumericLessThanLatitude() + public function testPointWrongArgumentTypes() { - $point = new Point(55, -90.00001); - } + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('Invalid parameters passed to CrEOF\\Spatial\\PHP\\Types\\Geography\\Point::__construct: Array, Array, "1234"'); - /** - * Test bad numeric parameters - longitude greater than 180 - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage Invalid longitude value "180.134", must be in range -180 to 180. - */ - public function testBadNumericGreaterThanLongitude() - { - $point = new Point(180.134, 54); + new Point([], [], '1234'); } - /** - * Test bad numeric parameters - longitude less than -180 - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage Invalid longitude value "-230", must be in range -180 to 180. - */ - public function testBadNumericLessThanLongitude() + public function testToArray() { - $point = new Point(-230, 54); + $expected = [10, 10]; + $point = new Point(10, 10); + $result = $point->toArray(); + + $this->assertEquals($expected, $result); } } diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/LineStringTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/LineStringTest.php index ba5949e1..fdcd451f 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/LineStringTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/LineStringTest.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT * * @group php + * + * @internal + * @coversNothing */ -class LineStringTest extends \PHPUnit_Framework_TestCase +class LineStringTest extends TestCase { + /** + * Test LineString bad parameter. + */ + public function testBadLineString() + { + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('Invalid LineString Point value of type "integer"'); + + new LineString([1, 2, 3, 4]); + } + public function testEmptyLineString() { - $lineString = new LineString(array()); + $lineString = new LineString([]); $this->assertEmpty($lineString->getPoints()); } - public function testLineStringFromObjectsToArray() + public function testJson() { - $expected = array( - array(0, 0), - array(1, 1), - array(2, 2), - array(3, 3) + $expected = '{"type":"LineString","coordinates":[[0,0],[0,5],[5,0],[0,0]]}'; + + $lineString = new LineString( + [ + [0, 0], + [0, 5], + [5, 0], + [0, 0], + ] ); - $lineString = new LineString(array( - new Point(0, 0), - new Point(1, 1), - new Point(2, 2), - new Point(3, 3) - )); + $this->assertEquals($expected, $lineString->toJson()); + } - $this->assertCount(4, $lineString->getPoints()); - $this->assertEquals($expected, $lineString->toArray()); + public function testLineStringFromArraysGetLastPoint() + { + $expected = new Point(3, 3); + $lineString = new LineString( + [ + [0, 0], + [1, 1], + [2, 2], + [3, 3], + ] + ); + $actual = $lineString->getPoint(-1); + + $this->assertEquals($expected, $actual); } public function testLineStringFromArraysGetPoints() { - $expected = array( + $expected = [ new Point(0, 0), new Point(1, 1), new Point(2, 2), - new Point(3, 3) - ); + new Point(3, 3), + ]; $lineString = new LineString( - array( - array(0, 0), - array(1, 1), - array(2, 2), - array(3, 3) - ) + [ + [0, 0], + [1, 1], + [2, 2], + [3, 3], + ] ); $actual = $lineString->getPoints(); @@ -88,100 +117,77 @@ public function testLineStringFromArraysGetSinglePoint() { $expected = new Point(1, 1); $lineString = new LineString( - array( - array(0, 0), - array(1, 1), - array(2, 2), - array(3, 3) - ) + [ + [0, 0], + [1, 1], + [2, 2], + [3, 3], + ] ); $actual = $lineString->getPoint(1); $this->assertEquals($expected, $actual); } - public function testLineStringFromArraysGetLastPoint() + public function testLineStringFromArraysIsClosed() { - $expected = new Point(3, 3); $lineString = new LineString( - array( - array(0, 0), - array(1, 1), - array(2, 2), - array(3, 3) - ) + [ + [0, 0], + [0, 5], + [5, 0], + [0, 0], + ] ); - $actual = $lineString->getPoint(-1); - $this->assertEquals($expected, $actual); + $this->assertTrue($lineString->isClosed()); } public function testLineStringFromArraysIsOpen() { $lineString = new LineString( - array( - array(0, 0), - array(1, 1), - array(2, 2), - array(3, 3) - ) + [ + [0, 0], + [1, 1], + [2, 2], + [3, 3], + ] ); $this->assertFalse($lineString->isClosed()); } - public function testLineStringFromArraysIsClosed() - { - $lineString = new LineString( - array( - array(0, 0), - array(0, 5), - array(5, 0), - array(0, 0) - ) - ); - - $this->assertTrue($lineString->isClosed()); - } - - /** - * Test LineString bad parameter - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage Invalid LineString Point value of type "integer" - */ - public function testBadLineString() - { - new LineString(array(1, 2, 3 ,4)); - } - public function testLineStringFromArraysToString() { $expected = '0 0,0 5,5 0,0 0'; $lineString = new LineString( - array( - array(0, 0), - array(0, 5), - array(5, 0), - array(0, 0) - ) + [ + [0, 0], + [0, 5], + [5, 0], + [0, 0], + ] ); $this->assertEquals($expected, (string) $lineString); } - public function testJson() + public function testLineStringFromObjectsToArray() { - $expected = "{\"type\":\"LineString\",\"coordinates\":[[0,0],[0,5],[5,0],[0,0]]}"; + $expected = [ + [0, 0], + [1, 1], + [2, 2], + [3, 3], + ]; + $lineString = new LineString([ + new Point(0, 0), + new Point(1, 1), + new Point(2, 2), + new Point(3, 3), + ]); - $lineString = new LineString( - array( - array(0, 0), - array(0, 5), - array(5, 0), - array(0, 0) - ) - ); - $this->assertEquals($expected, $lineString->toJson()); + $this->assertCount(4, $lineString->getPoints()); + $this->assertEquals($expected, $lineString->toArray()); } } diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiLineStringTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiLineStringTest.php index 7713d430..1bf2c346 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiLineStringTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiLineStringTest.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT * * @group php + * + * @internal + * @coversNothing */ -class MultiLineStringTest extends \PHPUnit_Framework_TestCase +class MultiLineStringTest extends TestCase { public function testEmptyMultiLineString() { - $multiLineString = new MultiLineString(array()); + $multiLineString = new MultiLineString([]); $this->assertEmpty($multiLineString->getLineStrings()); } - public function testMultiLineStringFromObjectsToArray() + public function testJson() { - $expected = array( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ), - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ) + $expected = '{"type":"MultiLineString","coordinates":[[[0,0],[10,0],[10,10],[0,10],[0,0]],[[0,0],[10,0],[10,10],[0,10],[0,0]]]}'; + $lineStrings = [ + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + ]; + $multiLineString = new MultiLineString($lineStrings); + + $this->assertEquals($expected, $multiLineString->toJson()); + } + + public function testMultiLineStringFromArraysToString() + { + $expected = '(0 0,10 0,10 10,0 10,0 0),(0 0,10 0,10 10,0 10,0 0)'; + $lineStrings = [ + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + ]; + $multiLineString = new MultiLineString($lineStrings); + $result = (string) $multiLineString; + + $this->assertEquals($expected, $result); + } + + public function testMultiLineStringFromObjectsGetLastLineString() + { + $lineString1 = new LineString( + [ + new Point(0, 0), + new Point(10, 0), + new Point(10, 10), + new Point(0, 10), + new Point(0, 0), + ] + ); + $lineString2 = new LineString( + [ + new Point(5, 5), + new Point(7, 5), + new Point(7, 7), + new Point(5, 7), + new Point(5, 5), + ] ); - $lineStrings = array( + $polygon = new MultiLineString([$lineString1, $lineString2]); + + $this->assertEquals($lineString2, $polygon->getLineString(-1)); + } + + public function testMultiLineStringFromObjectsGetSingleLineString() + { + $lineString1 = new LineString( + [ + new Point(0, 0), + new Point(10, 0), + new Point(10, 10), + new Point(0, 10), + new Point(0, 0), + ] + ); + $lineString2 = new LineString( + [ + new Point(5, 5), + new Point(7, 5), + new Point(7, 7), + new Point(5, 7), + new Point(5, 5), + ] + ); + $multiLineString = new MultiLineString([$lineString1, $lineString2]); + + $this->assertEquals($lineString1, $multiLineString->getLineString(0)); + } + + public function testMultiLineStringFromObjectsToArray() + { + $expected = [ + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + ]; + $lineStrings = [ new LineString( - array( + [ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - ) + new Point(0, 0), + ] ), new LineString( - array( + [ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - ) - ) - ); + new Point(0, 0), + ] + ), + ]; $multiLineString = new MultiLineString($lineStrings); $this->assertEquals($expected, $multiLineString->toArray()); } - public function testSolidMultiLineStringFromArraysGetRings() + public function testSolidMultiLineStringAddRings() { - $expected = array( + $expected = [ new LineString( - array( + [ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - ) + new Point(0, 0), + ] ), new LineString( - array( + [ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - ) - ) - ); - $rings = array( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) + new Point(0, 0), + ] ), - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ) - ); + ]; + $rings = [ + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + ]; $multiLineString = new MultiLineString($rings); + $multiLineString->addLineString( + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ] + ); + $this->assertEquals($expected, $multiLineString->getLineStrings()); } - - - public function testSolidMultiLineStringAddRings() + public function testSolidMultiLineStringFromArraysGetRings() { - $expected = array( + $expected = [ new LineString( - array( + [ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - ) + new Point(0, 0), + ] ), new LineString( - array( + [ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - ) - ) - ); - $rings = array( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) + new Point(0, 0), + ] ), - ); + ]; + $rings = [ + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + ]; $multiLineString = new MultiLineString($rings); - $multiLineString->addLineString( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ) - ); - $this->assertEquals($expected, $multiLineString->getLineStrings()); } - - public function testMultiLineStringFromObjectsGetSingleLineString() - { - $lineString1 = new LineString( - array( - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0) - ) - ); - $lineString2 = new LineString( - array( - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5) - ) - ); - $multiLineString = new MultiLineString(array($lineString1, $lineString2)); - - $this->assertEquals($lineString1, $multiLineString->getLineString(0)); - } - - public function testMultiLineStringFromObjectsGetLastLineString() - { - $lineString1 = new LineString( - array( - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0) - ) - ); - $lineString2 = new LineString( - array( - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5) - ) - ); - $polygon = new MultiLineString(array($lineString1, $lineString2)); - - $this->assertEquals($lineString2, $polygon->getLineString(-1)); - } - - public function testMultiLineStringFromArraysToString() - { - $expected = '(0 0,10 0,10 10,0 10,0 0),(0 0,10 0,10 10,0 10,0 0)'; - $lineStrings = array( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ), - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ) - ); - $multiLineString = new MultiLineString($lineStrings); - $result = (string) $multiLineString; - - $this->assertEquals($expected, $result); - } - - public function testJson() - { - $expected = '{"type":"MultiLineString","coordinates":[[[0,0],[10,0],[10,10],[0,10],[0,0]],[[0,0],[10,0],[10,10],[0,10],[0,0]]]}'; - $lineStrings = array( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ), - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ) - ); - $multiLineString = new MultiLineString($lineStrings); - - $this->assertEquals($expected, $multiLineString->toJson()); - } } diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPointTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPointTest.php index 508be58a..0c4695cf 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPointTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPointTest.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT * * @group php + * + * @internal + * @coversNothing */ -class MultiPointTest extends \PHPUnit_Framework_TestCase +class MultiPointTest extends TestCase { - public function testEmptyMultiPoint() + /** + * Test MultiPoint bad parameter. + */ + public function testBadLineString() { - $multiPoint = new MultiPoint(array()); + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('Invalid MultiPoint Point value of type "integer"'); - $this->assertEmpty($multiPoint->getPoints()); + new MultiPoint([1, 2, 3, 4]); } - public function testMultiPointFromObjectsToArray() + public function testEmptyMultiPoint() { - $expected = array( - array(0, 0), - array(1, 1), - array(2, 2), - array(3, 3) - ); - $multiPoint = new MultiPoint(array( - new Point(0, 0), - new Point(1, 1), - new Point(2, 2), - new Point(3, 3) - )); + $multiPoint = new MultiPoint([]); - $this->assertCount(4, $multiPoint->getPoints()); - $this->assertEquals($expected, $multiPoint->toArray()); + $this->assertEmpty($multiPoint->getPoints()); } - public function testMultiPointFromArraysGetPoints() + public function testJson() { - $expected = array( - new Point(0, 0), - new Point(1, 1), - new Point(2, 2), - new Point(3, 3) - ); + $expected = '{"type":"MultiPoint","coordinates":[[0,0],[0,5],[5,0],[0,0]]}'; $multiPoint = new MultiPoint( - array( - array(0, 0), - array(1, 1), - array(2, 2), - array(3, 3) - ) + [ + [0, 0], + [0, 5], + [5, 0], + [0, 0], + ] ); - $actual = $multiPoint->getPoints(); - $this->assertCount(4, $actual); - $this->assertEquals($expected, $actual); + $this->assertEquals($expected, $multiPoint->toJson()); } - - public function testMultiPointAddPoints() { - $expected = array( + $expected = [ new Point(0, 0), new Point(1, 1), new Point(2, 2), - new Point(3, 3) - ); + new Point(3, 3), + ]; $multiPoint = new MultiPoint( - array( - array(0, 0), - array(1, 1), - ) + [ + [0, 0], + [1, 1], + ] ); $multiPoint - ->addPoint(array(2, 2)) - ->addPoint(array(3, 3)) + ->addPoint([2, 2]) + ->addPoint([3, 3]) ; $actual = $multiPoint->getPoints(); @@ -112,76 +101,91 @@ public function testMultiPointAddPoints() $this->assertEquals($expected, $actual); } - public function testMultiPointFromArraysGetSinglePoint() + public function testMultiPointFromArraysGetLastPoint() { - $expected = new Point(1, 1); + $expected = new Point(3, 3); $multiPoint = new MultiPoint( - array( - array(0, 0), - array(1, 1), - array(2, 2), - array(3, 3) - ) + [ + [0, 0], + [1, 1], + [2, 2], + [3, 3], + ] ); - $actual = $multiPoint->getPoint(1); + $actual = $multiPoint->getPoint(-1); $this->assertEquals($expected, $actual); } - public function testMultiPointFromArraysGetLastPoint() + public function testMultiPointFromArraysGetPoints() { - $expected = new Point(3, 3); + $expected = [ + new Point(0, 0), + new Point(1, 1), + new Point(2, 2), + new Point(3, 3), + ]; $multiPoint = new MultiPoint( - array( - array(0, 0), - array(1, 1), - array(2, 2), - array(3, 3) - ) + [ + [0, 0], + [1, 1], + [2, 2], + [3, 3], + ] ); - $actual = $multiPoint->getPoint(-1); + $actual = $multiPoint->getPoints(); + $this->assertCount(4, $actual); $this->assertEquals($expected, $actual); } - /** - * Test MultiPoint bad parameter - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage Invalid MultiPoint Point value of type "integer" - */ - public function testBadLineString() + public function testMultiPointFromArraysGetSinglePoint() { - new MultiPoint(array(1, 2, 3 ,4)); + $expected = new Point(1, 1); + $multiPoint = new MultiPoint( + [ + [0, 0], + [1, 1], + [2, 2], + [3, 3], + ] + ); + $actual = $multiPoint->getPoint(1); + + $this->assertEquals($expected, $actual); } public function testMultiPointFromArraysToString() { - $expected = '0 0,0 5,5 0,0 0'; + $expected = '0 0,0 5,5 0,0 0'; $multiPoint = new MultiPoint( - array( - array(0, 0), - array(0, 5), - array(5, 0), - array(0, 0) - ) + [ + [0, 0], + [0, 5], + [5, 0], + [0, 0], + ] ); $this->assertEquals($expected, (string) $multiPoint); } - public function testJson() + public function testMultiPointFromObjectsToArray() { - $expected = '{"type":"MultiPoint","coordinates":[[0,0],[0,5],[5,0],[0,0]]}'; - $multiPoint = new MultiPoint( - array( - array(0, 0), - array(0, 5), - array(5, 0), - array(0, 0) - ) - ); + $expected = [ + [0, 0], + [1, 1], + [2, 2], + [3, 3], + ]; + $multiPoint = new MultiPoint([ + new Point(0, 0), + new Point(1, 1), + new Point(2, 2), + new Point(3, 3), + ]); - $this->assertEquals($expected, $multiPoint->toJson()); + $this->assertCount(4, $multiPoint->getPoints()); + $this->assertEquals($expected, $multiPoint->toArray()); } } diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php index 4feb5b1f..b9ae8d09 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php @@ -1,5 +1,26 @@ * @license http://dlambert.mit-license.org MIT * * @group php + * + * @internal + * @coversNothing */ -class MultiPolygonTest extends \PHPUnit_Framework_TestCase +class MultiPolygonTest extends TestCase { public function testEmptyMultiPolygon() { - $multiPolygon = new MultiPolygon(array()); + $multiPolygon = new MultiPolygon([]); $this->assertEmpty($multiPolygon->getPolygons()); } - public function testSolidMultiPolygonFromObjectsToArray() + public function testJson() { - $expected = array( - array( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ) - ), - array( - array( - array(5, 5), - array(7, 5), - array(7, 7), - array(5, 7), - array(5, 5) - ) - ) - ); - - $polygons = array( - new Polygon( - array( - new LineString( - array( - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0) - ) - ) - ) - ), - new Polygon( - array( - new LineString( - array( - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5) - ) - ) - ) - ) - ); - + $expected = '{"type":"MultiPolygon","coordinates":[[[[0,0],[10,0],[10,10],[0,10],[0,0]]],[[[5,5],[7,5],[7,7],[5,7],[5,5]]]]}'; + $polygons = [ + [ + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + ], + [ + [ + [5, 5], + [7, 5], + [7, 7], + [5, 7], + [5, 5], + ], + ], + ]; $multiPolygon = new MultiPolygon($polygons); - $this->assertEquals($expected, $multiPolygon->toArray()); + $this->assertEquals($expected, $multiPolygon->toJson()); } - public function testSolidMultiPolygonFromArraysGetPolygons() + public function testMultiPolygonFromObjectsGetLastPolygon() { - $expected = array( - new Polygon( - array( - new LineString( - array( - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0) - ) - ) - ) - ), - new Polygon( - array( - new LineString( - array( - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5) - ) - ) - ) - ) + $polygon1 = new Polygon( + [ + new LineString( + [ + new Point(0, 0), + new Point(10, 0), + new Point(10, 10), + new Point(0, 10), + new Point(0, 0), + ] + ), + ] ); - - $polygons = array( - array( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ) - ), - array( - array( - array(5, 5), - array(7, 5), - array(7, 7), - array(5, 7), - array(5, 5) - ) - ) + $polygon2 = new Polygon( + [ + new LineString( + [ + new Point(5, 5), + new Point(7, 5), + new Point(7, 7), + new Point(5, 7), + new Point(5, 5), + ] + ), + ] ); + $multiPolygon = new MultiPolygon([$polygon1, $polygon2]); + $this->assertEquals($polygon2, $multiPolygon->getPolygon(-1)); + } - $multiPolygon = new MultiPolygon($polygons); + public function testMultiPolygonFromObjectsGetSinglePolygon() + { + $polygon1 = new Polygon( + [ + new LineString( + [ + new Point(0, 0), + new Point(10, 0), + new Point(10, 10), + new Point(0, 10), + new Point(0, 0), + ] + ), + ] + ); + $polygon2 = new Polygon( + [ + new LineString( + [ + new Point(5, 5), + new Point(7, 5), + new Point(7, 7), + new Point(5, 7), + new Point(5, 5), + ] + ), + ] + ); + $multiPolygon = new MultiPolygon([$polygon1, $polygon2]); - $this->assertEquals($expected, $multiPolygon->getPolygons()); + $this->assertEquals($polygon1, $multiPolygon->getPolygon(0)); } - public function testSolidMultiPolygonAddPolygon() { - $expected = array( + $expected = [ new Polygon( - array( + [ new LineString( - array( + [ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - ) - ) - ) + new Point(0, 0), + ] + ), + ] ), new Polygon( - array( + [ new LineString( - array( + [ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), - new Point(5, 5) - ) - ) - ) - ) - ); - + new Point(5, 5), + ] + ), + ] + ), + ]; - $polygon = new Polygon( - array ( + $polygon = new Polygon( + [ new LineString( - array ( + [ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), new Point(0, 0), - ) + ] ), - ) + ] ); - - $multiPolygon = new MultiPolygon(array($polygon)); + $multiPolygon = new MultiPolygon([$polygon]); $multiPolygon->addPolygon( - array ( - array ( + [ + [ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), new Point(5, 5), - ), - ) + ], + ] ); $this->assertEquals($expected, $multiPolygon->getPolygons()); } - - - public function testMultiPolygonFromObjectsGetSinglePolygon() + public function testSolidMultiPolygonFromArraysGetPolygons() { - $polygon1 = new Polygon( - array( - new LineString( - array( - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0) - ) - ) - ) - ); - $polygon2 = new Polygon( - array( - new LineString( - array( - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5) - ) - ) - ) - ); - $multiPolygon = new MultiPolygon(array($polygon1, $polygon2)); + $expected = [ + new Polygon( + [ + new LineString( + [ + new Point(0, 0), + new Point(10, 0), + new Point(10, 10), + new Point(0, 10), + new Point(0, 0), + ] + ), + ] + ), + new Polygon( + [ + new LineString( + [ + new Point(5, 5), + new Point(7, 5), + new Point(7, 7), + new Point(5, 7), + new Point(5, 5), + ] + ), + ] + ), + ]; - $this->assertEquals($polygon1, $multiPolygon->getPolygon(0)); - } + $polygons = [ + [ + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + ], + [ + [ + [5, 5], + [7, 5], + [7, 7], + [5, 7], + [5, 5], + ], + ], + ]; - public function testMultiPolygonFromObjectsGetLastPolygon() - { - $polygon1 = new Polygon( - array( - new LineString( - array( - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0) - ) - ) - ) - ); - $polygon2 = new Polygon( - array( - new LineString( - array( - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5) - ) - ) - ) - ); - $multiPolygon = new MultiPolygon(array($polygon1, $polygon2)); + $multiPolygon = new MultiPolygon($polygons); - $this->assertEquals($polygon2, $multiPolygon->getPolygon(-1)); + $this->assertEquals($expected, $multiPolygon->getPolygons()); } public function testSolidMultiPolygonFromArraysToString() { $expected = '((0 0,10 0,10 10,0 10,0 0)),((5 5,7 5,7 7,5 7,5 5))'; - $polygons = array( - array( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ) - ), - array( - array( - array(5, 5), - array(7, 5), - array(7, 7), - array(5, 7), - array(5, 5) - ) - ) - ); + $polygons = [ + [ + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + ], + [ + [ + [5, 5], + [7, 5], + [7, 7], + [5, 7], + [5, 5], + ], + ], + ]; $multiPolygon = new MultiPolygon($polygons); - $result = (string) $multiPolygon; + $result = (string) $multiPolygon; $this->assertEquals($expected, $result); } - public function testJson() + public function testSolidMultiPolygonFromObjectsToArray() { - $expected = '{"type":"MultiPolygon","coordinates":[[[[0,0],[10,0],[10,10],[0,10],[0,0]]],[[[5,5],[7,5],[7,7],[5,7],[5,5]]]]}'; - $polygons = array( - array( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ) + $expected = [ + [ + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + ], + [ + [ + [5, 5], + [7, 5], + [7, 7], + [5, 7], + [5, 5], + ], + ], + ]; + + $polygons = [ + new Polygon( + [ + new LineString( + [ + new Point(0, 0), + new Point(10, 0), + new Point(10, 10), + new Point(0, 10), + new Point(0, 0), + ] + ), + ] ), - array( - array( - array(5, 5), - array(7, 5), - array(7, 7), - array(5, 7), - array(5, 5) - ) - ) - ); + new Polygon( + [ + new LineString( + [ + new Point(5, 5), + new Point(7, 5), + new Point(7, 7), + new Point(5, 7), + new Point(5, 5), + ] + ), + ] + ), + ]; + $multiPolygon = new MultiPolygon($polygons); - $this->assertEquals($expected, $multiPolygon->toJson()); + $this->assertEquals($expected, $multiPolygon->toArray()); } } diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PointTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PointTest.php index bd14aef5..f63cea40 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PointTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PointTest.php @@ -1,5 +1,6 @@ * @license http://dlambert.mit-license.org MIT * * @group php + * + * @internal + * @coversNothing */ -class PointTest extends \PHPUnit_Framework_TestCase +class PointTest extends TestCase { + /** + * Test bad string parameters - latitude degrees greater that 90. + */ + public function testBadLatitudeDegrees() + { + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('[Range Error] Error: Degrees out of range -90 to 90 in value "92:26:46N"'); + + new Point('79:56:55W', '92:26:46N'); + } + + /** + * Test bad string parameters - invalid latitude direction. + */ + public function testBadLatitudeDirection() + { + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('[Syntax Error] line 0, col 8: Error: Expected CrEOF\\Geo\\String\\Lexer::T_INTEGER or CrEOF\\Geo\\String\\Lexer::T_FLOAT, got "Q" in value "84:26:46Q"'); + + new Point('100:56:55W', '84:26:46Q'); + } + + /** + * Test bad string parameters - latitude minutes greater than 59. + */ + public function testBadLatitudeMinutes() + { + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('[Range Error] Error: Minutes greater than 60 in value "84:64:46N"'); + + new Point('108:42:55W', '84:64:46N'); + } + + /** + * Test bad string parameters - latitude seconds greater than 59. + */ + public function testBadLatitudeSeconds() + { + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('[Range Error] Error: Seconds greater than 60 in value "84:23:75N"'); + + new Point('108:42:55W', '84:23:75N'); + } + + /** + * Test bad string parameters - longitude degrees greater than 180. + */ + public function testBadLongitudeDegrees() + { + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('[Range Error] Error: Degrees out of range -180 to 180 in value "190:56:55W"'); + + new Point('190:56:55W', '84:26:46N'); + } + + /** + * Test bad string parameters - invalid longitude direction. + */ + public function testBadLongitudeDirection() + { + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('[Syntax Error] line 0, col 9: Error: Expected CrEOF\\Geo\\String\\Lexer::T_INTEGER or CrEOF\\Geo\\String\\Lexer::T_FLOAT, got "P" in value "100:56:55P"'); + + new Point('100:56:55P', '84:26:46N'); + } + + /** + * Test bad string parameters - longitude minutes greater than 59. + */ + public function testBadLongitudeMinutes() + { + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('[Range Error] Error: Minutes greater than 60 in value "108:62:55W"'); + + new Point('108:62:55W', '84:26:46N'); + } + + /** + * Test bad string parameters - longitude seconds greater than 59. + */ + public function testBadLongitudeSeconds() + { + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('[Range Error] Error: Seconds greater than 60 in value "108:53:94W"'); + + new Point('108:53:94W', '84:26:46N'); + } + + public function testGetType() + { + $point = new Point(10, 10); + $result = $point->getType(); + + $this->assertEquals('Point', $result); + } public function testGoodNumericPoint() { @@ -45,13 +146,13 @@ public function testGoodNumericPoint() $point1 ->setLatitude(40.446111111111) - ->setLongitude(-79.948611111111); + ->setLongitude(-79.948611111111) + ; $this->assertEquals(40.446111111111, $point1->getLatitude()); $this->assertEquals(-79.948611111111, $point1->getLongitude()); } - public function testGoodStringPoints() { $point2 = new Point('79:56:55W', '40:26:46N'); @@ -90,184 +191,85 @@ public function testGoodStringPoints() $this->assertEquals(-112.06666666667, $point8->getLongitude()); } - /** - * Test bad string parameters - invalid latitude direction - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage [Syntax Error] line 0, col 8: Error: Expected CrEOF\Geo\String\Lexer::T_INTEGER or CrEOF\Geo\String\Lexer::T_FLOAT, got "Q" in value "84:26:46Q" - */ - public function testBadLatitudeDirection() - { - new Point('100:56:55W', '84:26:46Q'); - } - - /** - * Test bad string parameters - latitude degrees greater that 90 - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage [Range Error] Error: Degrees out of range -90 to 90 in value "92:26:46N" - */ - public function testBadLatitudeDegrees() - { - new Point('79:56:55W', '92:26:46N'); - } - - /** - * Test bad string parameters - latitude minutes greater than 59 - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage [Range Error] Error: Minutes greater than 60 in value "84:64:46N" - */ - public function testBadLatitudeMinutes() + public function testJson() { - new Point('108:42:55W', '84:64:46N'); - } + $expected = '{"type":"Point","coordinates":[5,5]}'; + $point = new Point([5, 5]); - /** - * Test bad string parameters - latitude seconds greater than 59 - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage [Range Error] Error: Seconds greater than 60 in value "84:23:75N" - */ - public function testBadLatitudeSeconds() - { - new Point('108:42:55W', '84:23:75N'); + $this->assertEquals($expected, $point->toJson()); } /** - * Test bad string parameters - invalid longitude direction - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage [Syntax Error] line 0, col 9: Error: Expected CrEOF\Geo\String\Lexer::T_INTEGER or CrEOF\Geo\String\Lexer::T_FLOAT, got "P" in value "100:56:55P" + * Test bad string parameters - No parameters. */ - public function testBadLongitudeDirection() + public function testMissingArguments() { - new Point('100:56:55P', '84:26:46N'); - } + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('Invalid parameters passed to CrEOF\\Spatial\\PHP\\Types\\Geometry\\Point::__construct:'); - /** - * Test bad string parameters - longitude degrees greater than 180 - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage [Range Error] Error: Degrees out of range -180 to 180 in value "190:56:55W" - */ - public function testBadLongitudeDegrees() - { - new Point('190:56:55W', '84:26:46N'); + new Point(); } - /** - * Test bad string parameters - longitude minutes greater than 59 - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage [Range Error] Error: Minutes greater than 60 in value "108:62:55W" - */ - public function testBadLongitudeMinutes() + public function testPointFromArrayToString() { - new Point('108:62:55W', '84:26:46N'); - } + $expected = '5 5'; + $point = new Point([5, 5]); - /** - * Test bad string parameters - longitude seconds greater than 59 - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage [Range Error] Error: Seconds greater than 60 in value "108:53:94W" - */ - public function testBadLongitudeSeconds() - { - new Point('108:53:94W', '84:26:46N'); + $this->assertEquals($expected, (string) $point); } - public function testToArray() + public function testPointTooManyArguments() { - $expected = array(10, 10); - $point = new Point(10, 10); - $result = $point->toArray(); + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('Invalid parameters passed to CrEOF\\Spatial\\PHP\\Types\\Geometry\\Point::__construct: "5", "5", "5", "5"'); - $this->assertEquals($expected, $result); + new Point(5, 5, 5, 5); } public function testPointWithSrid() { - $point = new Point(10, 10, 4326); + $point = new Point(10, 10, 4326); $result = $point->getSrid(); $this->assertEquals(4326, $result); } - public function testGetType() + public function testPointWrongArgumentTypes() { - $point = new Point(10, 10); - $result = $point->getType(); + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('Invalid parameters passed to CrEOF\\Spatial\\PHP\\Types\\Geometry\\Point::__construct: Array, Array, "1234"'); - $this->assertEquals('Point', $result); + new Point([], [], '1234'); } - public function testPointFromArrayToString() - { - $expected = '5 5'; - $point = new Point(array(5, 5)); - - $this->assertEquals($expected, (string) $point); - } - - /** - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage Invalid parameters passed to CrEOF\Spatial\PHP\Types\Geometry\Point::__construct: "5", "5", "5", "5" - */ - public function testPointTooManyArguments() - { - new Point(5, 5, 5, 5); - } - - /** - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage Invalid parameters passed to CrEOF\Spatial\PHP\Types\Geometry\Point::__construct: Array, Array, "1234" - */ - public function testPointWrongArgumentTypes() + public function testToArray() { - new Point(array(), array(), '1234'); - } + $expected = [10, 10]; + $point = new Point(10, 10); + $result = $point->toArray(); - /** - * Test bad string parameters - No parameters - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage Invalid parameters passed to CrEOF\Spatial\PHP\Types\Geometry\Point::__construct: - */ - public function testMissingArguments() - { - new Point(); + $this->assertEquals($expected, $result); } - /** - * Test bad string parameters - Two invalid parameters - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage Invalid parameters passed to CrEOF\Spatial\PHP\Types\Geometry\Point::__construct: "", "" + * Test bad string parameters - Two invalid parameters. */ public function testTwoInvalidArguments() { + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('Invalid parameters passed to CrEOF\\Spatial\\PHP\\Types\\Geometry\\Point::__construct: "", ""'); + new Point(null, null); } /** - * Test bad string parameters - More than 3 parameters - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage Invalid parameters passed to CrEOF\Spatial\PHP\Types\Geometry\Point::__construct: "1", "2", "3", "4", "", "5" + * Test bad string parameters - More than 3 parameters. */ public function testUnusedArguments() { - new Point(1, 2, 3, 4, null, 5); - } - - public function testJson() - { - $expected = '{"type":"Point","coordinates":[5,5]}'; - $point = new Point(array(5, 5)); + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('Invalid parameters passed to CrEOF\\Spatial\\PHP\\Types\\Geometry\\Point::__construct: "1", "2", "3", "4", "", "5"'); - $this->assertEquals($expected, $point->toJson()); + new Point(1, 2, 3, 4, null, 5); } } diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PolygonTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PolygonTest.php index 8167a240..aeb489aa 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PolygonTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PolygonTest.php @@ -1,6 +1,7 @@ * @license http://dlambert.mit-license.org MIT * * @group php + * + * @internal + * @coversNothing */ -class PolygonTest extends \PHPUnit_Framework_TestCase +class PolygonTest extends TestCase { public function testEmptyPolygon() { - $polygon = new Polygon(array()); + $polygon = new Polygon([]); $this->assertEmpty($polygon->getRings()); } - public function testSolidPolygonFromObjectsToArray() + public function testJson() { - $expected = array( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ) - ); - $rings = array( - new LineString( - array( - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0) - ) - ) - ); - + $expected = '{"type":"Polygon","coordinates":[[[0,0],[10,0],[10,10],[0,10],[0,0]],[[0,0],[10,0],[10,10],[0,10],[0,0]]]}'; + $rings = [ + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + ]; $polygon = new Polygon($rings); - $this->assertEquals($expected, $polygon->toArray()); + $this->assertEquals($expected, $polygon->toJson()); } - public function testSolidPolygonFromArrayOfPoints() + /** + * Test Polygon with open ring. + */ + public function testOpenPolygonRing() { - $expected = array( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ) - ); - $rings = array( - array( + $this->expectException(InvalidValueException::class); + $this->expectExceptionMessage('Invalid polygon, ring "(0 0,10 0,10 10,0 10)" is not closed'); + + $rings = [ + new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - ) - ); + ]), + ]; - $polygon = new Polygon($rings); - - $this->assertEquals($expected, $polygon->toArray()); + new Polygon($rings); } - public function testSolidPolygonFromArraysGetRings() + public function testRingPolygonFromObjectsGetLastRing() { - $expected = array( - new LineString( - array( - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0) - ) - ) + $ring1 = new LineString( + [ + new Point(0, 0), + new Point(10, 0), + new Point(10, 10), + new Point(0, 10), + new Point(0, 0), + ] ); - $rings = array( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ) + $ring2 = new LineString( + [ + new Point(5, 5), + new Point(7, 5), + new Point(7, 7), + new Point(5, 7), + new Point(5, 5), + ] ); + $polygon = new Polygon([$ring1, $ring2]); - $polygon = new Polygon($rings); - - $this->assertEquals($expected, $polygon->getRings()); + $this->assertEquals($ring2, $polygon->getRing(-1)); } + public function testRingPolygonFromObjectsGetSingleRing() + { + $ring1 = new LineString( + [ + new Point(0, 0), + new Point(10, 0), + new Point(10, 10), + new Point(0, 10), + new Point(0, 0), + ] + ); + $ring2 = new LineString( + [ + new Point(5, 5), + new Point(7, 5), + new Point(7, 7), + new Point(5, 7), + new Point(5, 5), + ] + ); + $polygon = new Polygon([$ring1, $ring2]); + + $this->assertEquals($ring1, $polygon->getRing(0)); + } public function testSolidPolygonFromArrayAddRings() { - $expected = array( + $expected = [ new LineString( - array( + [ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - ) + new Point(0, 0), + ] ), new LineString( - array( + [ new Point(2, 2), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(2, 2) - ) - ) - ); + new Point(2, 2), + ] + ), + ]; - $rings = array( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ) - ); + $rings = [ + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + ]; $polygon = new Polygon($rings); $polygon->addRing( - array( - array(2, 2), - array(10, 0), - array(10, 10), - array(0, 10), - array(2, 2) - ) + [ + [2, 2], + [10, 0], + [10, 10], + [0, 10], + [2, 2], + ] ); $this->assertEquals($expected, $polygon->getRings()); } - public function testRingPolygonFromObjectsGetSingleRing() + public function testSolidPolygonFromArrayOfPoints() { - $ring1 = new LineString( - array( + $expected = [ + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + ]; + $rings = [ + [ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), - new Point(0, 0) - ) - ); - $ring2 = new LineString( - array( - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5) - ) - ); - $polygon = new Polygon(array($ring1, $ring2)); - - $this->assertEquals($ring1, $polygon->getRing(0)); - } - - public function testRingPolygonFromObjectsGetLastRing() - { - $ring1 = new LineString( - array( new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0) - ) - ); - $ring2 = new LineString( - array( - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5) - ) - ); - $polygon = new Polygon(array($ring1, $ring2)); + ], + ]; - $this->assertEquals($ring2, $polygon->getRing(-1)); + $polygon = new Polygon($rings); + + $this->assertEquals($expected, $polygon->toArray()); } - /** - * Test Polygon with open ring - * - * @expectedException \CrEOF\Spatial\Exception\InvalidValueException - * @expectedExceptionMessage Invalid polygon, ring "(0 0,10 0,10 10,0 10)" is not closed - */ - public function testOpenPolygonRing() + public function testSolidPolygonFromArraysGetRings() { - $rings = array( - new LineString(array( - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10) - )) - ); + $expected = [ + new LineString( + [ + new Point(0, 0), + new Point(10, 0), + new Point(10, 10), + new Point(0, 10), + new Point(0, 0), + ] + ), + ]; + $rings = [ + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + ]; - new Polygon($rings); + $polygon = new Polygon($rings); + + $this->assertEquals($expected, $polygon->getRings()); } public function testSolidPolygonFromArraysToString() { $expected = '(0 0,10 0,10 10,0 10,0 0),(0 0,10 0,10 10,0 10,0 0)'; - $rings = array( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ), - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ) - ); + $rings = [ + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + ]; $polygon = new Polygon($rings); - $result = (string)$polygon; + $result = (string) $polygon; $this->assertEquals($expected, $result); } - public function testJson() + public function testSolidPolygonFromObjectsToArray() { - $expected = '{"type":"Polygon","coordinates":[[[0,0],[10,0],[10,10],[0,10],[0,0]],[[0,0],[10,0],[10,10],[0,10],[0,0]]]}'; - $rings = array( - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) + $expected = [ + [ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ], + ]; + $rings = [ + new LineString( + [ + new Point(0, 0), + new Point(10, 0), + new Point(10, 10), + new Point(0, 10), + new Point(0, 0), + ] ), - array( - array(0, 0), - array(10, 0), - array(10, 10), - array(0, 10), - array(0, 0) - ) - ); + ]; + $polygon = new Polygon($rings); - $this->assertEquals($expected, $polygon->toJson()); + $this->assertEquals($expected, $polygon->toArray()); } } diff --git a/tests/CrEOF/Spatial/Tests/TestInit.php b/tests/CrEOF/Spatial/Tests/TestInit.php index 13ee135e..499197db 100644 --- a/tests/CrEOF/Spatial/Tests/TestInit.php +++ b/tests/CrEOF/Spatial/Tests/TestInit.php @@ -1,10 +1,34 @@ add('CrEOF\Spatial\Tests', __DIR__ . '/../../..'); -$loader->add('Doctrine\Tests', __DIR__ . '/../../../../vendor/doctrine/orm/tests'); +$loader = new ClassLoader(); +$loader->add('CrEOF\Spatial\Tests', __DIR__.'/../../..'); +$loader->add('Doctrine\Tests', __DIR__.'/../../../../vendor/doctrine/orm/tests'); $loader->register(); From 67887388b51063a53ac29670b151f8061b274009 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Fri, 21 Feb 2020 14:41:30 +0100 Subject: [PATCH 04/44] Replacing CoversNothing by CoversDefaultClass --- tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php | 2 +- .../Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php | 2 +- .../Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php | 2 +- tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php | 2 +- .../Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php | 2 +- .../Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php | 2 +- .../Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php | 2 +- .../Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php | 2 +- tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php | 2 +- tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php | 2 +- .../Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/GeometryTest.php | 4 ++-- .../Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php | 2 +- .../Query/AST/Functions/PostgreSql/STClosestPointTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STCollectTest.php | 2 +- .../AST/Functions/PostgreSql/STContainsProperlyTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STContainsTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STCoversTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php | 2 +- .../Query/AST/Functions/PostgreSql/STDistanceSphereTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php | 2 +- .../Query/AST/Functions/PostgreSql/STGeomFromTextTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STLengthTest.php | 2 +- .../AST/Functions/PostgreSql/STLineCrossingDirectionTest.php | 2 +- .../Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php | 4 ++-- .../ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php | 2 +- tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php | 2 +- tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php | 2 +- tests/CrEOF/Spatial/Tests/PHP/Types/Geography/PointTest.php | 2 +- .../Spatial/Tests/PHP/Types/Geometry/LineStringTest.php | 2 +- .../Spatial/Tests/PHP/Types/Geometry/MultiLineStringTest.php | 2 +- .../Spatial/Tests/PHP/Types/Geometry/MultiPointTest.php | 2 +- .../Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php | 2 +- tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PointTest.php | 2 +- tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PolygonTest.php | 5 ++++- 54 files changed, 59 insertions(+), 56 deletions(-) diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php index 9d4219e7..851e0a6c 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php @@ -38,7 +38,7 @@ * @group geometry * * @internal - * @coversNothing + * @coversDefaultClass */ class PlatformTest extends OrmMockTestCase { diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php index 042dad87..84e022c9 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php @@ -37,7 +37,7 @@ * @group srid * * @internal - * @coversNothing + * @coversDefaultClass */ class GeoPointSridTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php index a9694c4f..0268bc23 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php @@ -39,7 +39,7 @@ * @group geography * * @internal - * @coversNothing + * @coversDefaultClass */ class GeoPolygonTypeTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php index 95912f2b..bbc1e73b 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php @@ -40,7 +40,7 @@ * @group geography * * @internal - * @coversNothing + * @coversDefaultClass */ class GeographyTypeTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php index 4aa94ef7..0ef0e486 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php @@ -38,7 +38,7 @@ * @group geometry * * @internal - * @coversNothing + * @coversDefaultClass */ class LineStringTypeTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php index 9051d9ff..5889743d 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php @@ -40,7 +40,7 @@ * @group geometry * * @internal - * @coversNothing + * @coversDefaultClass */ class MultiPolygonTypeTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php index 8c92a48e..323f46ed 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php @@ -37,7 +37,7 @@ * @group geometry * * @internal - * @coversNothing + * @coversDefaultClass */ class PointTypeTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php index f700cd7e..4a99c165 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php @@ -39,7 +39,7 @@ * @group geometry * * @internal - * @coversNothing + * @coversDefaultClass */ class PolygonTypeTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php index 5e7e17b6..bbf83b9d 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php @@ -40,7 +40,7 @@ * @group geometry * * @internal - * @coversNothing + * @coversDefaultClass */ class GeometryTypeTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php index 23737675..2d41c55e 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php @@ -34,7 +34,7 @@ * @license http://dlambert.mit-license.org MIT * * @internal - * @coversNothing + * @coversDefaultClass */ class SchemaTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php index 78e0c483..20ff0a36 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php @@ -39,7 +39,7 @@ * @group dql * * @internal - * @coversNothing + * @coversDefaultClass */ class AreaTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php index e9ee526e..10be963f 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php @@ -38,7 +38,7 @@ * @group dql * * @internal - * @coversNothing + * @coversDefaultClass */ class AsBinaryTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php index f5437cfb..cb19e9d0 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php @@ -38,7 +38,7 @@ * @group dql * * @internal - * @coversNothing + * @coversDefaultClass */ class AsTextTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php index 20654880..a8da91ca 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php @@ -39,7 +39,7 @@ * @group dql * * @internal - * @coversNothing + * @coversDefaultClass */ class ContainsTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php index 29d86208..4cfef864 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php @@ -39,7 +39,7 @@ * @group dql * * @internal - * @coversNothing + * @coversDefaultClass */ class DisjointTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php index 53f6999c..661471f3 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php @@ -39,7 +39,7 @@ * @group dql * * @internal - * @coversNothing + * @coversDefaultClass */ class EnvelopeTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php index bdd86b68..895a0250 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php @@ -38,7 +38,7 @@ * @group dql * * @internal - * @coversNothing + * @coversDefaultClass */ class GLengthTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php index f4da8274..54808baf 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php @@ -38,7 +38,7 @@ * @group dql * * @internal - * @coversNothing + * @coversDefaultClass */ class GeomFromTextTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php index 2fe9fbec..6d2a8bcb 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php @@ -39,7 +39,7 @@ * @group dql * * @internal - * @coversNothing + * @coversDefaultClass */ class MBRContainsTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php index 28b3bcb2..bf6c0d93 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php @@ -39,7 +39,7 @@ * @group dql * * @internal - * @coversNothing + * @coversDefaultClass */ class MBRDisjointTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php index b7374e6c..87de755f 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php @@ -38,7 +38,7 @@ * @group dql * * @internal - * @coversNothing + * @coversDefaultClass */ class StartPointTest extends OrmTestCase { diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php index 151bf7ab..625ee8ff 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php @@ -1,7 +1,7 @@ Date: Fri, 21 Feb 2020 15:17:35 +0100 Subject: [PATCH 05/44] Fixing code sniffer errors and warnings --- phpcs.xml.dist | 1 + .../Tests/DBAL/Platform/PlatformTest.php | 12 +++ .../AST/Functions/MySql/AsBinaryTest.php | 47 +++++--- tests/CrEOF/Spatial/Tests/OrmTestCase.php | 11 +- .../Tests/PHP/Types/Geography/PointTest.php | 41 ++++++- .../PHP/Types/Geometry/MultiPointTest.php | 29 ++++- .../Tests/PHP/Types/Geometry/PointTest.php | 102 ++++++++++++------ .../Tests/PHP/Types/Geometry/PolygonTest.php | 47 ++++++-- 8 files changed, 222 insertions(+), 68 deletions(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 6a809ce2..7cb390a1 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -4,6 +4,7 @@ xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"> + diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php index 851e0a6c..6a47ee52 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php @@ -26,8 +26,10 @@ use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\Tests\OrmMockTestCase; +use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Tools\SchemaTool; +use Doctrine\ORM\Tools\ToolsException; /** * Spatial platform tests. @@ -42,6 +44,11 @@ */ class PlatformTest extends OrmMockTestCase { + /** + * Setup the test. + * + * @throws DBALException This should not happen + */ public function setUp(): void { if (!Type::hasType('point')) { @@ -51,6 +58,11 @@ public function setUp(): void parent::setUp(); } + /** + * Test non-supported platform. + * + * @throws ToolsException this should not happen + */ public function testUnsupportedPlatform() { $this->expectException(UnsupportedPlatformException::class); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php index 10be963f..e1af2679 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php @@ -24,10 +24,13 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\MySql; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\ORM\ORMException; /** * AsBinary DQL function tests. @@ -42,6 +45,11 @@ */ class AsBinaryTest extends OrmTestCase { + /** + * Setup the test. + * + * @throws UnsupportedPlatformException this should not happen + */ protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); @@ -51,40 +59,49 @@ protected function setUp(): void } /** + * Test to convert as binary. + * * @group geometry + * + * @throws ORMException this should not happen + * @throws MappingException this should not happen */ public function testAsBinary() { - $lineString1 = [ + $lineStringA = [ new Point(0, 0), new Point(2, 2), new Point(5, 5), ]; - $lineString2 = [ + $lineStringB = [ new Point(3, 3), new Point(4, 15), new Point(5, 22), ]; - $entity1 = new LineStringEntity(); + $entityA = new LineStringEntity(); - $entity1->setLineString(new LineString($lineString1)); - $this->getEntityManager()->persist($entity1); + $entityA->setLineString(new LineString($lineStringA)); + $this->getEntityManager()->persist($entityA); - $entity2 = new LineStringEntity(); + $entityB = new LineStringEntity(); - $entity2->setLineString(new LineString($lineString2)); - $this->getEntityManager()->persist($entity2); + $entityB->setLineString(new LineString($lineStringB)); + $this->getEntityManager()->persist($entityB); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT AsBinary(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); + $query = $this->getEntityManager()->createQuery( + 'SELECT AsBinary(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l' + ); $result = $query->getResult(); - $string1 = '010200000003000000000000000000000000000000000000000000000000000040000000000000004000000000000014400000000000001440'; - $string2 = '0102000000030000000000000000000840000000000000084000000000000010400000000000002e4000000000000014400000000000003640'; - $binary1 = pack('H*', $string1); - $binary2 = pack('H*', $string2); + // phpcs:disable Generic.Files.LineLength.MaxExceeded + $stringA = '010200000003000000000000000000000000000000000000000000000000000040000000000000004000000000000014400000000000001440'; + $stringB = '0102000000030000000000000000000840000000000000084000000000000010400000000000002e4000000000000014400000000000003640'; + // phpcs:enable + $binaryA = pack('H*', $stringA); + $binaryB = pack('H*', $stringB); - $this->assertEquals($binary1, $result[0][1]); - $this->assertEquals($binary2, $result[1][1]); + $this->assertEquals($binaryA, $result[0][1]); + $this->assertEquals($binaryB, $result[1][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/OrmTestCase.php b/tests/CrEOF/Spatial/Tests/OrmTestCase.php index f2f1ea35..2b2a24c4 100644 --- a/tests/CrEOF/Spatial/Tests/OrmTestCase.php +++ b/tests/CrEOF/Spatial/Tests/OrmTestCase.php @@ -1,7 +1,7 @@ supportedPlatforms) && !isset($this->supportedPlatforms[$this->getPlatform()->getName()])) { - $this->markTestSkipped(sprintf('No support for platform %s in test class %s.', $this->getPlatform()->getName(), get_class($this))); + $this->markTestSkipped(sprintf( + 'No support for platform %s in test class %s.', + $this->getPlatform()->getName(), + get_class($this) + )); } $this->entityManager = $this->getEntityManager(); diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geography/PointTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geography/PointTest.php index 4f4519d7..915ccfcd 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geography/PointTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geography/PointTest.php @@ -31,9 +31,6 @@ /** * Point object tests. * - * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT - * * @group php * * @internal @@ -58,7 +55,9 @@ public function testBadLatitudeDegrees() public function testBadLatitudeDirection() { $this->expectException(InvalidValueException::class); + // phpcs:disable Generic.Files.LineLength.MaxExceeded $this->expectExceptionMessage('[Syntax Error] line 0, col 8: Error: Expected CrEOF\\Geo\\String\\Lexer::T_INTEGER or CrEOF\\Geo\\String\\Lexer::T_FLOAT, got "Q" in value "84:26:46Q"'); + // phpcs:enable new Point('100:56:55W', '84:26:46Q'); } @@ -102,7 +101,9 @@ public function testBadLongitudeDegrees() public function testBadLongitudeDirection() { $this->expectException(InvalidValueException::class); + // phpcs:disable Generic.Files.LineLength.MaxExceeded $this->expectExceptionMessage('[Syntax Error] line 0, col 9: Error: Expected CrEOF\\Geo\\String\\Lexer::T_INTEGER or CrEOF\\Geo\\String\\Lexer::T_FLOAT, got "P" in value "100:56:55P"'); + // phpcs:enable new Point('100:56:55P', '84:26:46N'); } @@ -173,6 +174,9 @@ public function testBadNumericLessThanLongitude() new Point(-230, 54); } + /** + * Test getType method. + */ public function testGetType() { $point = new Point(10, 10); @@ -181,6 +185,9 @@ public function testGetType() $this->assertEquals('Point', $result); } + /** + * Test a valid numeric point. + */ public function testGoodNumericPoint() { $point = new Point(-73.7562317, 42.6525793); @@ -189,6 +196,9 @@ public function testGoodNumericPoint() $this->assertEquals(-73.7562317, $point->getLongitude()); } + /** + * Test valid string points. + */ public function testGoodStringPoints() { $point = new Point('79:56:55W', '40:26:46N'); @@ -227,6 +237,9 @@ public function testGoodStringPoints() $this->assertEquals(-112.06666666667, $point->getLongitude()); } + /** + * Test a point created with an array and converts to string. + */ public function testPointFromArrayToString() { $expected = '5 5'; @@ -235,30 +248,52 @@ public function testPointFromArrayToString() $this->assertEquals($expected, (string) $point); } + /** + * Test error when point created with too many arguments. + */ public function testPointTooManyArguments() { $this->expectException(InvalidValueException::class); + // phpcs:disable Generic.Files.LineLength.MaxExceeded $this->expectExceptionMessage('Invalid parameters passed to CrEOF\\Spatial\\PHP\\Types\\Geography\\Point::__construct: "5", "5", "5", "5"'); + // phpcs:enable new Point(5, 5, 5, 5); } + /** + * Test a point with SRID. + */ public function testPointWithSrid() { $point = new Point(10, 10, 4326); $result = $point->getSrid(); $this->assertEquals(4326, $result); + + //Lambert + $point = new Point(10, 10, 2154); + $result = $point->getSrid(); + + $this->assertEquals(2154, $result); } + /** + * Test error when point is created with wrong arguments. + */ public function testPointWrongArgumentTypes() { $this->expectException(InvalidValueException::class); + // phpcs:disable Generic.Files.LineLength.MaxExceeded $this->expectExceptionMessage('Invalid parameters passed to CrEOF\\Spatial\\PHP\\Types\\Geography\\Point::__construct: Array, Array, "1234"'); + // phpcs:enable new Point([], [], '1234'); } + /** + * Test to convert point to array. + */ public function testToArray() { $expected = [10, 10]; diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPointTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPointTest.php index f022617a..0fe72c3c 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPointTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPointTest.php @@ -32,9 +32,6 @@ /** * MultiPoint object tests. * - * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT - * * @group php * * @internal @@ -53,6 +50,9 @@ public function testBadLineString() new MultiPoint([1, 2, 3, 4]); } + /** + * Test an empty multipoint. + */ public function testEmptyMultiPoint() { $multiPoint = new MultiPoint([]); @@ -60,6 +60,9 @@ public function testEmptyMultiPoint() $this->assertEmpty($multiPoint->getPoints()); } + /** + * Test to convert multipoint to json. + */ public function testJson() { $expected = '{"type":"MultiPoint","coordinates":[[0,0],[0,5],[5,0],[0,0]]}'; @@ -75,6 +78,11 @@ public function testJson() $this->assertEquals($expected, $multiPoint->toJson()); } + /** + * Test to add point to a multipoint. + * + * @throws InvalidValueException this should not happen + */ public function testMultiPointAddPoints() { $expected = [ @@ -101,6 +109,9 @@ public function testMultiPointAddPoints() $this->assertEquals($expected, $actual); } + /** + * Test to get last point from a multipoint. + */ public function testMultiPointFromArraysGetLastPoint() { $expected = new Point(3, 3); @@ -117,6 +128,9 @@ public function testMultiPointFromArraysGetLastPoint() $this->assertEquals($expected, $actual); } + /** + * Test to get points from a multipoint. + */ public function testMultiPointFromArraysGetPoints() { $expected = [ @@ -139,6 +153,9 @@ public function testMultiPointFromArraysGetPoints() $this->assertEquals($expected, $actual); } + /** + * Test to get first point from a multipoint. + */ public function testMultiPointFromArraysGetSinglePoint() { $expected = new Point(1, 1); @@ -155,6 +172,9 @@ public function testMultiPointFromArraysGetSinglePoint() $this->assertEquals($expected, $actual); } + /** + * Test to convert multipoint to string. + */ public function testMultiPointFromArraysToString() { $expected = '0 0,0 5,5 0,0 0'; @@ -170,6 +190,9 @@ public function testMultiPointFromArraysToString() $this->assertEquals($expected, (string) $multiPoint); } + /** + * Test to convert multipoint to array. + */ public function testMultiPointFromObjectsToArray() { $expected = [ diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PointTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PointTest.php index f1b90f3a..9d746758 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PointTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PointTest.php @@ -31,9 +31,6 @@ /** * Point object tests. * - * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT - * * @group php * * @internal @@ -58,7 +55,9 @@ public function testBadLatitudeDegrees() public function testBadLatitudeDirection() { $this->expectException(InvalidValueException::class); + // phpcs:disable Generic.Files.LineLength.MaxExceeded $this->expectExceptionMessage('[Syntax Error] line 0, col 8: Error: Expected CrEOF\\Geo\\String\\Lexer::T_INTEGER or CrEOF\\Geo\\String\\Lexer::T_FLOAT, got "Q" in value "84:26:46Q"'); + // phpcs:enable new Point('100:56:55W', '84:26:46Q'); } @@ -102,7 +101,9 @@ public function testBadLongitudeDegrees() public function testBadLongitudeDirection() { $this->expectException(InvalidValueException::class); + // phpcs:disable Generic.Files.LineLength.MaxExceeded $this->expectExceptionMessage('[Syntax Error] line 0, col 9: Error: Expected CrEOF\\Geo\\String\\Lexer::T_INTEGER or CrEOF\\Geo\\String\\Lexer::T_FLOAT, got "P" in value "100:56:55P"'); + // phpcs:enable new Point('100:56:55P', '84:26:46N'); } @@ -129,6 +130,9 @@ public function testBadLongitudeSeconds() new Point('108:53:94W', '84:26:46N'); } + /** + * Test getType method. + */ public function testGetType() { $point = new Point(10, 10); @@ -137,60 +141,69 @@ public function testGetType() $this->assertEquals('Point', $result); } + /** + * Test a valid numeric point. + */ public function testGoodNumericPoint() { - $point1 = new Point(-73.7562317, 42.6525793); + $point = new Point(-73.7562317, 42.6525793); - $this->assertEquals(42.6525793, $point1->getLatitude()); - $this->assertEquals(-73.7562317, $point1->getLongitude()); + $this->assertEquals(42.6525793, $point->getLatitude()); + $this->assertEquals(-73.7562317, $point->getLongitude()); - $point1 + $point ->setLatitude(40.446111111111) ->setLongitude(-79.948611111111) ; - $this->assertEquals(40.446111111111, $point1->getLatitude()); - $this->assertEquals(-79.948611111111, $point1->getLongitude()); + $this->assertEquals(40.446111111111, $point->getLatitude()); + $this->assertEquals(-79.948611111111, $point->getLongitude()); } + /** + * Test valid string points. + */ public function testGoodStringPoints() { - $point2 = new Point('79:56:55W', '40:26:46N'); + $point = new Point('79:56:55W', '40:26:46N'); - $this->assertEquals(40.446111111111, $point2->getLatitude()); - $this->assertEquals(-79.948611111111, $point2->getLongitude()); + $this->assertEquals(40.446111111111, $point->getLatitude()); + $this->assertEquals(-79.948611111111, $point->getLongitude()); - $point3 = new Point('79°56\'55"W', '40°26\'46"N'); + $point = new Point('79°56\'55"W', '40°26\'46"N'); - $this->assertEquals(40.446111111111, $point3->getLatitude()); - $this->assertEquals(-79.948611111111, $point3->getLongitude()); + $this->assertEquals(40.446111111111, $point->getLatitude()); + $this->assertEquals(-79.948611111111, $point->getLongitude()); - $point4 = new Point('79° 56\' 55" W', '40° 26\' 46" N'); + $point = new Point('79° 56\' 55" W', '40° 26\' 46" N'); - $this->assertEquals(40.446111111111, $point4->getLatitude()); - $this->assertEquals(-79.948611111111, $point4->getLongitude()); + $this->assertEquals(40.446111111111, $point->getLatitude()); + $this->assertEquals(-79.948611111111, $point->getLongitude()); - $point5 = new Point('79°56′55″W', '40°26′46″N'); + $point = new Point('79°56′55″W', '40°26′46″N'); - $this->assertEquals(40.446111111111, $point5->getLatitude()); - $this->assertEquals(-79.948611111111, $point5->getLongitude()); + $this->assertEquals(40.446111111111, $point->getLatitude()); + $this->assertEquals(-79.948611111111, $point->getLongitude()); - $point6 = new Point('79° 56′ 55″ W', '40° 26′ 46″ N'); + $point = new Point('79° 56′ 55″ W', '40° 26′ 46″ N'); - $this->assertEquals(40.446111111111, $point6->getLatitude()); - $this->assertEquals(-79.948611111111, $point6->getLongitude()); + $this->assertEquals(40.446111111111, $point->getLatitude()); + $this->assertEquals(-79.948611111111, $point->getLongitude()); - $point7 = new Point('79:56:55.832W', '40:26:46.543N'); + $point = new Point('79:56:55.832W', '40:26:46.543N'); - $this->assertEquals(40.446261944444, $point7->getLatitude()); - $this->assertEquals(-79.948842222222, $point7->getLongitude()); + $this->assertEquals(40.446261944444, $point->getLatitude()); + $this->assertEquals(-79.948842222222, $point->getLongitude()); - $point8 = new Point('112:4:0W', '33:27:0N'); + $point = new Point('112:4:0W', '33:27:0N'); - $this->assertEquals(33.45, $point8->getLatitude()); - $this->assertEquals(-112.06666666667, $point8->getLongitude()); + $this->assertEquals(33.45, $point->getLatitude()); + $this->assertEquals(-112.06666666667, $point->getLongitude()); } + /** + * Test to convert point to json. + */ public function testJson() { $expected = '{"type":"Point","coordinates":[5,5]}'; @@ -205,11 +218,16 @@ public function testJson() public function testMissingArguments() { $this->expectException(InvalidValueException::class); + // phpcs:disable Generic.Files.LineLength.MaxExceeded $this->expectExceptionMessage('Invalid parameters passed to CrEOF\\Spatial\\PHP\\Types\\Geometry\\Point::__construct:'); + // phpcs:enable new Point(); } + /** + * Test a point created with an array. + */ public function testPointFromArrayToString() { $expected = '5 5'; @@ -218,30 +236,46 @@ public function testPointFromArrayToString() $this->assertEquals($expected, (string) $point); } + /** + * Test error when point is created with too many arguments. + */ public function testPointTooManyArguments() { $this->expectException(InvalidValueException::class); + // phpcs:disable Generic.Files.LineLength.MaxExceeded $this->expectExceptionMessage('Invalid parameters passed to CrEOF\\Spatial\\PHP\\Types\\Geometry\\Point::__construct: "5", "5", "5", "5"'); + // phpcs:enable new Point(5, 5, 5, 5); } + /** + * Test point with srid. + */ public function testPointWithSrid() { - $point = new Point(10, 10, 4326); + $point = new Point(10, 10, 2154); $result = $point->getSrid(); - $this->assertEquals(4326, $result); + $this->assertEquals(2154, $result); } + /** + * Test error when point was created with wrong arguments type. + */ public function testPointWrongArgumentTypes() { $this->expectException(InvalidValueException::class); + // phpcs:disable Generic.Files.LineLength.MaxExceeded $this->expectExceptionMessage('Invalid parameters passed to CrEOF\\Spatial\\PHP\\Types\\Geometry\\Point::__construct: Array, Array, "1234"'); + // phpcs:enable new Point([], [], '1234'); } + /** + * Test to convert a point to an array. + */ public function testToArray() { $expected = [10, 10]; @@ -257,7 +291,9 @@ public function testToArray() public function testTwoInvalidArguments() { $this->expectException(InvalidValueException::class); + // phpcs:disable Generic.Files.LineLength.MaxExceeded $this->expectExceptionMessage('Invalid parameters passed to CrEOF\\Spatial\\PHP\\Types\\Geometry\\Point::__construct: "", ""'); + // phpcs:enable new Point(null, null); } @@ -268,7 +304,9 @@ public function testTwoInvalidArguments() public function testUnusedArguments() { $this->expectException(InvalidValueException::class); + // phpcs:disable Generic.Files.LineLength.MaxExceeded $this->expectExceptionMessage('Invalid parameters passed to CrEOF\\Spatial\\PHP\\Types\\Geometry\\Point::__construct: "1", "2", "3", "4", "", "5"'); + // phpcs:enable new Point(1, 2, 3, 4, null, 5); } diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PolygonTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PolygonTest.php index bfeec2f4..49e079e6 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PolygonTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PolygonTest.php @@ -33,9 +33,6 @@ /** * Polygon object tests. * - * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT - * * @group php * * @internal @@ -53,9 +50,14 @@ public function testEmptyPolygon() $this->assertEmpty($polygon->getRings()); } + /** + * Test to export json. + */ public function testJson() { + // phpcs:disable Generic.Files.LineLength.MaxExceeded $expected = '{"type":"Polygon","coordinates":[[[0,0],[10,0],[10,10],[0,10],[0,0]],[[0,0],[10,0],[10,10],[0,10],[0,0]]]}'; + // phpcs:enable $rings = [ [ [0, 0], @@ -97,9 +99,12 @@ public function testOpenPolygonRing() new Polygon($rings); } + /** + * Test to get last ring. + */ public function testRingPolygonFromObjectsGetLastRing() { - $ring1 = new LineString( + $ringA = new LineString( [ new Point(0, 0), new Point(10, 0), @@ -108,7 +113,7 @@ public function testRingPolygonFromObjectsGetLastRing() new Point(0, 0), ] ); - $ring2 = new LineString( + $ringB = new LineString( [ new Point(5, 5), new Point(7, 5), @@ -117,14 +122,17 @@ public function testRingPolygonFromObjectsGetLastRing() new Point(5, 5), ] ); - $polygon = new Polygon([$ring1, $ring2]); + $polygon = new Polygon([$ringA, $ringB]); - $this->assertEquals($ring2, $polygon->getRing(-1)); + $this->assertEquals($ringB, $polygon->getRing(-1)); } + /** + * Test to get the first ring. + */ public function testRingPolygonFromObjectsGetSingleRing() { - $ring1 = new LineString( + $ringA = new LineString( [ new Point(0, 0), new Point(10, 0), @@ -133,7 +141,7 @@ public function testRingPolygonFromObjectsGetSingleRing() new Point(0, 0), ] ); - $ring2 = new LineString( + $ringB = new LineString( [ new Point(5, 5), new Point(7, 5), @@ -142,11 +150,16 @@ public function testRingPolygonFromObjectsGetSingleRing() new Point(5, 5), ] ); - $polygon = new Polygon([$ring1, $ring2]); + $polygon = new Polygon([$ringA, $ringB]); - $this->assertEquals($ring1, $polygon->getRing(0)); + $this->assertEquals($ringA, $polygon->getRing(0)); } + /** + * Test a solid polygon from array add rings. + * + * @throws InvalidValueException This should not happen + */ public function testSolidPolygonFromArrayAddRings() { $expected = [ @@ -195,6 +208,9 @@ public function testSolidPolygonFromArrayAddRings() $this->assertEquals($expected, $polygon->getRings()); } + /** + * Test a solid polygon from an array of points. + */ public function testSolidPolygonFromArrayOfPoints() { $expected = [ @@ -221,6 +237,9 @@ public function testSolidPolygonFromArrayOfPoints() $this->assertEquals($expected, $polygon->toArray()); } + /** + * Test a solid polygon from an array of rings. + */ public function testSolidPolygonFromArraysGetRings() { $expected = [ @@ -249,6 +268,9 @@ public function testSolidPolygonFromArraysGetRings() $this->assertEquals($expected, $polygon->getRings()); } + /** + * Test a solid polygon from arrays to string. + */ public function testSolidPolygonFromArraysToString() { $expected = '(0 0,10 0,10 10,0 10,0 0),(0 0,10 0,10 10,0 10,0 0)'; @@ -274,6 +296,9 @@ public function testSolidPolygonFromArraysToString() $this->assertEquals($expected, $result); } + /** + * Test solid polygon from objects to array. + */ public function testSolidPolygonFromObjectsToArray() { $expected = [ From ff1c3dc1328a8f10f1de628d6e8f6a0b1fecbf39 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Fri, 21 Feb 2020 15:22:55 +0100 Subject: [PATCH 06/44] Fixing code sniffer errors and warnings --- .../PHP/Types/Geometry/LineStringTest.php | 27 +++++++++++ .../Types/Geometry/MultiLineStringTest.php | 45 ++++++++++++++----- .../PHP/Types/Geometry/MultiPolygonTest.php | 45 ++++++++++++++----- 3 files changed, 95 insertions(+), 22 deletions(-) diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/LineStringTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/LineStringTest.php index 561102d5..9025812f 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/LineStringTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/LineStringTest.php @@ -53,6 +53,9 @@ public function testBadLineString() new LineString([1, 2, 3, 4]); } + /** + * Test an empty line string. + */ public function testEmptyLineString() { $lineString = new LineString([]); @@ -60,6 +63,9 @@ public function testEmptyLineString() $this->assertEmpty($lineString->getPoints()); } + /** + * Test to convert line string to json. + */ public function testJson() { $expected = '{"type":"LineString","coordinates":[[0,0],[0,5],[5,0],[0,0]]}'; @@ -75,6 +81,9 @@ public function testJson() $this->assertEquals($expected, $lineString->toJson()); } + /** + * Test to get last point. + */ public function testLineStringFromArraysGetLastPoint() { $expected = new Point(3, 3); @@ -91,6 +100,9 @@ public function testLineStringFromArraysGetLastPoint() $this->assertEquals($expected, $actual); } + /** + * Test to get all points of a line string. + */ public function testLineStringFromArraysGetPoints() { $expected = [ @@ -113,6 +125,9 @@ public function testLineStringFromArraysGetPoints() $this->assertEquals($expected, $actual); } + /** + * Test to get second point of a linestring. + */ public function testLineStringFromArraysGetSinglePoint() { $expected = new Point(1, 1); @@ -129,6 +144,9 @@ public function testLineStringFromArraysGetSinglePoint() $this->assertEquals($expected, $actual); } + /** + * Test to verify that a line is closed. + */ public function testLineStringFromArraysIsClosed() { $lineString = new LineString( @@ -143,6 +161,9 @@ public function testLineStringFromArraysIsClosed() $this->assertTrue($lineString->isClosed()); } + /** + * Test to verify that a line is opened. + */ public function testLineStringFromArraysIsOpen() { $lineString = new LineString( @@ -157,6 +178,9 @@ public function testLineStringFromArraysIsOpen() $this->assertFalse($lineString->isClosed()); } + /** + * Test to convert line to string. + */ public function testLineStringFromArraysToString() { $expected = '0 0,0 5,5 0,0 0'; @@ -172,6 +196,9 @@ public function testLineStringFromArraysToString() $this->assertEquals($expected, (string) $lineString); } + /** + * Test to convert line to array. + */ public function testLineStringFromObjectsToArray() { $expected = [ diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiLineStringTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiLineStringTest.php index f4626a7f..1dfca667 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiLineStringTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiLineStringTest.php @@ -32,9 +32,6 @@ /** * MultiLineString object tests. * - * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT - * * @group php * * @internal @@ -42,6 +39,9 @@ */ class MultiLineStringTest extends TestCase { + /** + * Test an empty multiline string. + */ public function testEmptyMultiLineString() { $multiLineString = new MultiLineString([]); @@ -49,9 +49,14 @@ public function testEmptyMultiLineString() $this->assertEmpty($multiLineString->getLineStrings()); } + /** + * Test to convert multiline string to json. + */ public function testJson() { + // phpcs:disable Generic.Files.LineLength.MaxExceeded $expected = '{"type":"MultiLineString","coordinates":[[[0,0],[10,0],[10,10],[0,10],[0,0]],[[0,0],[10,0],[10,10],[0,10],[0,0]]]}'; + // phpcs:enable $lineStrings = [ [ [0, 0], @@ -73,6 +78,9 @@ public function testJson() $this->assertEquals($expected, $multiLineString->toJson()); } + /** + * Test to convert a multiline string to a string. + */ public function testMultiLineStringFromArraysToString() { $expected = '(0 0,10 0,10 10,0 10,0 0),(0 0,10 0,10 10,0 10,0 0)'; @@ -98,9 +106,12 @@ public function testMultiLineStringFromArraysToString() $this->assertEquals($expected, $result); } + /** + * Test to get last line from multiline string. + */ public function testMultiLineStringFromObjectsGetLastLineString() { - $lineString1 = new LineString( + $firstLineString = new LineString( [ new Point(0, 0), new Point(10, 0), @@ -109,7 +120,7 @@ public function testMultiLineStringFromObjectsGetLastLineString() new Point(0, 0), ] ); - $lineString2 = new LineString( + $lastLineString = new LineString( [ new Point(5, 5), new Point(7, 5), @@ -118,14 +129,17 @@ public function testMultiLineStringFromObjectsGetLastLineString() new Point(5, 5), ] ); - $polygon = new MultiLineString([$lineString1, $lineString2]); + $polygon = new MultiLineString([$firstLineString, $lastLineString]); - $this->assertEquals($lineString2, $polygon->getLineString(-1)); + $this->assertEquals($lastLineString, $polygon->getLineString(-1)); } + /** + * Test to get first line from multiline string. + */ public function testMultiLineStringFromObjectsGetSingleLineString() { - $lineString1 = new LineString( + $firstLineString = new LineString( [ new Point(0, 0), new Point(10, 0), @@ -134,7 +148,7 @@ public function testMultiLineStringFromObjectsGetSingleLineString() new Point(0, 0), ] ); - $lineString2 = new LineString( + $lastLineString = new LineString( [ new Point(5, 5), new Point(7, 5), @@ -143,11 +157,14 @@ public function testMultiLineStringFromObjectsGetSingleLineString() new Point(5, 5), ] ); - $multiLineString = new MultiLineString([$lineString1, $lineString2]); + $multiLineString = new MultiLineString([$firstLineString, $lastLineString]); - $this->assertEquals($lineString1, $multiLineString->getLineString(0)); + $this->assertEquals($firstLineString, $multiLineString->getLineString(0)); } + /** + * Test to create multiline string from line string. + */ public function testMultiLineStringFromObjectsToArray() { $expected = [ @@ -192,6 +209,9 @@ public function testMultiLineStringFromObjectsToArray() $this->assertEquals($expected, $multiLineString->toArray()); } + /** + * Test a solid multiline string. + */ public function testSolidMultiLineStringAddRings() { $expected = [ @@ -239,6 +259,9 @@ public function testSolidMultiLineStringAddRings() $this->assertEquals($expected, $multiLineString->getLineStrings()); } + /** + * Test a solid multiline string. + */ public function testSolidMultiLineStringFromArraysGetRings() { $expected = [ diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php index 6e5cd5be..e2c60842 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php @@ -33,9 +33,6 @@ /** * Polygon object tests. * - * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT - * * @group php * * @internal @@ -43,6 +40,9 @@ */ class MultiPolygonTest extends TestCase { + /** + * Test an empty polygon. + */ public function testEmptyMultiPolygon() { $multiPolygon = new MultiPolygon([]); @@ -50,9 +50,14 @@ public function testEmptyMultiPolygon() $this->assertEmpty($multiPolygon->getPolygons()); } + /** + * Test to convert multipolygon to Json. + */ public function testJson() { + // phpcs:disable Generic.Files.LineLength.MaxExceeded $expected = '{"type":"MultiPolygon","coordinates":[[[[0,0],[10,0],[10,10],[0,10],[0,0]]],[[[5,5],[7,5],[7,7],[5,7],[5,5]]]]}'; + // phpcs:enable $polygons = [ [ [ @@ -78,9 +83,12 @@ public function testJson() $this->assertEquals($expected, $multiPolygon->toJson()); } + /** + * Test to get last polygon from a multipolygon created from a lot objects. + */ public function testMultiPolygonFromObjectsGetLastPolygon() { - $polygon1 = new Polygon( + $firstPolygon = new Polygon( [ new LineString( [ @@ -93,7 +101,7 @@ public function testMultiPolygonFromObjectsGetLastPolygon() ), ] ); - $polygon2 = new Polygon( + $lastPolygon = new Polygon( [ new LineString( [ @@ -106,14 +114,17 @@ public function testMultiPolygonFromObjectsGetLastPolygon() ), ] ); - $multiPolygon = new MultiPolygon([$polygon1, $polygon2]); + $multiPolygon = new MultiPolygon([$firstPolygon, $lastPolygon]); - $this->assertEquals($polygon2, $multiPolygon->getPolygon(-1)); + $this->assertEquals($lastPolygon, $multiPolygon->getPolygon(-1)); } + /** + * Test to get first polygon from a multipolygon created from a lot objects. + */ public function testMultiPolygonFromObjectsGetSinglePolygon() { - $polygon1 = new Polygon( + $firstPolygon = new Polygon( [ new LineString( [ @@ -126,7 +137,7 @@ public function testMultiPolygonFromObjectsGetSinglePolygon() ), ] ); - $polygon2 = new Polygon( + $lastPolygon = new Polygon( [ new LineString( [ @@ -139,11 +150,14 @@ public function testMultiPolygonFromObjectsGetSinglePolygon() ), ] ); - $multiPolygon = new MultiPolygon([$polygon1, $polygon2]); + $multiPolygon = new MultiPolygon([$firstPolygon, $lastPolygon]); - $this->assertEquals($polygon1, $multiPolygon->getPolygon(0)); + $this->assertEquals($firstPolygon, $multiPolygon->getPolygon(0)); } + /** + * Test getPolygons method. + */ public function testSolidMultiPolygonAddPolygon() { $expected = [ @@ -206,6 +220,9 @@ public function testSolidMultiPolygonAddPolygon() $this->assertEquals($expected, $multiPolygon->getPolygons()); } + /** + * Test getPolygons method. + */ public function testSolidMultiPolygonFromArraysGetPolygons() { $expected = [ @@ -263,6 +280,9 @@ public function testSolidMultiPolygonFromArraysGetPolygons() $this->assertEquals($expected, $multiPolygon->getPolygons()); } + /** + * Test to convert multipolygon created from array to string. + */ public function testSolidMultiPolygonFromArraysToString() { $expected = '((0 0,10 0,10 10,0 10,0 0)),((5 5,7 5,7 7,5 7,5 5))'; @@ -292,6 +312,9 @@ public function testSolidMultiPolygonFromArraysToString() $this->assertEquals($expected, $result); } + /** + * Test to convert multipolygon created from objects to array. + */ public function testSolidMultiPolygonFromObjectsToArray() { $expected = [ From 9a14a9cf4db398ed7bda9ad02ac18c9b3eadb040 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Fri, 21 Feb 2020 15:31:31 +0100 Subject: [PATCH 07/44] Fixing code sniffer errors and warnings --- tests/CrEOF/Spatial/Tests/OrmTestCase.php | 123 ++++++++++++++---- .../PHP/Types/Geometry/LineStringTest.php | 3 - 2 files changed, 98 insertions(+), 28 deletions(-) diff --git a/tests/CrEOF/Spatial/Tests/OrmTestCase.php b/tests/CrEOF/Spatial/Tests/OrmTestCase.php index 2b2a24c4..88a23a13 100644 --- a/tests/CrEOF/Spatial/Tests/OrmTestCase.php +++ b/tests/CrEOF/Spatial/Tests/OrmTestCase.php @@ -27,21 +27,23 @@ use CrEOF\Spatial\Exception\UnsupportedPlatformException; use Doctrine\Common\Cache\ArrayCache; use Doctrine\DBAL\Connection; +use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Logging\DebugStack; use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Configuration; use Doctrine\ORM\EntityManager; +use Doctrine\ORM\ORMException; use Doctrine\ORM\Tools\SchemaTool; +use Doctrine\ORM\Tools\ToolsException; use Exception; +use PHPUnit\Framework\AssertionFailedError; use PHPUnit\Framework\TestCase; +use Throwable; /** * Abstract ORM test class. - * - * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT */ abstract class OrmTestCase extends TestCase { @@ -151,6 +153,7 @@ abstract class OrmTestCase extends TestCase * @var bool[] */ protected $usedTypes = []; + /** * @var SchemaTool */ @@ -162,7 +165,10 @@ abstract class OrmTestCase extends TestCase private $sqlLoggerStack; /** - * @throws UnsupportedPlatformException + * Setup connection before class creation. + * + * @throws UnsupportedPlatformException this should not happen + * @throws DBALException this can happen when database or credentials are not set */ public static function setUpBeforeClass(): void { @@ -172,7 +178,8 @@ public static function setUpBeforeClass(): void /** * Creates a connection to the test database, if there is none yet, and creates the necessary tables. * - * @throws UnsupportedPlatformException + * @throws UnsupportedPlatformException this should not happen + * @throws DBALException this can happen when database or credentials are not set */ protected function setUp(): void { @@ -200,19 +207,27 @@ protected function setUp(): void /** * Teardown fixtures. + * + * @throws UnsupportedPlatformException this should not happen + * @throws DBALException this can happen when database or credentials are not set */ protected function tearDown(): void { $this->sqlLoggerStack->enabled = false; foreach (array_keys($this->usedEntities) as $entityName) { - static::getConnection()->executeUpdate(sprintf('DELETE FROM %s', static::$entities[$entityName]['table'])); + static::getConnection()->executeUpdate(sprintf( + 'DELETE FROM %s', + static::$entities[$entityName]['table'] + )); } $this->getEntityManager()->clear(); } /** + * Return common connection parameters. + * * @return array */ protected static function getCommonConnectionParameters() @@ -238,8 +253,10 @@ protected static function getCommonConnectionParameters() } /** - * @throws UnsupportedPlatformException - * @throws \Doctrine\DBAL\DBALException + * Establish the connection if it is not already done, then returns it. + * + * @throws UnsupportedPlatformException this should not happen + * @throws DBALException this can happen when database or credentials are not set * * @return Connection */ @@ -258,14 +275,19 @@ protected static function getConnection() case 'mysql': break; default: - throw new UnsupportedPlatformException(sprintf('DBAL platform "%s" is not currently supported.', $connection->getDatabasePlatform()->getName())); + throw new UnsupportedPlatformException(sprintf( + 'DBAL platform "%s" is not currently supported.', + $connection->getDatabasePlatform()->getName() + )); } return $connection; } /** - * @throws \Doctrine\DBAL\DBALException + * Return connection parameters. + * + * @throws DBALException this can happen when database or credentials are not set * * @return array */ @@ -298,6 +320,12 @@ protected function getCurrentQueryCount() } /** + * Return the entity manager. + * + * @throws DBALException this can happen when database or credentials are not set + * @throws ORMException this can happen when database or credentials are not set + * @throws UnsupportedPlatformException this should not happen + * * @return EntityManager */ protected function getEntityManager() @@ -311,17 +339,24 @@ protected function getEntityManager() static::getConnection()->getConfiguration()->setSQLLogger($this->sqlLoggerStack); + $realPaths = [realpath(__DIR__.'/Fixtures')]; $config = new Configuration(); $config->setMetadataCacheImpl(new ArrayCache()); $config->setProxyDir(__DIR__.'/Proxies'); $config->setProxyNamespace('CrEOF\Spatial\Tests\Proxies'); - $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver([realpath(__DIR__.'/Fixtures')], true)); + //TODO WARNING: a non-expected parameter is provided. + $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver($realPaths, true)); return EntityManager::create(static::getConnection(), $config); } /** + * Get platform. + * + * @throws DBALException this can happen when database or credentials are not set + * @throws UnsupportedPlatformException this should not happen + * * @return AbstractPlatform */ protected function getPlatform() @@ -330,6 +365,12 @@ protected function getPlatform() } /** + * Return the schema tool. + * + * @throws DBALException this can happen when database or credentials are not set + * @throws ORMException this can happen when database or credentials are not set + * @throws UnsupportedPlatformException this should not happen + * * @return SchemaTool */ protected function getSchemaTool() @@ -342,6 +383,8 @@ protected function getSchemaTool() } /** + * Return the static created entity classes. + * * @return array */ protected function getUsedEntityClasses() @@ -350,14 +393,16 @@ protected function getUsedEntityClasses() } /** - * @throws Exception + * On not successful test. * - * @todo: This needs cleanup + * @param Throwable $throwable the exception + * + * @throws Throwable */ - protected function onNotSuccessfulTest(Exception $e): void + protected function onNotSuccessfulTest(Throwable $throwable): void { - if (!$GLOBALS['opt_use_debug_stack'] || $e instanceof \PHPUnit\Framework\AssertionFailedError) { - throw $e; + if (!$GLOBALS['opt_use_debug_stack'] || $throwable instanceof AssertionFailedError) { + throw $throwable; } if (isset($this->sqlLoggerStack->queries) && count($this->sqlLoggerStack->queries)) { @@ -375,10 +420,15 @@ protected function onNotSuccessfulTest(Exception $e): void return sprintf("'%s'", $param); }, $query['params'] ?: []); - $queries .= sprintf("%2d. SQL: '%s' Params: %s\n", $i, $query['sql'], implode(', ', $params)); + $queries .= sprintf( + "%2d. SQL: '%s' Params: %s\n", + $i, + $query['sql'], + implode(', ', $params) + ); } - $trace = $e->getTrace(); + $trace = $throwable->getTrace(); $traceMsg = ''; foreach ($trace as $part) { @@ -392,17 +442,22 @@ protected function onNotSuccessfulTest(Exception $e): void } } - $message = sprintf("[%s] %s\n\n", get_class($e), $e->getMessage()); + $message = sprintf("[%s] %s\n\n", get_class($throwable), $throwable->getMessage()); $message .= sprintf("With queries:\n%s\nTrace:\n%s", $queries, $traceMsg); - throw new Exception($message, (int) $e->getCode(), $e); + throw new Exception($message, (int) $throwable->getCode(), $throwable); } - throw $e; + throw $throwable; } /** * Create entities used by tests. + * + * @throws DBALException + * @throws ORMException + * @throws UnsupportedPlatformException + * @throws ToolsException */ protected function setUpEntities() { @@ -422,12 +477,17 @@ protected function setUpEntities() /** * Setup DQL functions. + * + * @throws DBALException + * @throws ORMException + * @throws UnsupportedPlatformException */ protected function setUpFunctions() { $configuration = $this->getEntityManager()->getConfiguration(); if ('postgresql' == $this->getPlatform()->getName()) { + // phpcs:disable Generic.Files.LineLength.MaxExceeded $configuration->addCustomStringFunction('geometry', 'CrEOF\Spatial\ORM\Query\AST\Functions\PostgreSql\Geometry'); $configuration->addCustomStringFunction('st_asbinary', 'CrEOF\Spatial\ORM\Query\AST\Functions\PostgreSql\STAsBinary'); $configuration->addCustomStringFunction('st_astext', 'CrEOF\Spatial\ORM\Query\AST\Functions\PostgreSql\STAsText'); @@ -455,9 +515,11 @@ protected function setUpFunctions() $configuration->addCustomStringFunction('st_snaptogrid', 'CrEOF\Spatial\ORM\Query\AST\Functions\PostgreSql\STSnapToGrid'); $configuration->addCustomStringFunction('st_startpoint', 'CrEOF\Spatial\ORM\Query\AST\Functions\PostgreSql\STStartPoint'); $configuration->addCustomStringFunction('st_summary', 'CrEOF\Spatial\ORM\Query\AST\Functions\PostgreSql\STSummary'); + // phpcs:enable } if ('mysql' == $this->getPlatform()->getName()) { + // phpcs:disable Generic.Files.LineLength.MaxExceeded $configuration->addCustomNumericFunction('area', 'CrEOF\Spatial\ORM\Query\AST\Functions\MySql\Area'); $configuration->addCustomStringFunction('asbinary', 'CrEOF\Spatial\ORM\Query\AST\Functions\MySql\AsBinary'); $configuration->addCustomStringFunction('astext', 'CrEOF\Spatial\ORM\Query\AST\Functions\MySql\AsText'); @@ -469,11 +531,15 @@ protected function setUpFunctions() $configuration->addCustomNumericFunction('mbrcontains', 'CrEOF\Spatial\ORM\Query\AST\Functions\MySql\MBRContains'); $configuration->addCustomNumericFunction('mbrdisjoint', 'CrEOF\Spatial\ORM\Query\AST\Functions\MySql\MBRDisjoint'); $configuration->addCustomStringFunction('startpoint', 'CrEOF\Spatial\ORM\Query\AST\Functions\MySql\StartPoint'); + // phpcs:enable } } /** * Add types used by test to DBAL. + * + * @throws DBALException + * @throws UnsupportedPlatformException when platform is not supported */ protected function setUpTypes() { @@ -484,7 +550,8 @@ protected function setUpTypes() $type = Type::getType($typeName); // Since doctrineTypeComments may already be initialized check if added type requires comment - if ($type->requiresSQLCommentHint($this->getPlatform()) && !$this->getPlatform()->isCommentedDoctrineType($type)) { + $platform = $this->getPlatform(); + if ($type->requiresSQLCommentHint($platform) && !$platform->isCommentedDoctrineType($type)) { $this->getPlatform()->markDoctrineTypeCommented(Type::getType($typeName)); } @@ -494,7 +561,9 @@ protected function setUpTypes() } /** - * @param string $platform + * Set the supported platforms. + * + * @param string $platform the platform to support */ protected function supportsPlatform($platform) { @@ -502,7 +571,9 @@ protected function supportsPlatform($platform) } /** - * @param string $entityClass + * Declare the used entities. + * + * @param string $entityClass the entity class */ protected function usesEntity($entityClass) { @@ -514,7 +585,9 @@ protected function usesEntity($entityClass) } /** - * @param string $typeName + * Set the type used. + * + * @param string $typeName the type name */ protected function usesType($typeName) { diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/LineStringTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/LineStringTest.php index 9025812f..81943720 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/LineStringTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/LineStringTest.php @@ -32,9 +32,6 @@ /** * LineString object tests. * - * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT - * * @group php * * @internal From 40e874baf62ba92ae9cadb1d9b4b3a15dd645df3 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sat, 22 Feb 2020 09:38:09 +0100 Subject: [PATCH 08/44] Readme updated --- README.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 0d7fa576..6021092b 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,23 @@ # Doctrine2-Spatial +Doctrine2 multi-platform support for spatial types and functions. +Currently MySQL and PostgreSQL with PostGIS are supported. +Could potentially add support for other platforms if an interest is expressed. + +## Project origins +This useful project was created by Derek J. Lambert. +Alexandre Tranchant forked it from [creof/doctrine2-spatial](https://github.com/creof/doctrine2-spatial) +because project seems to be unactive since 2017. -This project was forked from [creof/doctrine2-spatial](https://github.com/creof/doctrine2-spatial) which seems to be unactive since 2017. +## Developments in progress This fork will upgrade this package to the last doctrine version and the [PHP supported versions](https://www.php.net/supported-versions.php). Feel free to [contribute](./CONTRIBUTING.md)! -[![Build Status](https://travis-ci.org/Alexandre-T/doctrine2-spatial.svg?branch=master)](https://travis-ci.org/creof/doctrine2-spatial) -[![Code Climate](https://codeclimate.com/github/Alexandre-T/doctrine2-spatial/badges/gpa.svg)](https://codeclimate.com/github/creof/doctrine2-spatial) -[![Coverage Status](https://coveralls.io/repos/Alexandre-T/doctrine2-spatial/badge.svg?branch=master&service=github)](https://coveralls.io/github/creof/doctrine2-spatial?branch=master) -[![Downloads](https://img.shields.io/packagist/dm/Alexandre-T/doctrine2-spatial.svg)](https://packagist.org/packages/creof/doctrine2-spatial) - -Doctrine2 multi-platform support for spatial types and functions. -Currently MySQL and PostgreSQL with PostGIS are supported. -Could potentially add support for other platforms if an interest is expressed. +## Current status +[![Build Status](https://travis-ci.org/Alexandre-T/doctrine2-spatial.svg?branch=master)](https://travis-ci.org/Alexandre-T/doctrine2-spatial) +[![Code Climate](https://codeclimate.com/github/Alexandre-T/doctrine2-spatial/badges/gpa.svg)](https://codeclimate.com/github/Alexandre-T/doctrine2-spatial) +[![Coverage Status](https://coveralls.io/repos/Alexandre-T/doctrine2-spatial/badge.svg?branch=master&service=github)](https://coveralls.io/github/Alexandre-T/doctrine2-spatial?branch=master) +[![Downloads](https://img.shields.io/packagist/dm/Alexandre-T/doctrine2-spatial.svg)](https://packagist.org/packages/Alexandre-T/doctrine2-spatial) ### [Documentation](./doc/index.md) From 0ffee7dae97f558d24af5a99ad428bf5dec6101e Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sat, 22 Feb 2020 09:38:26 +0100 Subject: [PATCH 09/44] Code climat test coverage --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.travis.yml b/.travis.yml index 038a52ea..c7e3d32b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,8 @@ env: - ORM=2.5 - ORM=2.6 - ORM=2.7 + global: + - CC_TEST_REPORTER_ID=4ea3c7fddc36fb231ef19a43d186f1752b9195b8035bdcd4795769e9967e0f3c before_script: - composer self-update @@ -21,6 +23,10 @@ before_script: - cp ./tests/travis/composer.orm$ORM.json ./composer.json - composer install --prefer-source - mkdir -p ./build/coverage + # Test coverage for code climate + - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + - chmod +x ./cc-test-reporter + - ./cc-test-reporter before-build script: - ./vendor/bin/phpunit -v -c ./tests/travis/travis.pgsql.xml --coverage-php ./build/coverage/coverage-pgsql-$TRAVIS_PHP_VERSION-$ORM.cov @@ -29,6 +35,8 @@ script: after_script: - ./vendor/bin/phpcov merge --clover ./build/logs/clover.xml ./build/coverage - ./vendor/bin/coveralls -v --exclude-no-stmt + #Push code climate coverage + - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT notifications: webhooks: https://coveralls.io/webhook?repo_token=$COVERALLS_WEBHOOK From 6d59ebb9dd2bdf63db1cc0211b98a6ce4ffebf7a Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sat, 22 Feb 2020 09:47:52 +0100 Subject: [PATCH 10/44] Installing postgresql server and postgis extension --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index c7e3d32b..8839a400 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,12 @@ language: php sudo: false +addons: + postgresql: '9.6' + apt: + packages: + - postgresql-9.6-postgis-2.3 + php: - 7.2 - 7.3 @@ -27,6 +33,7 @@ before_script: - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - chmod +x ./cc-test-reporter - ./cc-test-reporter before-build + - psql -U postgres -c "create extension postgis" script: - ./vendor/bin/phpunit -v -c ./tests/travis/travis.pgsql.xml --coverage-php ./build/coverage/coverage-pgsql-$TRAVIS_PHP_VERSION-$ORM.cov From a585cef5552b445976b3c547bc225956832eb11e Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sat, 22 Feb 2020 14:33:16 +0100 Subject: [PATCH 11/44] Phpunit configuration updated --- .gitignore | 1 + composer.json | 3 +- phpunit.xml.dist | 2 +- .../Tests/DBAL/Types/GeographyTypeTest.php | 133 ++++++++++-------- tests/CrEOF/Spatial/Tests/OrmTestCase.php | 26 ++-- tests/travis/travis.mysql.xml | 2 +- tests/travis/travis.pgsql.xml | 2 +- 7 files changed, 95 insertions(+), 74 deletions(-) diff --git a/.gitignore b/.gitignore index 2b4c2c32..c6db676c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .phpcs-cache .php_cs.cache composer.lock +phpunit.xml vendor/ diff --git a/composer.json b/composer.json index b2a32b37..3406d48c 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,8 @@ ], "phpcs": "phpcs --standard=phpcs.xml.dist -s", "phpcsfixer": "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", - "phpmd": "phpmd bin,config,public,src,tests text ./phpmd.xml.dist" + "phpmd": "phpmd bin,config,public,src,tests text ./phpmd.xml.dist", + "test": "phpunit" }, "autoload": { "psr-0": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 329337fb..5919c893 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,7 +8,7 @@ > - + ./tests/CrEOF/Spatial/Tests diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php index bbc1e73b..0efedc36 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php @@ -24,19 +24,21 @@ namespace CrEOF\Spatial\Tests\DBAL\Types; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geography\LineString; use CrEOF\Spatial\PHP\Types\Geography\Point; use CrEOF\Spatial\PHP\Types\Geography\Polygon; use CrEOF\Spatial\Tests\Fixtures\GeographyEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; use PHPUnit\Framework\Error\Error; /** * Doctrine GeographyType tests. * - * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT - * * @group geography * * @internal @@ -44,85 +46,81 @@ */ class GeographyTypeTest extends OrmTestCase { + /** + * Setup the geography type test. + * + * @throws UnsupportedPlatformException + * @throws DBALException + * @throws ORMException + */ protected function setUp(): void { $this->usesEntity(self::GEOGRAPHY_ENTITY); - parent::setUp(); - } - - public function testBadGeographyValue() - { - $this->expectException(Error::class); - $entity = new GeographyEntity(); - - try { - $entity->setGeography('POINT(0 0)'); - } catch (\TypeError $exception) { - throw new Error( - $exception->getMessage(), - $exception->getCode(), - $exception->getFile(), - $exception->getLine() - ); - } + parent::setUp(); } + /** + * Test to store and retrieve a geography composed by a linestring. + * + * @throws DBALException + * @throws ORMException + * @throws UnsupportedPlatformException + * @throws MappingException + * @throws OptimisticLockException + */ public function testLineStringGeography() { $entity = new GeographyEntity(); - $entity->setGeography(new LineString( - [ - new Point(0, 0), - new Point(1, 1), - ]) - ); - $this->getEntityManager()->persist($entity); - $this->getEntityManager()->flush(); - - $id = $entity->getId(); - - $this->getEntityManager()->clear(); - - $queryEntity = $this->getEntityManager()->getRepository(self::GEOGRAPHY_ENTITY)->find($id); - - $this->assertEquals($entity, $queryEntity); + $entity->setGeography(new LineString([ + new Point(0, 0), + new Point(1, 1), + ])); + $this->storeAndRetrieve($entity); } + /** + * Test to store and retrieve a null geography. + * + * @throws DBALException + * @throws MappingException + * @throws ORMException + * @throws OptimisticLockException + * @throws UnsupportedPlatformException + */ public function testNullGeography() { $entity = new GeographyEntity(); - - $this->getEntityManager()->persist($entity); - $this->getEntityManager()->flush(); - - $id = $entity->getId(); - - $this->getEntityManager()->clear(); - - $queryEntity = $this->getEntityManager()->getRepository(self::GEOGRAPHY_ENTITY)->find($id); - - $this->assertEquals($entity, $queryEntity); + $this->storeAndRetrieve($entity); } + /** + * Test to store and retrieve a geography composed by a single point. + * + * @throws DBALException + * @throws MappingException + * @throws ORMException + * @throws OptimisticLockException + * @throws UnsupportedPlatformException + */ public function testPointGeography() { $entity = new GeographyEntity(); $entity->setGeography(new Point(1, 1)); - $this->getEntityManager()->persist($entity); - $this->getEntityManager()->flush(); - - $id = $entity->getId(); - - $this->getEntityManager()->clear(); - - $queryEntity = $this->getEntityManager()->getRepository(self::GEOGRAPHY_ENTITY)->find($id); - - $this->assertEquals($entity, $queryEntity); + $this->storeAndRetrieve($entity); } + /** + * Test to store and retrieve a geography composed by a polygon. + * + * @throws DBALException + * @throws MappingException + * @throws ORMException + * @throws OptimisticLockException + * @throws UnsupportedPlatformException + */ public function testPolygonGeography() { $entity = new GeographyEntity(); @@ -138,6 +136,23 @@ public function testPolygonGeography() ]; $entity->setGeography(new Polygon($rings)); + $this->storeAndRetrieve($entity); + } + + /** + * Store and retrieve geography entity in database. + * Then assert data are equals, not same. + * + * @param GeographyEntity $entity Entity to test + * + * @throws DBALException + * @throws MappingException + * @throws ORMException + * @throws OptimisticLockException + * @throws UnsupportedPlatformException + */ + private function storeAndRetrieve(GeographyEntity $entity) + { $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); @@ -147,6 +162,6 @@ public function testPolygonGeography() $queryEntity = $this->getEntityManager()->getRepository(self::GEOGRAPHY_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + self::assertEquals($entity, $queryEntity); } } diff --git a/tests/CrEOF/Spatial/Tests/OrmTestCase.php b/tests/CrEOF/Spatial/Tests/OrmTestCase.php index 88a23a13..2253a6dd 100644 --- a/tests/CrEOF/Spatial/Tests/OrmTestCase.php +++ b/tests/CrEOF/Spatial/Tests/OrmTestCase.php @@ -26,6 +26,7 @@ use CrEOF\Spatial\Exception\UnsupportedPlatformException; use Doctrine\Common\Cache\ArrayCache; +use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\Connection; use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DriverManager; @@ -47,6 +48,7 @@ */ abstract class OrmTestCase extends TestCase { + //Fixtures and entities public const GEO_LINESTRING_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\GeoLineStringEntity'; public const GEO_POINT_SRID_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\GeoPointSridEntity'; public const GEO_POLYGON_ENTITY = 'CrEOF\Spatial\Tests\Fixtures\GeoPolygonEntity'; @@ -167,7 +169,7 @@ abstract class OrmTestCase extends TestCase /** * Setup connection before class creation. * - * @throws UnsupportedPlatformException this should not happen + * @throws UnsupportedPlatformException this happen when platform is not mysql or postgresql * @throws DBALException this can happen when database or credentials are not set */ public static function setUpBeforeClass(): void @@ -180,6 +182,7 @@ public static function setUpBeforeClass(): void * * @throws UnsupportedPlatformException this should not happen * @throws DBALException this can happen when database or credentials are not set + * @throws ORMException ORM Exception */ protected function setUp(): void { @@ -210,6 +213,8 @@ protected function setUp(): void * * @throws UnsupportedPlatformException this should not happen * @throws DBALException this can happen when database or credentials are not set + * @throws ORMException ORM Exception + * @throws MappingException Mapping exception when clear fails */ protected function tearDown(): void { @@ -256,7 +261,6 @@ protected static function getCommonConnectionParameters() * Establish the connection if it is not already done, then returns it. * * @throws UnsupportedPlatformException this should not happen - * @throws DBALException this can happen when database or credentials are not set * * @return Connection */ @@ -397,7 +401,7 @@ protected function getUsedEntityClasses() * * @param Throwable $throwable the exception * - * @throws Throwable + * @throws Exception The exception provided by parameter. */ protected function onNotSuccessfulTest(Throwable $throwable): void { @@ -454,10 +458,10 @@ protected function onNotSuccessfulTest(Throwable $throwable): void /** * Create entities used by tests. * - * @throws DBALException - * @throws ORMException - * @throws UnsupportedPlatformException - * @throws ToolsException + * @throws DBALException when connection is not successful + * @throws ORMException when + * @throws UnsupportedPlatformException when platform is not supported + * @throws ToolsException when schema cannot be created */ protected function setUpEntities() { @@ -478,9 +482,9 @@ protected function setUpEntities() /** * Setup DQL functions. * - * @throws DBALException - * @throws ORMException - * @throws UnsupportedPlatformException + * @throws DBALException when connection is not successful + * @throws ORMException when + * @throws UnsupportedPlatformException when platform is not supported */ protected function setUpFunctions() { @@ -538,7 +542,7 @@ protected function setUpFunctions() /** * Add types used by test to DBAL. * - * @throws DBALException + * @throws DBALException when credential or connection failed * @throws UnsupportedPlatformException when platform is not supported */ protected function setUpTypes() diff --git a/tests/travis/travis.mysql.xml b/tests/travis/travis.mysql.xml index 03cbcfc5..e074253e 100644 --- a/tests/travis/travis.mysql.xml +++ b/tests/travis/travis.mysql.xml @@ -9,7 +9,7 @@ > - + ../CrEOF/Spatial/Tests diff --git a/tests/travis/travis.pgsql.xml b/tests/travis/travis.pgsql.xml index c1d326aa..4d10be68 100644 --- a/tests/travis/travis.pgsql.xml +++ b/tests/travis/travis.pgsql.xml @@ -9,7 +9,7 @@ > - + ../CrEOF/Spatial/Tests From 673915921b4c3eb1041b94561fd381ddf97a044c Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sat, 22 Feb 2020 14:50:48 +0100 Subject: [PATCH 12/44] Comments improved --- tests/CrEOF/Spatial/Tests/OrmMockTestCase.php | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/tests/CrEOF/Spatial/Tests/OrmMockTestCase.php b/tests/CrEOF/Spatial/Tests/OrmMockTestCase.php index 1a5a8628..85ae3e28 100644 --- a/tests/CrEOF/Spatial/Tests/OrmMockTestCase.php +++ b/tests/CrEOF/Spatial/Tests/OrmMockTestCase.php @@ -26,8 +26,13 @@ use Doctrine\Common\Cache\ArrayCache; use Doctrine\DBAL\Connection; +use Doctrine\DBAL\DBALException; +use Doctrine\DBAL\Driver; use Doctrine\ORM\Configuration; use Doctrine\ORM\EntityManager; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\ORMException; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -35,15 +40,32 @@ */ abstract class OrmMockTestCase extends TestCase { + /** + * @var EntityManagerInterface + */ protected $mockEntityManager; + /** + * Setup the mocked entity manager. + * + * @throws DBALException when connection is not successful + * @throws ORMException when + */ protected function setUp(): void { $this->mockEntityManager = $this->getMockEntityManager(); } + /** + * Return the mocked connection. + * + * @return Connection + * + * @throws DBALException This should not happen because connection is mocked + */ protected function getMockConnection() { + /** @var Driver|MockObject $driver */ $driver = $this->getMockBuilder('Doctrine\DBAL\Driver\PDOSqlite\Driver') ->setMethods(['getDatabasePlatform']) ->getMock() @@ -64,7 +86,12 @@ protected function getMockConnection() } /** - * @return EntityManager + * Get the mocked entity manager. + * + * @return EntityManagerInterface a mocked entity manager + * + * @throws DBALException When connection is not successfule + * @throws ORMException when */ protected function getMockEntityManager() { @@ -72,12 +99,14 @@ protected function getMockEntityManager() return $this->mockEntityManager; } + $path = [realpath(__DIR__.'/Fixtures')]; $config = new Configuration(); $config->setMetadataCacheImpl(new ArrayCache()); $config->setProxyDir(__DIR__.'/Proxies'); $config->setProxyNamespace('CrEOF\Spatial\Tests\Proxies'); - $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver([realpath(__DIR__.'/Fixtures')], true)); + //TODO Warning wrong paramater is provided + $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver($path, true)); return EntityManager::create($this->getMockConnection(), $config); } From 888a0f1d54a041239d8d2767b33fb41167456b6e Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sat, 22 Feb 2020 15:04:47 +0100 Subject: [PATCH 13/44] Converts methods With PHP to camel case (Php) --- .../DBAL/Platform/AbstractPlatform.php | 37 ++++++++++++++----- .../DBAL/Platform/PlatformInterface.php | 4 +- .../Spatial/DBAL/Platform/PostgreSql.php | 4 +- .../DBAL/Types/AbstractSpatialType.php | 4 +- 4 files changed, 33 insertions(+), 16 deletions(-) diff --git a/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php b/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php index e52ac1a9..249549ee 100644 --- a/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php +++ b/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php @@ -34,17 +34,20 @@ /** * Abstract spatial platform. * - * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT */ abstract class AbstractPlatform implements PlatformInterface { /** - * @param string $sqlExpr + * Convert binary data to a php value. + * + * @param AbstractSpatialType $type The abstract spatial type + * @param string $sqlExpr the SQL expression * * @return GeometryInterface + * + * @throws InvalidValueException when the provided type is not supported */ - public function convertBinaryToPHPValue(AbstractSpatialType $type, $sqlExpr) + public function convertBinaryToPhpValue(AbstractSpatialType $type, $sqlExpr) { $parser = new BinaryParser($sqlExpr); @@ -52,11 +55,16 @@ public function convertBinaryToPHPValue(AbstractSpatialType $type, $sqlExpr) } /** - * @param string $sqlExpr + * Convert string data to a php value. + * + * @param AbstractSpatialType $type The abstract spatial type + * @param string $sqlExpr the SQL expression * * @return GeometryInterface + * + * @throws InvalidValueException when the provided type is not supported */ - public function convertStringToPHPValue(AbstractSpatialType $type, $sqlExpr) + public function convertStringToPhpValue(AbstractSpatialType $type, $sqlExpr) { $parser = new StringParser($sqlExpr); @@ -64,16 +72,26 @@ public function convertStringToPHPValue(AbstractSpatialType $type, $sqlExpr) } /** + * Convert binary data to a php value. + * + * @param AbstractSpatialType $type The spatial type + * @param GeometryInterface $value The geometry object + * * @return string + * + * @throws InvalidValueException when the provided type is not supported */ public function convertToDatabaseValue(AbstractSpatialType $type, GeometryInterface $value) { + //TODO removed the unused variable $type return sprintf('%s(%s)', mb_strtoupper($value->getType()), $value); } /** * Get an array of database types that map to this Doctrine type. * + * @param AbstractSpatialType $type the spatial type + * * @return string[] */ public function getMappedDatabaseTypes(AbstractSpatialType $type) @@ -90,9 +108,10 @@ public function getMappedDatabaseTypes(AbstractSpatialType $type) /** * Create spatial object from parsed value. * - * @param array $value + * @param AbstractSpatialType $type The type spatial type + * @param array $value The value of the spatial object * - * @throws \CrEOF\Spatial\Exception\InvalidValueException + * @throws InvalidValueException when the provided type is not supported * * @return GeometryInterface */ @@ -104,9 +123,7 @@ private function newObjectFromValue(AbstractSpatialType $type, $value) $constName = sprintf('CrEOF\Spatial\PHP\Types\Geometry\GeometryInterface::%s', $typeName); if (!defined($constName)) { - // @codeCoverageIgnoreStart throw new InvalidValueException(sprintf('Unsupported %s type "%s".', $typeFamily, $typeName)); - // @codeCoverageIgnoreEnd } $class = sprintf('CrEOF\Spatial\PHP\Types\%s\%s', $typeFamily, constant($constName)); diff --git a/lib/CrEOF/Spatial/DBAL/Platform/PlatformInterface.php b/lib/CrEOF/Spatial/DBAL/Platform/PlatformInterface.php index 943143f3..f4dec226 100644 --- a/lib/CrEOF/Spatial/DBAL/Platform/PlatformInterface.php +++ b/lib/CrEOF/Spatial/DBAL/Platform/PlatformInterface.php @@ -40,14 +40,14 @@ interface PlatformInterface * * @return GeometryInterface */ - public function convertBinaryToPHPValue(AbstractSpatialType $type, $sqlExpr); + public function convertBinaryToPhpValue(AbstractSpatialType $type, $sqlExpr); /** * @param string $sqlExpr * * @return GeometryInterface */ - public function convertStringToPHPValue(AbstractSpatialType $type, $sqlExpr); + public function convertStringToPhpValue(AbstractSpatialType $type, $sqlExpr); /** * @return string diff --git a/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php b/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php index 007f2ab1..0df38f09 100644 --- a/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php +++ b/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php @@ -46,7 +46,7 @@ class PostgreSql extends AbstractPlatform * * @return GeometryInterface */ - public function convertBinaryToPHPValue(AbstractSpatialType $type, $sqlExpr) + public function convertBinaryToPhpValue(AbstractSpatialType $type, $sqlExpr) { if (!is_resource($sqlExpr)) { throw new InvalidValueException(sprintf('Invalid resource value "%s"', $sqlExpr)); @@ -54,7 +54,7 @@ public function convertBinaryToPHPValue(AbstractSpatialType $type, $sqlExpr) $sqlExpr = stream_get_contents($sqlExpr); - return parent::convertBinaryToPHPValue($type, $sqlExpr); + return parent::convertBinaryToPhpValue($type, $sqlExpr); } /** diff --git a/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php b/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php index 1c3aa0fb..ad96e873 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php @@ -100,10 +100,10 @@ public function convertToPHPValue($value, AbstractPlatform $platform) } if (!is_resource($value) && ctype_alpha($value[0])) { - return $this->getSpatialPlatform($platform)->convertStringToPHPValue($this, $value); + return $this->getSpatialPlatform($platform)->convertStringToPhpValue($this, $value); } - return $this->getSpatialPlatform($platform)->convertBinaryToPHPValue($this, $value); + return $this->getSpatialPlatform($platform)->convertBinaryToPhpValue($this, $value); } /** From 96a383c1b3f6e35f85b35fc5141d29dabb579f01 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sat, 22 Feb 2020 15:07:41 +0100 Subject: [PATCH 14/44] Fixing syntax --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8839a400..b083fdd1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,8 +20,7 @@ env: - ORM=2.5 - ORM=2.6 - ORM=2.7 - global: - - CC_TEST_REPORTER_ID=4ea3c7fddc36fb231ef19a43d186f1752b9195b8035bdcd4795769e9967e0f3c + - CC_TEST_REPORTER_ID=4ea3c7fddc36fb231ef19a43d186f1752b9195b8035bdcd4795769e9967e0f3c before_script: - composer self-update From 163894e06873312c3c11aa310506ef361667bccc Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sat, 22 Feb 2020 15:15:21 +0100 Subject: [PATCH 15/44] Only stable upcoming releases are tested --- .travis.yml | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index b083fdd1..43aeac84 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,11 +15,10 @@ php: - hhvm env: - - ORM=2.3 - - ORM=2.4 - - ORM=2.5 - - ORM=2.6 + # Only stable and upcoming releases are tested https://www.doctrine-project.org/projects/orm.html - ORM=2.7 + - ORM=2.8 + - ORM=3.0 - CC_TEST_REPORTER_ID=4ea3c7fddc36fb231ef19a43d186f1752b9195b8035bdcd4795769e9967e0f3c before_script: @@ -32,7 +31,6 @@ before_script: - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - chmod +x ./cc-test-reporter - ./cc-test-reporter before-build - - psql -U postgres -c "create extension postgis" script: - ./vendor/bin/phpunit -v -c ./tests/travis/travis.pgsql.xml --coverage-php ./build/coverage/coverage-pgsql-$TRAVIS_PHP_VERSION-$ORM.cov @@ -50,10 +48,6 @@ notifications: matrix: allow_failures: - php: hhvm # driver for PostgreSQL currently unsupported by HHVM, requires 3rd party dependency -# exclude: -# - php: 7.4 -# env: ORM=2.3 # ORM <=2.6.4 are not compatible with PHP >=7.4 -# - php: 7.4 -# env: ORM=2.4 # ORM <=2.6.4 are not compatible with PHP >=7.4 -# - php: 7.4 -# env: ORM=2.5 # ORM <=2.6.4 are not compatible with PHP >=7.4 + # Upcoming releases can fail + - env: ORM=2.8 + - env: ORM=3.0 From bab89865cb444dc5a7b5582c608929aae51acf4d Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sat, 22 Feb 2020 15:22:59 +0100 Subject: [PATCH 16/44] Only stable upcoming releases are tested --- composer.json | 2 +- tests/travis/composer.orm2.4.json | 46 ------------------- tests/travis/composer.orm2.6.json | 46 ------------------- ...poser.orm2.3.json => composer.orm2.8.json} | 2 +- ...poser.orm2.5.json => composer.orm3.0.json} | 2 +- 5 files changed, 3 insertions(+), 95 deletions(-) delete mode 100644 tests/travis/composer.orm2.4.json delete mode 100644 tests/travis/composer.orm2.6.json rename tests/travis/{composer.orm2.3.json => composer.orm2.8.json} (97%) rename tests/travis/{composer.orm2.5.json => composer.orm3.0.json} (97%) diff --git a/composer.json b/composer.json index 3406d48c..b44252fc 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "creof/geo-parser": "~2.0", "creof/wkt-parser": "~2.0", "creof/wkb-parser": "~2.0", - "doctrine/orm": ">2.7" + "doctrine/orm": "^2.7.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.16", diff --git a/tests/travis/composer.orm2.4.json b/tests/travis/composer.orm2.4.json deleted file mode 100644 index 8fc0956d..00000000 --- a/tests/travis/composer.orm2.4.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "alexandret/doctrine2-spatial", - "type": "library", - "description": "Doctrine2 multi-platform support for spatial types and functions", - "keywords": ["orm", "dbal", "database", "postgresql", "mysql", "opengis", "postgis", "gis", "spatial", "geometry", "geography"], - "authors": [ - { - "name": "Derek Lambert", - "email": "dlambert@dereklambert.com" - }, - { - "name": "Alexandre Tranchant", - "email": "alexandre.tranchant@gmail.com" - } - ], - "license": "MIT", - "require": { - "doctrine/orm": "<2.5", - "creof/geo-parser": "~2.0", - "creof/wkt-parser": "~2.0", - "creof/wkb-parser": "~2.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.16", - "phpmd/phpmd": "@stable", - "phpunit/phpunit": "<5.0", - "phpunit/phpcov": "*", - "satooshi/php-coveralls": "~1.0", - "squizlabs/php_codesniffer": "3.*" - }, - "scripts": { - "quality": [ - "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", - "phpcs --standard=phpcs.xml.dist -s", - "phpmd bin,config,public,src,tests text ./phpmd.xml.dist" - ], - "phpcs": "phpcs --standard=phpcs.xml.dist -s", - "phpcsfixer": "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", - "phpmd": "phpmd bin,config,public,src,tests text ./phpmd.xml.dist" - }, - "autoload": { - "psr-0": { - "CrEOF\\Spatial": "lib/" - } - } -} diff --git a/tests/travis/composer.orm2.6.json b/tests/travis/composer.orm2.6.json deleted file mode 100644 index 3c24cebd..00000000 --- a/tests/travis/composer.orm2.6.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "alexandret/doctrine2-spatial", - "type": "library", - "description": "Doctrine2 multi-platform support for spatial types and functions", - "keywords": ["orm", "dbal", "database", "postgresql", "mysql", "opengis", "postgis", "gis", "spatial", "geometry", "geography"], - "authors": [ - { - "name": "Derek Lambert", - "email": "dlambert@dereklambert.com" - }, - { - "name": "Alexandre Tranchant", - "email": "alexandre.tranchant@gmail.com" - } - ], - "license": "MIT", - "require": { - "doctrine/orm": "<2.7", - "creof/geo-parser": "~2.0", - "creof/wkt-parser": "~2.0", - "creof/wkb-parser": "~2.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.16", - "phpmd/phpmd": "@stable", - "phpunit/phpunit": "*", - "phpunit/phpcov": "*", - "php-coveralls/php-coveralls": "~1.0", - "squizlabs/php_codesniffer": "3.*" - }, - "scripts": { - "quality": [ - "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", - "phpcs --standard=phpcs.xml.dist -s", - "phpmd bin,config,public,src,tests text ./phpmd.xml.dist" - ], - "phpcs": "phpcs --standard=phpcs.xml.dist -s", - "phpcsfixer": "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", - "phpmd": "phpmd bin,config,public,src,tests text ./phpmd.xml.dist" - }, - "autoload": { - "psr-0": { - "CrEOF\\Spatial": "lib/" - } - } -} diff --git a/tests/travis/composer.orm2.3.json b/tests/travis/composer.orm2.8.json similarity index 97% rename from tests/travis/composer.orm2.3.json rename to tests/travis/composer.orm2.8.json index acd35272..01580889 100644 --- a/tests/travis/composer.orm2.3.json +++ b/tests/travis/composer.orm2.8.json @@ -15,7 +15,7 @@ ], "license": "MIT", "require": { - "doctrine/orm": "<2.4", + "doctrine/orm": "2.8.x-dev", "creof/geo-parser": "~2.0", "creof/wkt-parser": "~2.0", "creof/wkb-parser": "~2.0" diff --git a/tests/travis/composer.orm2.5.json b/tests/travis/composer.orm3.0.json similarity index 97% rename from tests/travis/composer.orm2.5.json rename to tests/travis/composer.orm3.0.json index 8468c0fc..16eb2616 100644 --- a/tests/travis/composer.orm2.5.json +++ b/tests/travis/composer.orm3.0.json @@ -15,7 +15,7 @@ ], "license": "MIT", "require": { - "doctrine/orm": "<2.5", + "doctrine/orm": "3.0.x-dev", "creof/geo-parser": "~2.0", "creof/wkt-parser": "~2.0", "creof/wkb-parser": "~2.0" From 669fe34e4ae59eaed6ac616d1d4a31aaaa88cf5e Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sat, 22 Feb 2020 15:30:36 +0100 Subject: [PATCH 17/44] Fixing phpunit.xml.dist --- phpunit.xml.dist | 6 +++--- tests/travis/travis.mysql.xml | 7 +++---- tests/travis/travis.pgsql.xml | 9 ++++----- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 5919c893..69976193 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,10 +1,10 @@ - diff --git a/tests/travis/travis.mysql.xml b/tests/travis/travis.mysql.xml index e074253e..35cba0e5 100644 --- a/tests/travis/travis.mysql.xml +++ b/tests/travis/travis.mysql.xml @@ -1,11 +1,10 @@ - diff --git a/tests/travis/travis.pgsql.xml b/tests/travis/travis.pgsql.xml index 4d10be68..ebbca313 100644 --- a/tests/travis/travis.pgsql.xml +++ b/tests/travis/travis.pgsql.xml @@ -1,12 +1,11 @@ - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/9.0/phpunit.xsd" +> From 8befc2154fe8533fabdbce855075978bdc6605cb Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sat, 22 Feb 2020 15:39:56 +0100 Subject: [PATCH 18/44] Try postgis2.5 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 43aeac84..caa78381 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ addons: postgresql: '9.6' apt: packages: - - postgresql-9.6-postgis-2.3 + - postgresql-9.6-postgis-2.5 php: - 7.2 From 0f7a3742cb53f65585823d6cf9f3781438587885 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sat, 22 Feb 2020 15:41:28 +0100 Subject: [PATCH 19/44] Try postgis2.5 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index caa78381..53fd75a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,9 +19,9 @@ env: - ORM=2.7 - ORM=2.8 - ORM=3.0 - - CC_TEST_REPORTER_ID=4ea3c7fddc36fb231ef19a43d186f1752b9195b8035bdcd4795769e9967e0f3c before_script: + - export CC_TEST_REPORTER_ID=4ea3c7fddc36fb231ef19a43d186f1752b9195b8035bdcd4795769e9967e0f3c - composer self-update - cp ./composer.json ./tests/travis/composer.orm2.7.json - cp ./tests/travis/composer.orm$ORM.json ./composer.json From c94707082c750c31c430f31e9f8a99999a56181e Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sat, 22 Feb 2020 15:48:07 +0100 Subject: [PATCH 20/44] Trying mysql --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 53fd75a1..85a387d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,9 @@ language: php sudo: false +services: + - mysql + addons: postgresql: '9.6' apt: From feb4af3f9be675fd6916ae539646acae04cd8076 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sat, 22 Feb 2020 16:02:25 +0100 Subject: [PATCH 21/44] Fixing composer to test doctrine 3.0 version --- tests/travis/composer.orm3.0.json | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/travis/composer.orm3.0.json b/tests/travis/composer.orm3.0.json index 16eb2616..e43c48fc 100644 --- a/tests/travis/composer.orm3.0.json +++ b/tests/travis/composer.orm3.0.json @@ -14,6 +14,7 @@ } ], "license": "MIT", + "minimum-stability": "dev", "require": { "doctrine/orm": "3.0.x-dev", "creof/geo-parser": "~2.0", From d9dfd0d57624dd0075799a88cd3cc7245498d050 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sat, 22 Feb 2020 16:49:57 +0100 Subject: [PATCH 22/44] Converting methods to camel case --- .../DBAL/Platform/AbstractPlatform.php | 4 +-- lib/CrEOF/Spatial/DBAL/Platform/MySql.php | 6 ++-- .../DBAL/Platform/PlatformInterface.php | 6 ++-- .../Spatial/DBAL/Platform/PostgreSql.php | 30 ++++++++++++++----- .../DBAL/Types/AbstractSpatialType.php | 12 ++++---- .../Spatial/Tests/ORM/Query/WrappingTest.php | 4 +-- 6 files changed, 38 insertions(+), 24 deletions(-) diff --git a/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php b/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php index 249549ee..c7c751c4 100644 --- a/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php +++ b/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php @@ -78,12 +78,10 @@ public function convertStringToPhpValue(AbstractSpatialType $type, $sqlExpr) * @param GeometryInterface $value The geometry object * * @return string - * - * @throws InvalidValueException when the provided type is not supported */ public function convertToDatabaseValue(AbstractSpatialType $type, GeometryInterface $value) { - //TODO removed the unused variable $type + //TODO the unused variable $type is used by overriding method return sprintf('%s(%s)', mb_strtoupper($value->getType()), $value); } diff --git a/lib/CrEOF/Spatial/DBAL/Platform/MySql.php b/lib/CrEOF/Spatial/DBAL/Platform/MySql.php index 8caabaa1..3f6119b4 100644 --- a/lib/CrEOF/Spatial/DBAL/Platform/MySql.php +++ b/lib/CrEOF/Spatial/DBAL/Platform/MySql.php @@ -40,7 +40,7 @@ class MySql extends AbstractPlatform * * @return string */ - public function convertToDatabaseValueSQL(AbstractSpatialType $type, $sqlExpr) + public function convertToDatabaseValueSql(AbstractSpatialType $type, $sqlExpr) { return sprintf('GeomFromText(%s)', $sqlExpr); } @@ -50,7 +50,7 @@ public function convertToDatabaseValueSQL(AbstractSpatialType $type, $sqlExpr) * * @return string */ - public function convertToPHPValueSQL(AbstractSpatialType $type, $sqlExpr) + public function convertToPhpValueSql(AbstractSpatialType $type, $sqlExpr) { return sprintf('AsBinary(%s)', $sqlExpr); } @@ -60,7 +60,7 @@ public function convertToPHPValueSQL(AbstractSpatialType $type, $sqlExpr) * * @return string */ - public function getSQLDeclaration(array $fieldDeclaration) + public function getSqlDeclaration(array $fieldDeclaration) { if (GeographyInterface::GEOGRAPHY === $fieldDeclaration['type']->getSQLType()) { return 'GEOMETRY'; diff --git a/lib/CrEOF/Spatial/DBAL/Platform/PlatformInterface.php b/lib/CrEOF/Spatial/DBAL/Platform/PlatformInterface.php index f4dec226..1c45c5ba 100644 --- a/lib/CrEOF/Spatial/DBAL/Platform/PlatformInterface.php +++ b/lib/CrEOF/Spatial/DBAL/Platform/PlatformInterface.php @@ -59,14 +59,14 @@ public function convertToDatabaseValue(AbstractSpatialType $type, GeometryInterf * * @return string */ - public function convertToDatabaseValueSQL(AbstractSpatialType $type, $sqlExpr); + public function convertToDatabaseValueSql(AbstractSpatialType $type, $sqlExpr); /** * @param string $sqlExpr * * @return string */ - public function convertToPHPValueSQL(AbstractSpatialType $type, $sqlExpr); + public function convertToPhpValueSql(AbstractSpatialType $type, $sqlExpr); /** * @return string[] @@ -78,5 +78,5 @@ public function getMappedDatabaseTypes(AbstractSpatialType $type); * * @return string */ - public function getSQLDeclaration(array $fieldDeclaration); + public function getSqlDeclaration(array $fieldDeclaration); } diff --git a/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php b/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php index 0df38f09..7b876590 100644 --- a/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php +++ b/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php @@ -40,11 +40,14 @@ class PostgreSql extends AbstractPlatform public const DEFAULT_SRID = 4326; /** - * @param string $sqlExpr + * Convert Binary to php value. * - * @throws InvalidValueException + * @param AbstractSpatialType $type Spatial type + * @param string $sqlExpr Sql expression * * @return GeometryInterface + * + * @throws InvalidValueException when SQL expression is not a resource */ public function convertBinaryToPhpValue(AbstractSpatialType $type, $sqlExpr) { @@ -58,6 +61,11 @@ public function convertBinaryToPhpValue(AbstractSpatialType $type, $sqlExpr) } /** + * Convert to database value. + * + * @param AbstractSpatialType $type The spatial type + * @param GeometryInterface $value The geometry interface + * * @return string */ public function convertToDatabaseValue(AbstractSpatialType $type, GeometryInterface $value) @@ -76,11 +84,14 @@ public function convertToDatabaseValue(AbstractSpatialType $type, GeometryInterf } /** - * @param string $sqlExpr + * Convert to database value to SQL. + * + * @param AbstractSpatialType $type The spatial type + * @param string $sqlExpr The SQL expression * * @return string */ - public function convertToDatabaseValueSQL(AbstractSpatialType $type, $sqlExpr) + public function convertToDatabaseValueSql(AbstractSpatialType $type, $sqlExpr) { if ($type instanceof GeographyType) { return sprintf('ST_GeographyFromText(%s)', $sqlExpr); @@ -90,11 +101,14 @@ public function convertToDatabaseValueSQL(AbstractSpatialType $type, $sqlExpr) } /** - * @param string $sqlExpr + * Convert to php value to SQL. + * + * @param AbstractSpatialType $type The spatial type + * @param string $sqlExpr The SQL expression * * @return string */ - public function convertToPHPValueSQL(AbstractSpatialType $type, $sqlExpr) + public function convertToPhpValueSql(AbstractSpatialType $type, $sqlExpr) { if ($type instanceof GeographyType) { return sprintf('ST_AsEWKT(%s)', $sqlExpr); @@ -106,9 +120,11 @@ public function convertToPHPValueSQL(AbstractSpatialType $type, $sqlExpr) /** * Gets the SQL declaration snippet for a field of this type. * + * @param array $fieldDeclaration array SHALL contains 'type' as key + * * @return string */ - public function getSQLDeclaration(array $fieldDeclaration) + public function getSqlDeclaration(array $fieldDeclaration) { $typeFamily = $fieldDeclaration['type']->getTypeFamily(); $sqlType = $fieldDeclaration['type']->getSQLType(); diff --git a/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php b/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php index ad96e873..acda7439 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php @@ -81,9 +81,9 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform) * * @return string */ - public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform) + public function convertToDatabaseValueSql($sqlExpr, AbstractPlatform $platform) { - return $this->getSpatialPlatform($platform)->convertToDatabaseValueSQL($this, $sqlExpr); + return $this->getSpatialPlatform($platform)->convertToDatabaseValueSql($this, $sqlExpr); } /** @@ -114,9 +114,9 @@ public function convertToPHPValue($value, AbstractPlatform $platform) * * @return string */ - public function convertToPHPValueSQL($sqlExpr, $platform) + public function convertToPhpValueSql($sqlExpr, $platform) { - return $this->getSpatialPlatform($platform)->convertToPHPValueSQL($this, $sqlExpr); + return $this->getSpatialPlatform($platform)->convertToPhpValueSql($this, $sqlExpr); } /** @@ -144,9 +144,9 @@ public function getName() * * @return string */ - public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) + public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform) { - return $this->getSpatialPlatform($platform)->getSQLDeclaration($fieldDeclaration); + return $this->getSpatialPlatform($platform)->getSqlDeclaration($fieldDeclaration); } /** diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php index d746e43d..42430afc 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php @@ -97,7 +97,7 @@ public function testTypeWrappingSelect() $parameter = '?'; if (Version::compare('2.5') <= 0) { - $parameter = Type::getType('point')->convertToDatabaseValueSQL($parameter, $this->getPlatform()); + $parameter = Type::getType('point')->convertToDatabaseValueSql($parameter, $this->getPlatform()); } $regex = preg_quote(sprintf('/.polygon, %s)/', $parameter)); @@ -126,7 +126,7 @@ public function testTypeWrappingWhere() $parameter = '?'; if (Version::compare('2.5') <= 0) { - $parameter = Type::getType('point')->convertToDatabaseValueSQL($parameter, $this->getPlatform()); + $parameter = Type::getType('point')->convertToDatabaseValueSql($parameter, $this->getPlatform()); } $regex = preg_quote(sprintf('/geometry = %s/', $parameter)); From cec951d8f02bc510c3788c1ec9e9500c616244d0 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sat, 22 Feb 2020 16:55:54 +0100 Subject: [PATCH 23/44] Comments improved --- .../DBAL/Platform/AbstractPlatform.php | 15 ++- lib/CrEOF/Spatial/DBAL/Platform/MySql.php | 15 ++- .../DBAL/Platform/PlatformInterface.php | 34 ++++-- .../Spatial/DBAL/Platform/PostgreSql.php | 7 +- .../DBAL/Types/AbstractSpatialType.php | 78 ++++++++++--- .../Functions/AbstractSpatialDQLFunction.php | 32 +++++- .../ORM/Query/AST/Functions/MySql/Area.php | 21 ++++ .../Query/AST/Functions/MySql/AsBinary.php | 21 ++++ .../ORM/Query/AST/Functions/MySql/AsText.php | 21 ++++ .../ORM/Query/AST/Functions/MySql/Buffer.php | 21 ++++ .../Query/AST/Functions/MySql/Centroid.php | 21 ++++ .../Query/AST/Functions/MySql/Contains.php | 21 ++++ .../ORM/Query/AST/Functions/MySql/Crosses.php | 21 ++++ .../Query/AST/Functions/MySql/Dimension.php | 21 ++++ .../Query/AST/Functions/MySql/Disjoint.php | 21 ++++ .../Query/AST/Functions/MySql/Distance.php | 23 ++++ .../Functions/MySql/DistanceFromMultyLine.php | 21 ++++ .../Query/AST/Functions/MySql/EndPoint.php | 21 ++++ .../Query/AST/Functions/MySql/Envelope.php | 21 ++++ .../ORM/Query/AST/Functions/MySql/Equals.php | 21 ++++ .../AST/Functions/MySql/ExteriorRing.php | 21 ++++ .../ORM/Query/AST/Functions/MySql/GLength.php | 21 ++++ .../Query/AST/Functions/MySql/GeodistPt.php | 21 ++++ .../AST/Functions/MySql/GeomFromText.php | 21 ++++ .../AST/Functions/MySql/GeometryType.php | 21 ++++ .../AST/Functions/MySql/InteriorRingN.php | 21 ++++ .../Query/AST/Functions/MySql/Intersects.php | 21 ++++ .../Query/AST/Functions/MySql/IsClosed.php | 21 ++++ .../ORM/Query/AST/Functions/MySql/IsEmpty.php | 21 ++++ .../Query/AST/Functions/MySql/IsSimple.php | 21 ++++ .../Query/AST/Functions/MySql/LineString.php | 21 ++++ .../AST/Functions/MySql/LineStringFromWKB.php | 21 ++++ .../Query/AST/Functions/MySql/MBRContains.php | 24 +++- .../Query/AST/Functions/MySql/MBRDisjoint.php | 14 ++- .../Query/AST/Functions/MySql/MBREqual.php | 21 ++++ .../AST/Functions/MySql/MBRIntersects.php | 21 ++++ .../Query/AST/Functions/MySql/MBROverlaps.php | 21 ++++ .../Query/AST/Functions/MySql/MBRTouches.php | 21 ++++ .../Query/AST/Functions/MySql/MBRWithin.php | 21 ++++ .../AST/Functions/MySql/NumInteriorRings.php | 21 ++++ .../Query/AST/Functions/MySql/NumPoints.php | 21 ++++ .../Query/AST/Functions/MySql/Overlaps.php | 21 ++++ .../ORM/Query/AST/Functions/MySql/Point.php | 21 ++++ .../AST/Functions/MySql/PointFromWKB.php | 21 ++++ .../ORM/Query/AST/Functions/MySql/PointN.php | 21 ++++ .../ORM/Query/AST/Functions/MySql/SRID.php | 21 ++++ .../Query/AST/Functions/MySql/STBuffer.php | 23 ++++ .../Query/AST/Functions/MySql/STContains.php | 23 ++++ .../Query/AST/Functions/MySql/STCrosses.php | 23 ++++ .../Query/AST/Functions/MySql/STDisjoint.php | 23 ++++ .../Query/AST/Functions/MySql/STDistance.php | 23 ++++ .../Query/AST/Functions/MySql/STEquals.php | 23 ++++ .../AST/Functions/MySql/STIntersects.php | 21 ++++ .../Query/AST/Functions/MySql/STOverlaps.php | 23 ++++ .../Query/AST/Functions/MySql/STTouches.php | 23 ++++ .../Query/AST/Functions/MySql/STWithin.php | 23 ++++ .../Query/AST/Functions/MySql/StartPoint.php | 21 ++++ .../ORM/Query/AST/Functions/MySql/Touches.php | 21 ++++ .../ORM/Query/AST/Functions/MySql/Within.php | 21 ++++ .../ORM/Query/AST/Functions/MySql/X.php | 21 ++++ .../ORM/Query/AST/Functions/MySql/Y.php | 21 ++++ .../AST/Functions/PostgreSql/Geometry.php | 21 ++++ .../Query/AST/Functions/PostgreSql/STArea.php | 21 ++++ .../AST/Functions/PostgreSql/STAsBinary.php | 21 ++++ .../AST/Functions/PostgreSql/STAsGeoJson.php | 21 ++++ .../AST/Functions/PostgreSql/STAsText.php | 21 ++++ .../AST/Functions/PostgreSql/STAzimuth.php | 21 ++++ .../AST/Functions/PostgreSql/STBoundary.php | 21 ++++ .../AST/Functions/PostgreSql/STBuffer.php | 21 ++++ .../AST/Functions/PostgreSql/STCentroid.php | 21 ++++ .../Functions/PostgreSql/STClosestPoint.php | 21 ++++ .../AST/Functions/PostgreSql/STCollect.php | 21 ++++ .../AST/Functions/PostgreSql/STContains.php | 21 ++++ .../PostgreSql/STContainsProperly.php | 21 ++++ .../AST/Functions/PostgreSql/STCoveredBy.php | 21 ++++ .../AST/Functions/PostgreSql/STCovers.php | 21 ++++ .../AST/Functions/PostgreSql/STCrosses.php | 21 ++++ .../AST/Functions/PostgreSql/STDWithin.php | 21 ++++ .../AST/Functions/PostgreSql/STDifference.php | 21 ++++ .../AST/Functions/PostgreSql/STDisjoint.php | 21 ++++ .../AST/Functions/PostgreSql/STDistance.php | 21 ++++ .../Functions/PostgreSql/STDistanceSphere.php | 21 ++++ .../AST/Functions/PostgreSql/STEndPoint.php | 21 ++++ .../AST/Functions/PostgreSql/STEnvelope.php | 21 ++++ .../AST/Functions/PostgreSql/STExpand.php | 21 ++++ .../AST/Functions/PostgreSql/STExtent.php | 21 ++++ .../PostgreSql/STGeographyFromText.php | 21 ++++ .../Functions/PostgreSql/STGeomFromEWKT.php | 21 ++++ .../Functions/PostgreSql/STGeomFromText.php | 21 ++++ .../AST/Functions/PostgreSql/STGeometryN.php | 21 ++++ .../Functions/PostgreSql/STIntersection.php | 21 ++++ .../AST/Functions/PostgreSql/STIntersects.php | 21 ++++ .../AST/Functions/PostgreSql/STLength.php | 21 ++++ .../PostgreSql/STLineCrossingDirection.php | 21 ++++ .../PostgreSql/STLineInterpolatePoint.php | 21 ++++ .../PostgreSql/STLineLocatePoint.php | 21 ++++ .../Functions/PostgreSql/STLineSubstring.php | 21 ++++ .../AST/Functions/PostgreSql/STMakeBox2D.php | 21 ++++ .../Functions/PostgreSql/STMakeEnvelope.php | 18 +++ .../AST/Functions/PostgreSql/STMakeLine.php | 21 ++++ .../AST/Functions/PostgreSql/STMakePoint.php | 21 ++++ .../AST/Functions/PostgreSql/STOverlaps.php | 21 ++++ .../AST/Functions/PostgreSql/STPerimeter.php | 21 ++++ .../AST/Functions/PostgreSql/STPoint.php | 21 ++++ .../AST/Functions/PostgreSql/STScale.php | 21 ++++ .../AST/Functions/PostgreSql/STSetSRID.php | 21 ++++ .../AST/Functions/PostgreSql/STSimplify.php | 21 ++++ .../AST/Functions/PostgreSql/STSnapToGrid.php | 28 ++++- .../AST/Functions/PostgreSql/STSplit.php | 21 ++++ .../AST/Functions/PostgreSql/STStartPoint.php | 21 ++++ .../AST/Functions/PostgreSql/STSummary.php | 21 ++++ .../AST/Functions/PostgreSql/STTouches.php | 21 ++++ .../AST/Functions/PostgreSql/STTransform.php | 21 ++++ .../AST/Functions/PostgreSql/STTranslate.php | 21 ++++ .../AST/Functions/PostgreSql/STUnion.php | 21 ++++ .../AST/Functions/PostgreSql/STWithin.php | 21 ++++ .../Query/AST/Functions/PostgreSql/STX.php | 21 ++++ .../Query/AST/Functions/PostgreSql/STY.php | 21 ++++ .../Spatial/ORM/Query/GeometryWalker.php | 15 ++- .../Spatial/PHP/Types/AbstractGeometry.php | 107 ++++++++++++++---- .../Spatial/PHP/Types/AbstractLineString.php | 4 + .../PHP/Types/AbstractMultiLineString.php | 36 +++++- .../Spatial/PHP/Types/AbstractMultiPoint.php | 32 ++++-- .../PHP/Types/AbstractMultiPolygon.php | 35 +++++- lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php | 76 ++++++++++--- .../Spatial/PHP/Types/AbstractPolygon.php | 36 ++++-- .../Types/Geography/GeographyInterface.php | 8 +- .../Spatial/PHP/Types/Geography/Point.php | 12 +- .../Tests/DBAL/Platform/PlatformTest.php | 6 +- .../DBAL/Types/Geography/GeoPointSridTest.php | 34 ++++++ .../Types/Geography/GeoPolygonTypeTest.php | 57 +++++++++- .../Tests/DBAL/Types/GeographyTypeTest.php | 61 +++++----- .../Types/Geometry/LineStringTypeTest.php | 47 +++++++- .../Types/Geometry/MultiPolygonTypeTest.php | 49 +++++++- .../DBAL/Types/Geometry/PointTypeTest.php | 44 +++++++ .../DBAL/Types/Geometry/PolygonTypeTest.php | 52 +++++++++ .../Tests/DBAL/Types/GeometryTypeTest.php | 90 +++++++++++++-- .../Spatial/Tests/DBAL/Types/SchemaTest.php | 33 +++++- tests/CrEOF/Spatial/Tests/FileSQLLogger.php | 17 ++- .../Tests/Fixtures/GeoLineStringEntity.php | 2 + .../Tests/Fixtures/GeoPointSridEntity.php | 2 + .../Tests/Fixtures/GeoPolygonEntity.php | 2 + .../Tests/Fixtures/GeographyEntity.php | 3 + .../Spatial/Tests/Fixtures/GeometryEntity.php | 3 + .../Tests/Fixtures/LineStringEntity.php | 2 + .../Tests/Fixtures/MultiPolygonEntity.php | 2 + .../Tests/Fixtures/NoHintGeometryEntity.php | 3 +- .../Spatial/Tests/Fixtures/PointEntity.php | 2 + .../Spatial/Tests/Fixtures/PolygonEntity.php | 2 + .../Query/AST/Functions/MySql/AreaTest.php | 31 +++++ .../AST/Functions/MySql/AsBinaryTest.php | 21 ++-- .../Query/AST/Functions/MySql/AsTextTest.php | 22 ++++ .../AST/Functions/MySql/ContainsTest.php | 31 +++++ .../AST/Functions/MySql/DisjointTest.php | 31 +++++ .../AST/Functions/MySql/EnvelopeTest.php | 31 +++++ .../Query/AST/Functions/MySql/GLengthTest.php | 31 +++++ .../AST/Functions/MySql/GeomFromTextTest.php | 31 +++++ .../AST/Functions/MySql/MBRContainsTest.php | 31 +++++ .../AST/Functions/MySql/MBRDisjointTest.php | 31 +++++ .../AST/Functions/MySql/StartPointTest.php | 40 +++++++ .../AST/Functions/PostgreSql/GeometryTest.php | 22 ++++ .../AST/Functions/PostgreSql/STAreaTest.php | 31 +++++ .../Functions/PostgreSql/STAsBinaryTest.php | 22 ++++ .../AST/Functions/PostgreSql/STAsTextTest.php | 22 ++++ .../Functions/PostgreSql/STCentroidTest.php | 22 ++++ .../PostgreSql/STClosestPointTest.php | 22 ++++ .../Functions/PostgreSql/STCollectTest.php | 22 ++++ .../PostgreSql/STContainsProperlyTest.php | 31 +++++ .../Functions/PostgreSql/STContainsTest.php | 31 +++++ .../Functions/PostgreSql/STCoveredByTest.php | 31 +++++ .../AST/Functions/PostgreSql/STCoversTest.php | 31 +++++ .../Functions/PostgreSql/STCrossesTest.php | 31 +++++ .../Functions/PostgreSql/STDisjointTest.php | 31 +++++ .../PostgreSql/STDistanceSphereTest.php | 22 ++++ .../Functions/PostgreSql/STDistanceTest.php | 40 +++++++ .../Functions/PostgreSql/STEnvelopeTest.php | 31 +++++ .../PostgreSql/STGeomFromTextTest.php | 31 +++++ .../AST/Functions/PostgreSql/STLengthTest.php | 31 +++++ .../STLineCrossingDirectionTest.php | 31 +++++ .../PostgreSql/STMakeEnvelopeTest.php | 22 ++++ .../Functions/PostgreSql/STOverlapsTest.php | 22 ++++ .../Functions/PostgreSql/STSnapToGridTest.php | 49 ++++++++ .../Functions/PostgreSql/STStartPointTest.php | 40 +++++++ .../Functions/PostgreSql/STSummaryTest.php | 31 +++++ .../Spatial/Tests/ORM/Query/WrappingTest.php | 27 ++++- tests/CrEOF/Spatial/Tests/OrmMockTestCase.php | 12 +- tests/CrEOF/Spatial/Tests/OrmTestCase.php | 26 +++-- 187 files changed, 4334 insertions(+), 188 deletions(-) diff --git a/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php b/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php index c7c751c4..06fd0ea1 100644 --- a/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php +++ b/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php @@ -33,7 +33,6 @@ /** * Abstract spatial platform. - * */ abstract class AbstractPlatform implements PlatformInterface { @@ -43,9 +42,9 @@ abstract class AbstractPlatform implements PlatformInterface * @param AbstractSpatialType $type The abstract spatial type * @param string $sqlExpr the SQL expression * - * @return GeometryInterface - * * @throws InvalidValueException when the provided type is not supported + * + * @return GeometryInterface */ public function convertBinaryToPhpValue(AbstractSpatialType $type, $sqlExpr) { @@ -60,9 +59,9 @@ public function convertBinaryToPhpValue(AbstractSpatialType $type, $sqlExpr) * @param AbstractSpatialType $type The abstract spatial type * @param string $sqlExpr the SQL expression * - * @return GeometryInterface - * * @throws InvalidValueException when the provided type is not supported + * + * @return GeometryInterface */ public function convertStringToPhpValue(AbstractSpatialType $type, $sqlExpr) { @@ -71,6 +70,8 @@ public function convertStringToPhpValue(AbstractSpatialType $type, $sqlExpr) return $this->newObjectFromValue($type, $parser->parse()); } + // phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed + /** * Convert binary data to a php value. * @@ -81,10 +82,12 @@ public function convertStringToPhpValue(AbstractSpatialType $type, $sqlExpr) */ public function convertToDatabaseValue(AbstractSpatialType $type, GeometryInterface $value) { - //TODO the unused variable $type is used by overriding method + //the unused variable $type is used by overriding method return sprintf('%s(%s)', mb_strtoupper($value->getType()), $value); } + // phpcs:enable + /** * Get an array of database types that map to this Doctrine type. * diff --git a/lib/CrEOF/Spatial/DBAL/Platform/MySql.php b/lib/CrEOF/Spatial/DBAL/Platform/MySql.php index 3f6119b4..d08e4dbe 100644 --- a/lib/CrEOF/Spatial/DBAL/Platform/MySql.php +++ b/lib/CrEOF/Spatial/DBAL/Platform/MySql.php @@ -29,14 +29,14 @@ /** * MySql spatial platform. - * - * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT */ class MySql extends AbstractPlatform { /** - * @param string $sqlExpr + * Convert to database value. + * + * @param AbstractSpatialType $type The spatial type + * @param string $sqlExpr The SQL expression * * @return string */ @@ -46,7 +46,10 @@ public function convertToDatabaseValueSql(AbstractSpatialType $type, $sqlExpr) } /** - * @param string $sqlExpr + * Convert to php value to SQL. + * + * @param AbstractSpatialType $type The spatial type + * @param string $sqlExpr The SQL expression * * @return string */ @@ -58,6 +61,8 @@ public function convertToPhpValueSql(AbstractSpatialType $type, $sqlExpr) /** * Gets the SQL declaration snippet for a field of this type. * + * @param array $fieldDeclaration array SHALL contains 'type' as key + * * @return string */ public function getSqlDeclaration(array $fieldDeclaration) diff --git a/lib/CrEOF/Spatial/DBAL/Platform/PlatformInterface.php b/lib/CrEOF/Spatial/DBAL/Platform/PlatformInterface.php index 1c45c5ba..adf682b8 100644 --- a/lib/CrEOF/Spatial/DBAL/Platform/PlatformInterface.php +++ b/lib/CrEOF/Spatial/DBAL/Platform/PlatformInterface.php @@ -29,46 +29,64 @@ /** * Spatial platform interface. - * - * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT */ interface PlatformInterface { /** - * @param string $sqlExpr + * Convert Binary to php value. + * + * @param AbstractSpatialType $type Spatial type + * @param string $sqlExpr Sql expression * * @return GeometryInterface */ public function convertBinaryToPhpValue(AbstractSpatialType $type, $sqlExpr); /** - * @param string $sqlExpr + * Convert string data to a php value. + * + * @param AbstractSpatialType $type The abstract spatial type + * @param string $sqlExpr the SQL expression * * @return GeometryInterface */ public function convertStringToPhpValue(AbstractSpatialType $type, $sqlExpr); /** + * Convert to database value. + * + * @param AbstractSpatialType $type The spatial type + * @param GeometryInterface $value The geometry interface + * * @return string */ public function convertToDatabaseValue(AbstractSpatialType $type, GeometryInterface $value); /** - * @param string $sqlExpr + * Convert to database value to SQL. + * + * @param AbstractSpatialType $type The spatial type + * @param string $sqlExpr The SQL expression * * @return string */ public function convertToDatabaseValueSql(AbstractSpatialType $type, $sqlExpr); /** - * @param string $sqlExpr + * Convert to php value to SQL. + * + * @param AbstractSpatialType $type The spatial type + * @param string $sqlExpr The SQL expression * * @return string */ public function convertToPhpValueSql(AbstractSpatialType $type, $sqlExpr); /** + * Get an array of database types that map to this Doctrine type. + * + * @param AbstractSpatialType $type the spatial type + * * @return string[] */ public function getMappedDatabaseTypes(AbstractSpatialType $type); @@ -76,6 +94,8 @@ public function getMappedDatabaseTypes(AbstractSpatialType $type); /** * Gets the SQL declaration snippet for a field of this type. * + * @param array $fieldDeclaration array SHALL contains 'type' as key + * * @return string */ public function getSqlDeclaration(array $fieldDeclaration); diff --git a/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php b/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php index 7b876590..ee00ef56 100644 --- a/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php +++ b/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php @@ -31,9 +31,6 @@ /** * PostgreSql spatial platform. - * - * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT */ class PostgreSql extends AbstractPlatform { @@ -45,9 +42,9 @@ class PostgreSql extends AbstractPlatform * @param AbstractSpatialType $type Spatial type * @param string $sqlExpr Sql expression * - * @return GeometryInterface - * * @throws InvalidValueException when SQL expression is not a resource + * + * @return GeometryInterface */ public function convertBinaryToPhpValue(AbstractSpatialType $type, $sqlExpr) { diff --git a/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php b/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php index acda7439..f5219243 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php @@ -34,16 +34,24 @@ /** * Abstract Doctrine GEOMETRY type. - * - * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT */ abstract class AbstractSpatialType extends Type { public const PLATFORM_MYSQL = 'MySql'; public const PLATFORM_POSTGRESQL = 'PostgreSql'; + // phpcs:disable Generic.NamingConventions.CamelCapsFunctionName.ScopeNotCamelCaps + /** + * Does working with this column require SQL conversion functions? + * + * This is a metadata function that is required for example in the ORM. + * Usage of {@link convertToDatabaseValueSql} and + * {@link convertToPhpValueSql} works for any type and mostly + * does nothing. This method can additionally be used for optimization purposes. + * + * Spatial types requires conversion. + * * @return bool */ public function canRequireSQLConversion() @@ -51,15 +59,17 @@ public function canRequireSQLConversion() return true; } + // phpcs:enable + /** * Converts a value from its PHP representation to its database representation of this type. * - * @param mixed $value + * @param GeometryInterface $value the value to convert + * @param AbstractPlatform $platform the database platform * - * @throws InvalidValueException - * @throws UnsupportedPlatformException + * @throws InvalidValueException when value is not of type Geometry interface * - * @return mixed + * @return string|null */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { @@ -77,7 +87,10 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform) /** * Modifies the SQL expression (identifier, parameter) to convert to a database value. * - * @param string $sqlExpr + * @param string $sqlExpr the SQL expression + * @param AbstractPlatform $platform the database platform + * + * @throws UnsupportedPlatformException when platform is unsupported * * @return string */ @@ -86,12 +99,17 @@ public function convertToDatabaseValueSql($sqlExpr, AbstractPlatform $platform) return $this->getSpatialPlatform($platform)->convertToDatabaseValueSql($this, $sqlExpr); } + // phpcs:disable Generic.NamingConventions.CamelCapsFunctionName.ScopeNotCamelCaps + /** * Converts a value from its database representation to its PHP representation of this type. * - * @param mixed $value + * @param resource|string|null $value value to convert to PHP + * @param AbstractPlatform $platform platform database + * + * @throws UnsupportedPlatformException when platform is unsupported * - * @return mixed + * @return GeometryInterface|null */ public function convertToPHPValue($value, AbstractPlatform $platform) { @@ -106,11 +124,15 @@ public function convertToPHPValue($value, AbstractPlatform $platform) return $this->getSpatialPlatform($platform)->convertBinaryToPhpValue($this, $value); } + // phpcs:enable + /** * Modifies the SQL expression (identifier, parameter) to convert to a PHP value. * - * @param string $sqlExpr - * @param AbstractPlatform $platform + * @param string $sqlExpr SQL expression + * @param AbstractPlatform $platform platform database + * + * @throws UnsupportedPlatformException when platform is unsupported * * @return string */ @@ -122,6 +144,10 @@ public function convertToPhpValueSql($sqlExpr, $platform) /** * Get an array of database types that map to this Doctrine type. * + * @param AbstractPlatform $platform platform database + * + * @throws UnsupportedPlatformException when platform is unsupported + * * @return array */ public function getMappedDatabaseTypes(AbstractPlatform $platform) @@ -142,6 +168,11 @@ public function getName() /** * Gets the SQL declaration snippet for a field of this type. * + * @param array $fieldDeclaration the field declaration + * @param AbstractPlatform $platform database platform + * + * @throws UnsupportedPlatformException when platform is unsupported + * * @return string */ public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform) @@ -149,6 +180,8 @@ public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $pla return $this->getSpatialPlatform($platform)->getSqlDeclaration($fieldDeclaration); } + // phpcs:disable Generic.NamingConventions.CamelCapsFunctionName.ScopeNotCamelCaps + /** * Gets the SQL name of this type. * @@ -163,6 +196,8 @@ public function getSQLType() return mb_substr($class, mb_strrpos($class, '\\') + 1, $len); } + // phpcs:enable + /** * @return string */ @@ -171,22 +206,32 @@ public function getTypeFamily() return $this instanceof GeographyType ? GeographyInterface::GEOGRAPHY : GeometryInterface::GEOMETRY; } + // phpcs:disable Generic.NamingConventions.CamelCapsFunctionName.ScopeNotCamelCaps + /** * If this Doctrine Type maps to an already mapped database type, * reverse schema engineering can't take them apart. You need to mark * one of those types as commented, which will have Doctrine use an SQL * comment to typehint the actual Doctrine Type. * + * @param AbstractPlatform $platform database platform + * * @return bool */ public function requiresSQLCommentHint(AbstractPlatform $platform) { // TODO onSchemaColumnDefinition event listener? - return true; + return $platform instanceof AbstractPlatform; } + // phpcs:enable + /** - * @throws UnsupportedPlatformException + * Return the spatial platform when it is accepted. + * + * @param AbstractPlatform $platform the database platform + * + * @throws UnsupportedPlatformException when platform is not declared in constant * * @return PlatformInterface */ @@ -195,7 +240,10 @@ private function getSpatialPlatform(AbstractPlatform $platform) $const = sprintf('self::PLATFORM_%s', mb_strtoupper($platform->getName())); if (!defined($const)) { - throw new UnsupportedPlatformException(sprintf('DBAL platform "%s" is not currently supported.', $platform->getName())); + throw new UnsupportedPlatformException(sprintf( + 'DBAL platform "%s" is not currently supported.', + $platform->getName() + )); } $class = sprintf('CrEOF\Spatial\DBAL\Platform\%s', constant($const)); diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php index e1233209..298a67f5 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php @@ -25,18 +25,18 @@ namespace CrEOF\Spatial\ORM\Query\AST\Functions; use CrEOF\Spatial\Exception\UnsupportedPlatformException; +use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Platforms\AbstractPlatform; +use Doctrine\ORM\Query\AST\ASTException; use Doctrine\ORM\Query\AST\Functions\FunctionNode; use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Lexer; use Doctrine\ORM\Query\Parser; +use Doctrine\ORM\Query\QueryException; use Doctrine\ORM\Query\SqlWalker; /** * Abstract spatial DQL function. - * - * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT */ abstract class AbstractSpatialDQLFunction extends FunctionNode { @@ -66,6 +66,14 @@ abstract class AbstractSpatialDQLFunction extends FunctionNode protected $platforms = []; /** + * Get the SQL. + * + * @param SqlWalker $sqlWalker the SQL Walker + * + * @throws UnsupportedPlatformException when platform is unsupported + * @throws DBALException when an invalid platform was specified for this connection + * @throws ASTException when node cannot dispatch SqlWalker + * * @return string */ public function getSql(SqlWalker $sqlWalker) @@ -80,6 +88,13 @@ public function getSql(SqlWalker $sqlWalker) return sprintf('%s(%s)', $this->functionName, implode(', ', $arguments)); } + /** + * Parse SQL. + * + * @param Parser $parser parser + * + * @throws QueryException Query exception + */ public function parse(Parser $parser) { $lexer = $parser->getLexer(); @@ -89,7 +104,10 @@ public function parse(Parser $parser) $this->geomExpr[] = $parser->ArithmeticPrimary(); - while (count($this->geomExpr) < $this->minGeomExpr || ((null === $this->maxGeomExpr || count($this->geomExpr) < $this->maxGeomExpr) && Lexer::T_CLOSE_PARENTHESIS != $lexer->lookahead['type'])) { + while (count($this->geomExpr) < $this->minGeomExpr + || ((null === $this->maxGeomExpr || count($this->geomExpr) < $this->maxGeomExpr) + && Lexer::T_CLOSE_PARENTHESIS != $lexer->lookahead['type']) + ) { $parser->match(Lexer::T_COMMA); $this->geomExpr[] = $parser->ArithmeticPrimary(); @@ -99,7 +117,11 @@ public function parse(Parser $parser) } /** - * @throws UnsupportedPlatformException + * Test that the platform supports spatial type. + * + * @param AbstractPlatform $platform database spatial + * + * @throws UnsupportedPlatformException when platform is unsupported */ protected function validatePlatform(AbstractPlatform $platform) { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Area.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Area.php index 940ea9a7..e6cb1ac7 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Area.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Area.php @@ -34,10 +34,31 @@ */ class Area extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'Area'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php index 9044219b..028b6cf5 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php @@ -35,10 +35,31 @@ */ class AsBinary extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'AsBinary'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Miimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsText.php index e0af9d9d..74ce15f4 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsText.php @@ -35,10 +35,31 @@ */ class AsText extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'AsText'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Buffer.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Buffer.php index 5b63d87e..f11342b2 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Buffer.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Buffer.php @@ -34,10 +34,31 @@ */ class Buffer extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'Buffer'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Centroid.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Centroid.php index b556cbc3..b8fe50ea 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Centroid.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Centroid.php @@ -34,10 +34,31 @@ */ class Centroid extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'Centroid'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Contains.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Contains.php index 74c55747..72a0bca4 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Contains.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Contains.php @@ -34,10 +34,31 @@ */ class Contains extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'Contains'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Crosses.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Crosses.php index eea40c64..6031ebc5 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Crosses.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Crosses.php @@ -34,10 +34,31 @@ */ class Crosses extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'Crosses'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Dimension.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Dimension.php index 509b2f75..d531ff0a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Dimension.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Dimension.php @@ -34,10 +34,31 @@ */ class Dimension extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'Dimension'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Disjoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Disjoint.php index c8edffcd..c0d34ff5 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Disjoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Disjoint.php @@ -34,10 +34,31 @@ */ class Disjoint extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'Disjoint'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Distance.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Distance.php index f3bfc1b1..a40a4665 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Distance.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Distance.php @@ -34,8 +34,31 @@ */ class Distance extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'Distance'; + + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/DistanceFromMultyLine.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/DistanceFromMultyLine.php index f48df292..19fbd0e2 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/DistanceFromMultyLine.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/DistanceFromMultyLine.php @@ -33,10 +33,31 @@ */ class DistanceFromMultyLine extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'distance_from_multyline'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/EndPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/EndPoint.php index b1acd055..0f4c9ce2 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/EndPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/EndPoint.php @@ -34,10 +34,31 @@ */ class EndPoint extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'EndPoint'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Envelope.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Envelope.php index 61930196..801be638 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Envelope.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Envelope.php @@ -34,10 +34,31 @@ */ class Envelope extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'Envelope'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Equals.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Equals.php index b4d60597..f188d0b2 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Equals.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Equals.php @@ -34,10 +34,31 @@ */ class Equals extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'Equals'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/ExteriorRing.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/ExteriorRing.php index ddc952d0..a54a2d93 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/ExteriorRing.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/ExteriorRing.php @@ -34,10 +34,31 @@ */ class ExteriorRing extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ExteriorRing'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GLength.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GLength.php index 3d8dd91e..5860d84f 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GLength.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GLength.php @@ -34,10 +34,31 @@ */ class GLength extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'GLength'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeodistPt.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeodistPt.php index c95860c2..5f727546 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeodistPt.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeodistPt.php @@ -33,10 +33,31 @@ */ class GeodistPt extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'geodist_pt'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeomFromText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeomFromText.php index c5ac49c2..e376c4df 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeomFromText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeomFromText.php @@ -34,10 +34,31 @@ */ class GeomFromText extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'GeomFromText'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeometryType.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeometryType.php index e68a1d4a..a1ae9b24 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeometryType.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeometryType.php @@ -34,10 +34,31 @@ */ class GeometryType extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'GeometryType'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/InteriorRingN.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/InteriorRingN.php index d2efa49a..4849739b 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/InteriorRingN.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/InteriorRingN.php @@ -34,10 +34,31 @@ */ class InteriorRingN extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'InteriorRingN'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Intersects.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Intersects.php index 32565b30..b229fd0d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Intersects.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Intersects.php @@ -35,10 +35,31 @@ */ class Intersects extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'Intersects'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsClosed.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsClosed.php index 85965b11..8cadb5ff 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsClosed.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsClosed.php @@ -34,10 +34,31 @@ */ class IsClosed extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'IsClosed'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsEmpty.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsEmpty.php index f7cd3799..e092c1dd 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsEmpty.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsEmpty.php @@ -34,10 +34,31 @@ */ class IsEmpty extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'IsEmpty'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsSimple.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsSimple.php index c775a71a..e141b8f8 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsSimple.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsSimple.php @@ -34,10 +34,31 @@ */ class IsSimple extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'IsSimple'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineString.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineString.php index 16bc1e48..17616783 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineString.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineString.php @@ -34,10 +34,31 @@ */ class LineString extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'LineString'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineStringFromWKB.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineStringFromWKB.php index 0481babf..3c021318 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineStringFromWKB.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineStringFromWKB.php @@ -34,10 +34,31 @@ */ class LineStringFromWKB extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'LineStringFromWKB'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRContains.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRContains.php index 18e30d3a..460b0c5c 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRContains.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRContains.php @@ -28,16 +28,34 @@ /** * MBRContains DQL function. - * - * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT */ class MBRContains extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'MBRContains'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRDisjoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRDisjoint.php index a06adf23..7d70a536 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRDisjoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRDisjoint.php @@ -28,12 +28,20 @@ /** * MBRDisjoint DQL function. - * - * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT */ class MBRDisjoint extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'MBRDisjoint'; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBREqual.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBREqual.php index cf662033..07a5914a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBREqual.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBREqual.php @@ -34,10 +34,31 @@ */ class MBREqual extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'MBREqual'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRIntersects.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRIntersects.php index 2743be25..0196d7ff 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRIntersects.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRIntersects.php @@ -35,10 +35,31 @@ */ class MBRIntersects extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'MBRIntersects'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBROverlaps.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBROverlaps.php index d0360f5a..122b2099 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBROverlaps.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBROverlaps.php @@ -35,10 +35,31 @@ */ class MBROverlaps extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'MBROverlaps'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRTouches.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRTouches.php index 24f444f9..557f631b 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRTouches.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRTouches.php @@ -35,10 +35,31 @@ */ class MBRTouches extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'MBRTouches'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRWithin.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRWithin.php index 574e0d23..0bbd6912 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRWithin.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRWithin.php @@ -35,10 +35,31 @@ */ class MBRWithin extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'MBRWithin'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumInteriorRings.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumInteriorRings.php index 9e4d71cc..efc87eaf 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumInteriorRings.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumInteriorRings.php @@ -35,10 +35,31 @@ */ class NumInteriorRings extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'NumInteriorRings'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumPoints.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumPoints.php index 80a880bd..23c51b24 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumPoints.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumPoints.php @@ -35,10 +35,31 @@ */ class NumPoints extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'NumPoints'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Overlaps.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Overlaps.php index 218b2bf1..e3c4a1c8 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Overlaps.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Overlaps.php @@ -35,10 +35,31 @@ */ class Overlaps extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'Overlaps'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Point.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Point.php index a261ed0e..d26369b3 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Point.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Point.php @@ -34,10 +34,31 @@ */ class Point extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'Point'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointFromWKB.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointFromWKB.php index fca08ca0..65e18392 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointFromWKB.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointFromWKB.php @@ -34,10 +34,31 @@ */ class PointFromWKB extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'PointFromWKB'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointN.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointN.php index 4a773337..82d2ef58 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointN.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointN.php @@ -35,10 +35,31 @@ */ class PointN extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'PointN'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/SRID.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/SRID.php index 75c5aa5f..c4978065 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/SRID.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/SRID.php @@ -34,10 +34,31 @@ */ class SRID extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'SRID'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STBuffer.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STBuffer.php index d7053700..a8e81afd 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STBuffer.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STBuffer.php @@ -33,8 +33,31 @@ */ class STBuffer extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Buffer'; + + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STContains.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STContains.php index d65c65e6..917946a9 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STContains.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STContains.php @@ -34,8 +34,31 @@ */ class STContains extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Contains'; + + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STCrosses.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STCrosses.php index f903c2c2..37b1675d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STCrosses.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STCrosses.php @@ -34,8 +34,31 @@ */ class STCrosses extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Crosses'; + + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDisjoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDisjoint.php index 28f20b4a..b45f43ce 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDisjoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDisjoint.php @@ -34,8 +34,31 @@ */ class STDisjoint extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Disjoint'; + + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistance.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistance.php index 035f8c05..c12e6683 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistance.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistance.php @@ -34,8 +34,31 @@ */ class STDistance extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Distance'; + + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STEquals.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STEquals.php index 0591b702..23fb0bb4 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STEquals.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STEquals.php @@ -34,8 +34,31 @@ */ class STEquals extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Equals'; + + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STIntersects.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STIntersects.php index b45d51de..29914137 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STIntersects.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STIntersects.php @@ -33,10 +33,31 @@ */ class STIntersects extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Intersects'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STOverlaps.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STOverlaps.php index f3646f1d..7383896b 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STOverlaps.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STOverlaps.php @@ -34,8 +34,31 @@ */ class STOverlaps extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Overlaps'; + + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STTouches.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STTouches.php index 62b42827..3bae5f24 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STTouches.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STTouches.php @@ -34,8 +34,31 @@ */ class STTouches extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Touches'; + + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STWithin.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STWithin.php index 6315476d..03cc820a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STWithin.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STWithin.php @@ -34,8 +34,31 @@ */ class STWithin extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Within'; + + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/StartPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/StartPoint.php index 2a2dfab9..4e30982e 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/StartPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/StartPoint.php @@ -34,10 +34,31 @@ */ class StartPoint extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'StartPoint'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Touches.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Touches.php index 2f2a44ba..7de28d12 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Touches.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Touches.php @@ -36,10 +36,31 @@ */ class Touches extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'Touches'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Within.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Within.php index 68229147..ed64a00b 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Within.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Within.php @@ -35,10 +35,31 @@ */ class Within extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'Within'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/X.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/X.php index 5da80048..63d44db0 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/X.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/X.php @@ -35,10 +35,31 @@ */ class X extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'X'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Y.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Y.php index 3b36b421..dfb07812 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Y.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Y.php @@ -35,10 +35,31 @@ */ class Y extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'Y'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['mysql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php index 97b99ae0..f48e9629 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php @@ -34,10 +34,31 @@ */ class Geometry extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'geometry'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STArea.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STArea.php index c5fb8bfe..8d9f3e64 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STArea.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STArea.php @@ -34,10 +34,31 @@ */ class STArea extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Area'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsBinary.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsBinary.php index aa2aa1a6..174aea76 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsBinary.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsBinary.php @@ -35,10 +35,31 @@ */ class STAsBinary extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_AsBinary'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsGeoJson.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsGeoJson.php index c41d7161..005ee2da 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsGeoJson.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsGeoJson.php @@ -35,10 +35,31 @@ */ class STAsGeoJson extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_AsGeoJson'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsText.php index 3c0c1358..41f62cc9 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsText.php @@ -35,10 +35,31 @@ */ class STAsText extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_AsText'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAzimuth.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAzimuth.php index 7e68de80..cbd35b9f 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAzimuth.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAzimuth.php @@ -34,10 +34,31 @@ */ class STAzimuth extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Azimuth'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBoundary.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBoundary.php index 61ccdfdf..f0353a54 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBoundary.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBoundary.php @@ -35,10 +35,31 @@ */ class STBoundary extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Boundary'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBuffer.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBuffer.php index 9e62a63a..6fd7edae 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBuffer.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBuffer.php @@ -31,10 +31,31 @@ */ class STBuffer extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Buffer'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 3; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCentroid.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCentroid.php index f6be013f..6c61f960 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCentroid.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCentroid.php @@ -34,10 +34,31 @@ */ class STCentroid extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Centroid'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STClosestPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STClosestPoint.php index 04982ef1..0bee4074 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STClosestPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STClosestPoint.php @@ -34,10 +34,31 @@ */ class STClosestPoint extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_ClosestPoint'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php index d8e82f54..67c8a9b8 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php @@ -34,10 +34,31 @@ */ class STCollect extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Collect'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContains.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContains.php index f9ca3fd6..1c203739 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContains.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContains.php @@ -34,10 +34,31 @@ */ class STContains extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Contains'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContainsProperly.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContainsProperly.php index ff971dff..e027da58 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContainsProperly.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContainsProperly.php @@ -34,10 +34,31 @@ */ class STContainsProperly extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_ContainsProperly'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCoveredBy.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCoveredBy.php index aa3b3941..dd7fd552 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCoveredBy.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCoveredBy.php @@ -34,10 +34,31 @@ */ class STCoveredBy extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_CoveredBy'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCovers.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCovers.php index 2239b900..acc56a6c 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCovers.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCovers.php @@ -34,10 +34,31 @@ */ class STCovers extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Covers'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCrosses.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCrosses.php index c0ba9ee1..08e9eef4 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCrosses.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCrosses.php @@ -34,10 +34,31 @@ */ class STCrosses extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Crosses'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDWithin.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDWithin.php index 876f7be9..bcee6551 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDWithin.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDWithin.php @@ -34,10 +34,31 @@ */ class STDWithin extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_DWithin'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 3; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDifference.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDifference.php index f91b0098..3da57f78 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDifference.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDifference.php @@ -35,10 +35,31 @@ */ class STDifference extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Difference'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDisjoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDisjoint.php index c46ab635..2e5991d4 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDisjoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDisjoint.php @@ -34,10 +34,31 @@ */ class STDisjoint extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Disjoint'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistance.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistance.php index 467b2663..f17ef3c2 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistance.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistance.php @@ -34,10 +34,31 @@ */ class STDistance extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Distance'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 3; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistanceSphere.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistanceSphere.php index d67ed707..65a2c2c9 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistanceSphere.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistanceSphere.php @@ -34,10 +34,31 @@ */ class STDistanceSphere extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Distance_Sphere'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEndPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEndPoint.php index e9da13de..68ed81be 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEndPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEndPoint.php @@ -34,10 +34,31 @@ */ class STEndPoint extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_EndPoint'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEnvelope.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEnvelope.php index f37beaf4..578d95a7 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEnvelope.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEnvelope.php @@ -34,10 +34,31 @@ */ class STEnvelope extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Envelope'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExpand.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExpand.php index 93cb10fb..4c8c8ef3 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExpand.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExpand.php @@ -31,10 +31,31 @@ */ class STExpand extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Expand'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExtent.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExtent.php index 8028e9ab..5195ae46 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExtent.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExtent.php @@ -34,10 +34,31 @@ */ class STExtent extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Extent'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeographyFromText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeographyFromText.php index 465cab7f..f1a65511 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeographyFromText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeographyFromText.php @@ -34,10 +34,31 @@ */ class STGeographyFromText extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_GeographyFromText'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromEWKT.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromEWKT.php index 04daef68..5e3d6596 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromEWKT.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromEWKT.php @@ -34,10 +34,31 @@ */ class STGeomFromEWKT extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_GeomFromEWKT'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromText.php index 4eec7d95..38d32ee2 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromText.php @@ -34,10 +34,31 @@ */ class STGeomFromText extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_GeomFromText'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeometryN.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeometryN.php index 90698ddf..aea9fbac 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeometryN.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeometryN.php @@ -35,10 +35,31 @@ */ class STGeometryN extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_GeometryN'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersection.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersection.php index 942b37f5..e38a5e34 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersection.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersection.php @@ -34,10 +34,31 @@ */ class STIntersection extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Intersection'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersects.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersects.php index 0b433a90..42284fb1 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersects.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersects.php @@ -34,10 +34,31 @@ */ class STIntersects extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Intersects'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLength.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLength.php index 8678e107..3aa7407b 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLength.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLength.php @@ -34,10 +34,31 @@ */ class STLength extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Length'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirection.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirection.php index 0ca44369..57695a57 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirection.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirection.php @@ -34,10 +34,31 @@ */ class STLineCrossingDirection extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_LineCrossingDirection'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineInterpolatePoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineInterpolatePoint.php index 2d9d2dae..c565eaf4 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineInterpolatePoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineInterpolatePoint.php @@ -34,10 +34,31 @@ */ class STLineInterpolatePoint extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Line_Interpolate_Point'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineLocatePoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineLocatePoint.php index 1bec1639..2d533dde 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineLocatePoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineLocatePoint.php @@ -34,10 +34,31 @@ */ class STLineLocatePoint extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Line_Locate_Point'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineSubstring.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineSubstring.php index 73a02044..6780af33 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineSubstring.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineSubstring.php @@ -35,10 +35,31 @@ */ class STLineSubstring extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Line_Substring'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 3; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 3; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeBox2D.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeBox2D.php index a9ac7498..ba74eff5 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeBox2D.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeBox2D.php @@ -34,10 +34,31 @@ */ class STMakeBox2D extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_MakeBox2D'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelope.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelope.php index efbec7c7..2bfe4a81 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelope.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelope.php @@ -34,15 +34,33 @@ */ class STMakeEnvelope extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_MakeEnvelope'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 5; /** + * Minimum number of parameters accepted by SQL function. + * * From Postgis 2.0, the 5th parameter (SRID) is not required. * * @var int */ protected $minGeomExpr = 4; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeLine.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeLine.php index 70cd00e7..45c94feb 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeLine.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeLine.php @@ -36,10 +36,31 @@ */ class STMakeLine extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_MakeLine'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakePoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakePoint.php index f19f2945..d488b285 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakePoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakePoint.php @@ -34,10 +34,31 @@ */ class STMakePoint extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_MakePoint'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 3; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STOverlaps.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STOverlaps.php index c0033d14..519e82d7 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STOverlaps.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STOverlaps.php @@ -34,10 +34,31 @@ */ class STOverlaps extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Overlaps'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STPerimeter.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STPerimeter.php index d7f4806d..d48fe35d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STPerimeter.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STPerimeter.php @@ -34,10 +34,31 @@ */ class STPerimeter extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Perimeter'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STPoint.php index 68ea3916..a1771292 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STPoint.php @@ -34,10 +34,31 @@ */ class STPoint extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Point'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STScale.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STScale.php index eb7532d4..819895db 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STScale.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STScale.php @@ -34,10 +34,31 @@ */ class STScale extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Scale'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 3; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 3; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSetSRID.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSetSRID.php index 3771afd7..9896c452 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSetSRID.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSetSRID.php @@ -34,10 +34,31 @@ */ class STSetSRID extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_SetSRID'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSimplify.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSimplify.php index e46cf43d..e2d3aec5 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSimplify.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSimplify.php @@ -31,10 +31,31 @@ */ class STSimplify extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Simplify'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSnapToGrid.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSnapToGrid.php index 92730c42..abbe5bac 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSnapToGrid.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSnapToGrid.php @@ -28,6 +28,7 @@ use CrEOF\Spatial\ORM\Query\AST\Functions\ReturnsGeometryInterface; use Doctrine\ORM\Query\Lexer; use Doctrine\ORM\Query\Parser; +use Doctrine\ORM\Query\QueryException; /** * ST_SnapToGrid DQL function. @@ -43,15 +44,40 @@ */ class STSnapToGrid extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_SnapToGrid'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 6; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; /** - * {@inheritdoc} + * Parse SQL. + * + * @param Parser $parser parser + * + * @throws QueryException Query exception */ public function parse(Parser $parser) { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSplit.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSplit.php index 54d657d6..95db7b22 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSplit.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSplit.php @@ -35,10 +35,31 @@ */ class STSplit extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Split'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STStartPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STStartPoint.php index 48c91a97..5cb349f2 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STStartPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STStartPoint.php @@ -34,10 +34,31 @@ */ class STStartPoint extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_StartPoint'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSummary.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSummary.php index d60da357..b8939813 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSummary.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSummary.php @@ -34,10 +34,31 @@ */ class STSummary extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Summary'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTouches.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTouches.php index 3be87f57..61cf372c 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTouches.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTouches.php @@ -34,10 +34,31 @@ */ class STTouches extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Touches'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTransform.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTransform.php index 7561335a..c8fe2b84 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTransform.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTransform.php @@ -31,10 +31,31 @@ */ class STTransform extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Transform'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTranslate.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTranslate.php index 4fbbbfae..24aca440 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTranslate.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTranslate.php @@ -35,10 +35,31 @@ */ class STTranslate extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Translate'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 4; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 3; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STUnion.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STUnion.php index 067e73c5..19a95363 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STUnion.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STUnion.php @@ -35,10 +35,31 @@ */ class STUnion extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Union'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STWithin.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STWithin.php index 3968be82..417f7ffa 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STWithin.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STWithin.php @@ -34,10 +34,31 @@ */ class STWithin extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Within'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 2; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 2; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STX.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STX.php index 9602c940..ac13dad5 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STX.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STX.php @@ -34,10 +34,31 @@ */ class STX extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_X'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STY.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STY.php index f3da97c7..4fc6518a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STY.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STY.php @@ -34,10 +34,31 @@ */ class STY extends AbstractSpatialDQLFunction { + /** + * SQL Function name. + * + * @var string + */ protected $functionName = 'ST_Y'; + /** + * Maximum number of parameters accepted by SQL function. + * + * @var int + */ protected $maxGeomExpr = 1; + /** + * Minimum number of parameters accepted by SQL function. + * + * @var int + */ protected $minGeomExpr = 1; + + /** + * Platform accepting this function. + * + * @var array + */ protected $platforms = ['postgresql']; } diff --git a/lib/CrEOF/Spatial/ORM/Query/GeometryWalker.php b/lib/CrEOF/Spatial/ORM/Query/GeometryWalker.php index c50032d5..332a3cf0 100644 --- a/lib/CrEOF/Spatial/ORM/Query/GeometryWalker.php +++ b/lib/CrEOF/Spatial/ORM/Query/GeometryWalker.php @@ -25,7 +25,10 @@ namespace CrEOF\Spatial\ORM\Query; use CrEOF\Spatial\ORM\Query\AST\Functions\ReturnsGeometryInterface; +use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\Query\AST\SelectExpression; +use Doctrine\ORM\Query\ParserResult; +use Doctrine\ORM\Query\QueryException; use Doctrine\ORM\Query\ResultSetMapping; use Doctrine\ORM\Query\SqlWalker; @@ -40,12 +43,18 @@ class GeometryWalker extends SqlWalker { /** + * Result set mapping. + * * @var ResultSetMapping */ protected $rsm; /** - * {@inheritdoc} + * Initializes TreeWalker with important information about the ASTs to be walked. + * + * @param AbstractQuery $query the parsed Query + * @param ParserResult $parserResult the result of the parsing process + * @param array $queryComponents the query components (symbol table) */ public function __construct($query, $parserResult, array $queryComponents) { @@ -57,7 +66,9 @@ public function __construct($query, $parserResult, array $queryComponents) /** * Walks down a SelectExpression AST node and generates the corresponding SQL. * - * @param SelectExpression $selectExpression + * @param SelectExpression $selectExpression Select expression AST node + * + * @throws QueryException when error happend during walking into select expression * * @return string the SQL */ diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php b/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php index c4e6d222..7d420bec 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php @@ -36,11 +36,15 @@ abstract class AbstractGeometry implements GeometryInterface { /** + * Spatial Reference System Identifier. + * * @var int */ protected $srid; /** + * Spatial Reference System Identifier getter. + * * @return int|null */ public function getSrid() @@ -49,7 +53,9 @@ public function getSrid() } /** - * @param mixed $srid + * Spatial Reference System Identifier fluent setter. + * + * @param mixed $srid Spatial Reference System Identifier * * @return self */ @@ -63,11 +69,15 @@ public function setSrid($srid) } /** + * Convert this abstract geometry to an array. + * * @return array */ abstract public function toArray(); /** + * Convert this abstract geometry to a Json string. + * * @return string */ public function toJson() @@ -79,6 +89,8 @@ public function toJson() } /** + * Return the namespace of this class. + * * @return string */ protected function getNamespace() @@ -89,7 +101,11 @@ protected function getNamespace() } /** - * @param AbstractLineString|AbstractPoint[]|array[] $lineString + * Validate line strings value. + * + * @param AbstractLineString|AbstractPoint[]|array[] $lineString line string to validate + * + * @throws InvalidValueException when a point of line string is not valid * * @return array[] */ @@ -99,7 +115,11 @@ protected function validateLineStringValue($lineString) } /** - * @param AbstractLineString[] $lineStrings + * Validate multiline strings value. + * + * @param AbstractLineString[] $lineStrings the array of line strings to validate + * + * @throws InvalidValueException as soon as a point of a line string is not valid * * @return array */ @@ -113,7 +133,11 @@ protected function validateMultiLineStringValue(array $lineStrings) } /** - * @param AbstractLineString|AbstractPoint[]|array[] $points + * Validate multi point value. + * + * @param AbstractLineString|AbstractPoint[]|array[] $points array of geometric data to validate + * + * @throws InvalidValueException when one point is not valid * * @return array[] */ @@ -131,9 +155,13 @@ protected function validateMultiPointValue($points) } /** - * @param AbstractPolygon[] $polygons + * Validate multi polygon value. * - * @return array + * @param AbstractPolygon[] $polygons the array of polygons to validate + * + * @throws InvalidValueException when one polygon is not valid + * + * @return array the validated polygons */ protected function validateMultiPolygonValue(array $polygons) { @@ -148,9 +176,11 @@ protected function validateMultiPolygonValue(array $polygons) } /** - * @param AbstractPoint|array $point + * Validate a geometric point or an array of geometric points. * - * @throws InvalidValueException + * @param AbstractPoint|array $point the geometric point(s) to validate + * + * @throws InvalidValueException as soon as one point is not valid * * @return array */ @@ -164,14 +194,22 @@ protected function validatePointValue($point) return array_values($point); break; default: - throw new InvalidValueException(sprintf('Invalid %s Point value of type "%s"', $this->getType(), (is_object($point) ? get_class($point) : gettype($point)))); + throw new InvalidValueException(sprintf( + 'Invalid %s Point value of type "%s"', + $this->getType(), + (is_object($point) ? get_class($point) : gettype($point)) + )); } } /** - * @param AbstractLineString[] $rings + * Validate polygon values. * - * @return array + * @param AbstractLineString[] $rings the array of rings + * + * @throws InvalidValueException when ring is not valid + * + * @return array the validated rings */ protected function validatePolygonValue(array $rings) { @@ -183,11 +221,13 @@ protected function validatePolygonValue(array $rings) } /** - * @param AbstractLineString|array[] $ring + * Validate ring value. * - * @throws InvalidValueException + * @param AbstractLineString|array[] $ring the ring or a ring converted to array * - * @return array[] + * @throws InvalidValueException when the ring is not an abstract line string or is not closed + * + * @return array[] the validate ring */ protected function validateRingValue($ring) { @@ -198,20 +238,29 @@ protected function validateRingValue($ring) case is_array($ring): break; default: - throw new InvalidValueException(sprintf('Invalid %s LineString value of type "%s"', $this->getType(), (is_object($ring) ? get_class($ring) : gettype($ring)))); + throw new InvalidValueException(sprintf( + 'Invalid %s LineString value of type "%s"', + $this->getType(), + (is_object($ring) ? get_class($ring) : gettype($ring)) + )); } $ring = $this->validateLineStringValue($ring); if ($ring[0] !== end($ring)) { - throw new InvalidValueException(sprintf('Invalid polygon, ring "(%s)" is not closed', $this->toStringLineString($ring))); + throw new InvalidValueException(sprintf( + 'Invalid polygon, ring "(%s)" is not closed', + $this->toStringLineString($ring) + )); } return $ring; } /** - * @param array[] $lineString + * Convert a line to string. + * + * @param array[] $lineString line string already converted into an array * * @return string */ @@ -221,7 +270,9 @@ private function toStringLineString(array $lineString) } /** - * @param array[] $multiLineString + * Convert multiline strings to a string value. + * + * @param array[] $multiLineString multi line already converted into an array * * @return string */ @@ -237,7 +288,9 @@ private function toStringMultiLineString(array $multiLineString) } /** - * @param array[] $multiPoint + * Convert multi points to a string value. + * + * @param array[] $multiPoint multipoint already converted into an array of point * * @return string */ @@ -253,7 +306,11 @@ private function toStringMultiPoint(array $multiPoint) } /** - * @param array[] $multiPolygon + * Convert multipolygon to a string. + * + * TODO: unused private method. Verify which transformation is missing. + * + * @param array[] $multiPolygon multipolygon already converted into an array of polygon * * @return string */ @@ -269,6 +326,10 @@ private function toStringMultiPolygon(array $multiPolygon) } /** + * Convert a point to a string value. + * + * @param array $point point already converted into an array of TWO coordinates + * * @return string */ private function toStringPoint(array $point) @@ -277,7 +338,9 @@ private function toStringPoint(array $point) } /** - * @param array[] $polygon + * Convert a polygon into a string value. + * + * @param array[] $polygon polygons already converted into array * * @return string */ @@ -287,6 +350,8 @@ private function toStringPolygon(array $polygon) } /** + * Magic method: convert geometry to string. + * * @return string */ public function __toString() diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractLineString.php b/lib/CrEOF/Spatial/PHP/Types/AbstractLineString.php index cd7096c4..6ed379ce 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractLineString.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractLineString.php @@ -33,6 +33,8 @@ abstract class AbstractLineString extends AbstractMultiPoint { /** + * Type of this geometry: Linestring. + * * @return string */ public function getType() @@ -41,6 +43,8 @@ public function getType() } /** + * This line string is closed when first point is the same than last point. + * * @return bool */ public function isClosed() diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiLineString.php b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiLineString.php index bd7fc3ec..191fc5c3 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiLineString.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiLineString.php @@ -24,6 +24,8 @@ namespace CrEOF\Spatial\PHP\Types; +use CrEOF\Spatial\Exception\InvalidValueException; + /** * Abstract MultiLineString object for MULTILINESTRING spatial types. * @@ -33,13 +35,19 @@ abstract class AbstractMultiLineString extends AbstractGeometry { /** + * Array of line strings. + * * @var array[] */ protected $lineStrings = []; /** - * @param AbstractLineString[]|array[] $rings - * @param int|null $srid + * AbstractMultiLineString constructor. + * + * @param AbstractLineString[]|array[] $rings array of linestring + * @param int|null $srid Spatial Reference System Identifier + * + * @throws InvalidValueException when rings contains an invalid linestring */ public function __construct(array $rings, $srid = null) { @@ -49,7 +57,11 @@ public function __construct(array $rings, $srid = null) } /** - * @param AbstractLineString|array[] $lineString + * Add a linestring to geometry. + * + * @param AbstractLineString|array[] $lineString the line string to add to Geometry + * + * @throws InvalidValueException when linestring is not valid * * @return self */ @@ -61,7 +73,9 @@ public function addLineString($lineString) } /** - * @param int $index + * Return linestring at specified offset. + * + * @param int $index offset of line string to return. Use -1 to get last linestring. * * @return AbstractLineString */ @@ -77,6 +91,8 @@ public function getLineString($index) } /** + * Line strings getter. + * * @return AbstractLineString[] */ public function getLineStrings() @@ -91,7 +107,9 @@ public function getLineStrings() } /** - * @return string + * Type getter. + * + * @return string MultiLineString */ public function getType() { @@ -99,7 +117,11 @@ public function getType() } /** - * @param AbstractLineString[] $lineStrings + * LineStrings fluent setter. + * + * @param AbstractLineString[] $lineStrings array of LineString + * + * @throws InvalidValueException when a linestring is not valid * * @return self */ @@ -111,6 +133,8 @@ public function setLineStrings(array $lineStrings) } /** + * Implements abstract method to convert line strings into an array. + * * @return array[] */ public function toArray() diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPoint.php b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPoint.php index c9d6886d..bc4f284a 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPoint.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPoint.php @@ -40,8 +40,12 @@ abstract class AbstractMultiPoint extends AbstractGeometry protected $points = []; /** - * @param AbstractPoint[]|array[] $points - * @param int|null $srid + * Abstract multipoint constructor. + * + * @param AbstractPoint[]|array[] $points array of point + * @param int|null $srid Spatial Reference System Identifier + * + * @throws InvalidValueException when a point is not valid */ public function __construct(array $points, $srid = null) { @@ -51,9 +55,11 @@ public function __construct(array $points, $srid = null) } /** - * @param AbstractPoint|array $point + * Add a point to geometry. + * + * @param AbstractPoint|array $point Point to add to geometry * - * @throws InvalidValueException + * @throws InvalidValueException when the point is not valid * * @return self */ @@ -65,7 +71,9 @@ public function addPoint($point) } /** - * @param int $index + * Point getter. + * + * @param int $index index of the point to retrieve. -1 to get last point. * * @return AbstractPoint */ @@ -86,6 +94,8 @@ public function getPoint($index) } /** + * Points getter. + * * @return AbstractPoint[] */ public function getPoints() @@ -100,7 +110,9 @@ public function getPoints() } /** - * @return string + * Type getter. + * + * @return string Multipoint */ public function getType() { @@ -108,7 +120,11 @@ public function getType() } /** - * @param AbstractPoint[]|array[] $points + * Points fluent setter. + * + * @param AbstractPoint[]|array[] $points the points + * + * @throws InvalidValueException when a point is invalid * * @return self */ @@ -120,6 +136,8 @@ public function setPoints($points) } /** + * Convert multipoint to array. + * * @return array[] */ public function toArray() diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPolygon.php b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPolygon.php index 28954404..12e72275 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPolygon.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPolygon.php @@ -24,6 +24,8 @@ namespace CrEOF\Spatial\PHP\Types; +use CrEOF\Spatial\Exception\InvalidValueException; + /** * Abstract Polygon object for POLYGON spatial types. * @@ -38,8 +40,12 @@ abstract class AbstractMultiPolygon extends AbstractGeometry protected $polygons = []; /** - * @param AbstractPolygon[]|array[] $polygons - * @param int|null $srid + * AbstractMultiPolygon constructor. + * + * @param AbstractPolygon[]|array[] $polygons Polygons + * @param int|null $srid Spatial Reference System Identifier + * + * @throws InvalidValueException when a polygon is invalid */ public function __construct(array $polygons, $srid = null) { @@ -49,7 +55,11 @@ public function __construct(array $polygons, $srid = null) } /** - * @param AbstractPolygon|array[] $polygon + * Add a polygon to geometry. + * + * @param AbstractPolygon|array[] $polygon polygon to add + * + * @throws InvalidValueException when polygon is invalid * * @return self */ @@ -61,12 +71,15 @@ public function addPolygon($polygon) } /** - * @param int $index + * Polygon getter. + * + * @param int $index Index of polygon, use -1 to get last one * * @return AbstractPolygon */ public function getPolygon($index) { + //TODO replace by a function to be compliant with -1, -2, etc. if (-1 == $index) { $index = count($this->polygons) - 1; } @@ -77,6 +90,8 @@ public function getPolygon($index) } /** + * Polygons getter. + * * @return AbstractPolygon[] */ public function getPolygons() @@ -91,7 +106,9 @@ public function getPolygons() } /** - * @return string + * Type getter. + * + * @return string MultiPolygon */ public function getType() { @@ -99,7 +116,11 @@ public function getType() } /** - * @param AbstractPolygon[] $polygons + * Polygon setter. + * + * @param AbstractPolygon[] $polygons polygons to set + * + * @throws InvalidValueException when a polygon is invalid * * @return self */ @@ -111,6 +132,8 @@ public function setPolygons(array $polygons) } /** + * Convert Polygon into array. + * * @return array[] */ public function toArray() diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php b/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php index 9debf706..13386afd 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php @@ -41,15 +41,24 @@ abstract class AbstractPoint extends AbstractGeometry { /** + * The longitude. + * * @var float */ protected $x; /** + * The Latitude. + * * @var float */ protected $y; + /** + * AbstractPoint constructor. + * + * @throws InvalidValueException when point is invalid + */ public function __construct() { $argv = $this->validateArguments(func_get_args()); @@ -58,6 +67,8 @@ public function __construct() } /** + * Latitude getter. + * * @return float */ public function getLatitude() @@ -66,6 +77,8 @@ public function getLatitude() } /** + * Longitude getter. + * * @return float */ public function getLongitude() @@ -74,7 +87,9 @@ public function getLongitude() } /** - * @return string + * Type getter. + * + * @return string Point */ public function getType() { @@ -82,6 +97,8 @@ public function getType() } /** + * X getter. (Longitude getter). + * * @return float */ public function getX() @@ -90,6 +107,8 @@ public function getX() } /** + * Y getter. Latitude getter. + * * @return float */ public function getY() @@ -98,7 +117,11 @@ public function getY() } /** - * @param mixed $latitude + * Latitude fluent setter. + * + * @param mixed $latitude the new latitude of point + * + * @throws InvalidValueException when latitude is not valid * * @return self */ @@ -108,7 +131,11 @@ public function setLatitude($latitude) } /** - * @param mixed $longitude + * Longitude setter. + * + * @param mixed $longitude the new longitude + * + * @throws InvalidValueException when longitude is not valid * * @return self */ @@ -118,9 +145,11 @@ public function setLongitude($longitude) } /** - * @param mixed $x + * X setter. (Latitude setter). + * + * @param mixed $x the new X * - * @throws InvalidValueException + * @throws InvalidValueException when x is not valid * * @return self */ @@ -140,9 +169,11 @@ public function setX($x) } /** - * @param mixed $y + * Y setter. Longitude Setter. * - * @throws InvalidValueException + * @param mixed $y the new Y value + * + * @throws InvalidValueException when Y is invalid, not in valid range * * @return self */ @@ -162,6 +193,9 @@ public function setY($y) } /** + * Convert point into an array X, Y. + * Latitude, longitude. + * * @return array */ public function toArray() @@ -170,9 +204,13 @@ public function toArray() } /** - * @param int $x - * @param int $y - * @param int|null $srid + * Abstract point constructor. + * + * @param int $x X, latitude + * @param int $y Y, longitude + * @param int|null $srid Spatial Reference System Identifier + * + * @throws InvalidValueException if x or y are invalid */ protected function construct($x, $y, $srid = null) { @@ -183,9 +221,11 @@ protected function construct($x, $y, $srid = null) } /** - * @param array $argv + * Validate arguments. + * + * @param array $argv list of arguments * - * @throws InvalidValueException + * @throws InvalidValueException when an argument is not valid * * @return array */ @@ -210,7 +250,10 @@ protected function validateArguments(array $argv = null) } if (3 == $argc) { - if ((is_numeric($argv[0]) || is_string($argv[0])) && (is_numeric($argv[1]) || is_string($argv[1])) && (is_numeric($argv[2]) || null === $argv[2] || is_string($argv[2]))) { + if ((is_numeric($argv[0]) || is_string($argv[0])) + && (is_numeric($argv[1]) || is_string($argv[1])) + && (is_numeric($argv[2]) || null === $argv[2] || is_string($argv[2])) + ) { return $argv; } } @@ -223,6 +266,11 @@ protected function validateArguments(array $argv = null) } }); - throw new InvalidValueException(sprintf('Invalid parameters passed to %s::%s: %s', get_class($this), '__construct', implode(', ', $argv))); + throw new InvalidValueException(sprintf( + 'Invalid parameters passed to %s::%s: %s', + get_class($this), + '__construct', + implode(', ', $argv) + )); } } diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractPolygon.php b/lib/CrEOF/Spatial/PHP/Types/AbstractPolygon.php index 8db61cd8..14011d38 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractPolygon.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractPolygon.php @@ -24,6 +24,8 @@ namespace CrEOF\Spatial\PHP\Types; +use CrEOF\Spatial\Exception\InvalidValueException; + /** * Abstract Polygon object for POLYGON spatial types. * @@ -33,13 +35,19 @@ abstract class AbstractPolygon extends AbstractGeometry { /** + * Polygons are rings. + * * @var array[] */ protected $rings = []; /** - * @param AbstractLineString[]|array[] $rings - * @param int|null $srid + * Abstract polygon constructor. + * + * @param AbstractLineString[]|array[] $rings the polygons + * @param int|null $srid Spatial Reference System Identifier + * + * @throws InvalidValueException When a ring is invalid */ public function __construct(array $rings, $srid = null) { @@ -49,9 +57,11 @@ public function __construct(array $rings, $srid = null) } /** - * @param AbstractLineString|array[] $ring + * Add a polygon to geometry. + * + * @param AbstractLineString|array[] $ring Ring to add to geometry * - * @throws \CrEOF\Spatial\Exception\InvalidValueException + * @throws InvalidValueException when a ring is invalid * * @return self */ @@ -63,7 +73,9 @@ public function addRing($ring) } /** - * @param int $index + * Polygon getter. + * + * @param int $index index of polygon, use -1 to get last one * * @return AbstractLineString */ @@ -79,6 +91,8 @@ public function getRing($index) } /** + * Rings getter. + * * @return AbstractLineString[] */ public function getRings() @@ -93,7 +107,9 @@ public function getRings() } /** - * @return string + * Type getter. + * + * @return string Polygon */ public function getType() { @@ -101,7 +117,11 @@ public function getType() } /** - * @param AbstractLineString[] $rings + * Rings fluent setter. + * + * @param AbstractLineString[] $rings Rings to set + * + * @throws InvalidValueException when a ring is invalid * * @return self */ @@ -113,6 +133,8 @@ public function setRings(array $rings) } /** + * Converts rings to array. + * * @return array[] */ public function toArray() diff --git a/lib/CrEOF/Spatial/PHP/Types/Geography/GeographyInterface.php b/lib/CrEOF/Spatial/PHP/Types/Geography/GeographyInterface.php index d50d5aaa..661df77a 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geography/GeographyInterface.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geography/GeographyInterface.php @@ -35,17 +35,23 @@ interface GeographyInterface public const GEOGRAPHY = 'Geography'; /** + * Spatial Reference System Identifier getter. + * * @return int */ public function getSrid(); /** + * Type getter. + * * @return string */ public function getType(); /** - * @param int $srid + * Spatial Reference System Identifier setter. + * + * @param int $srid A Spatial Reference System Identifier (SRID) * * @return self */ diff --git a/lib/CrEOF/Spatial/PHP/Types/Geography/Point.php b/lib/CrEOF/Spatial/PHP/Types/Geography/Point.php index 75a88a3e..302e45c8 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geography/Point.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geography/Point.php @@ -39,9 +39,11 @@ class Point extends AbstractPoint implements GeographyInterface { /** - * @param mixed $x + * X setter. * - * @throws InvalidValueException + * @param mixed $x X coordinate + * + * @throws InvalidValueException when y is not in range of accepted value, or is totally invalid * * @return self */ @@ -67,9 +69,11 @@ public function setX($x) } /** - * @param mixed $y + * Y setter. + * + * @param mixed $y the Y coordinate * - * @throws InvalidValueException + * @throws InvalidValueException when y is not in range of accepted value, or is totally invalid * * @return self */ diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php index 6a47ee52..9993ca73 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php @@ -28,6 +28,7 @@ use CrEOF\Spatial\Tests\OrmMockTestCase; use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Types\Type; +use Doctrine\ORM\ORMException; use Doctrine\ORM\Tools\SchemaTool; use Doctrine\ORM\Tools\ToolsException; @@ -47,7 +48,8 @@ class PlatformTest extends OrmMockTestCase /** * Setup the test. * - * @throws DBALException This should not happen + * @throws DBALException When connection failed + * @throws ORMException when cache is not set */ public function setUp(): void { @@ -61,6 +63,8 @@ public function setUp(): void /** * Test non-supported platform. * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set * @throws ToolsException this should not happen */ public function testUnsupportedPlatform() diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php index 84e022c9..7a2de9b9 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php @@ -24,9 +24,15 @@ namespace CrEOF\Spatial\Tests\DBAL\Types\Geography; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geography\Point; use CrEOF\Spatial\Tests\Fixtures\GeoPointSridEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * Doctrine GeographyType tests. @@ -41,12 +47,28 @@ */ class GeoPointSridTest extends OrmTestCase { + /** + * Setup the test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::GEO_POINT_SRID_ENTITY); parent::setUp(); } + /** + * Test a null geography. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + */ public function testNullGeography() { $entity = new GeoPointSridEntity(); @@ -63,6 +85,16 @@ public function testNullGeography() $this->assertEquals($entity, $queryEntity); } + /** + * Test to store a geographic point. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws InvalidValueException when geometry contains an invalid value + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + */ public function testPointGeography() { $entity = new GeoPointSridEntity(); @@ -80,4 +112,6 @@ public function testPointGeography() $this->assertEquals($entity, $queryEntity); $this->assertEquals(4326, $queryEntity->getPoint()->getSrid()); } + + //TODO test to find all null GeoPointSridEntity } diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php index 0268bc23..b4425450 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\DBAL\Types\Geography; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geography\LineString; use CrEOF\Spatial\PHP\Types\Geography\Point; use CrEOF\Spatial\PHP\Types\Geography\Polygon; use CrEOF\Spatial\Tests\Fixtures\GeoPolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * PolygonType tests. @@ -43,12 +49,29 @@ */ class GeoPolygonTypeTest extends OrmTestCase { + /** + * Setup the test. + * + * @throws DBALException When connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::GEO_POLYGON_ENTITY); parent::setUp(); } + /** + * Test the find by polygon method. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws InvalidValueException when geometry contains an invalid value + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + */ public function testFindByPolygon() { $rings = [ @@ -67,11 +90,23 @@ public function testFindByPolygon() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $result = $this->getEntityManager()->getRepository(self::GEO_POLYGON_ENTITY)->findByPolygon(new Polygon($rings)); + $result = $this->getEntityManager() + ->getRepository(self::GEO_POLYGON_ENTITY) + ->findByPolygon(new Polygon($rings)) + ; $this->assertEquals($entity, $result[0]); } + /** + * Test to store an empty polygon. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + */ public function testNullPolygon() { $entity = new GeoPolygonEntity(); @@ -88,6 +123,16 @@ public function testNullPolygon() $this->assertEquals($entity, $queryEntity); } + /** + * Test to store a polygon ring. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws InvalidValueException when geometry contains an invalid value + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + */ public function testPolygonRing() { $rings = [ @@ -121,6 +166,16 @@ public function testPolygonRing() $this->assertEquals($entity, $queryEntity); } + /** + * Test to store a solid polygon. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws InvalidValueException when geometry contains an invalid value + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + */ public function testSolidPolygon() { $rings = [ diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php index 0efedc36..b363ed9c 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php @@ -24,6 +24,7 @@ namespace CrEOF\Spatial\Tests\DBAL\Types; +use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geography\LineString; use CrEOF\Spatial\PHP\Types\Geography\Point; @@ -34,7 +35,6 @@ use Doctrine\DBAL\DBALException; use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; -use PHPUnit\Framework\Error\Error; /** * Doctrine GeographyType tests. @@ -49,9 +49,9 @@ class GeographyTypeTest extends OrmTestCase /** * Setup the geography type test. * - * @throws UnsupportedPlatformException - * @throws DBALException - * @throws ORMException + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported */ protected function setUp(): void { @@ -63,11 +63,12 @@ protected function setUp(): void /** * Test to store and retrieve a geography composed by a linestring. * - * @throws DBALException - * @throws ORMException - * @throws UnsupportedPlatformException - * @throws MappingException - * @throws OptimisticLockException + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid */ public function testLineStringGeography() { @@ -83,11 +84,11 @@ public function testLineStringGeography() /** * Test to store and retrieve a null geography. * - * @throws DBALException - * @throws MappingException - * @throws ORMException - * @throws OptimisticLockException - * @throws UnsupportedPlatformException + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails */ public function testNullGeography() { @@ -98,11 +99,12 @@ public function testNullGeography() /** * Test to store and retrieve a geography composed by a single point. * - * @throws DBALException - * @throws MappingException - * @throws ORMException - * @throws OptimisticLockException - * @throws UnsupportedPlatformException + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid */ public function testPointGeography() { @@ -115,11 +117,12 @@ public function testPointGeography() /** * Test to store and retrieve a geography composed by a polygon. * - * @throws DBALException - * @throws MappingException - * @throws ORMException - * @throws OptimisticLockException - * @throws UnsupportedPlatformException + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid */ public function testPolygonGeography() { @@ -145,11 +148,11 @@ public function testPolygonGeography() * * @param GeographyEntity $entity Entity to test * - * @throws DBALException - * @throws MappingException - * @throws ORMException - * @throws OptimisticLockException - * @throws UnsupportedPlatformException + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails */ private function storeAndRetrieve(GeographyEntity $entity) { diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php index 0ef0e486..ec3e855d 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php @@ -24,10 +24,16 @@ namespace CrEOF\Spatial\Tests\DBAL\Types\Geometry; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * Doctrine LineStringType tests. @@ -42,12 +48,27 @@ */ class LineStringTypeTest extends OrmTestCase { + /** + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); parent::setUp(); } + /** + * Test to store and find a line string in table. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + */ public function testFindByLineString() { $lineString = new LineString( @@ -65,11 +86,24 @@ public function testFindByLineString() $this->getEntityManager()->clear(); - $result = $this->getEntityManager()->getRepository(self::LINESTRING_ENTITY)->findByLineString($lineString); + $result = $this->getEntityManager() + ->getRepository(self::LINESTRING_ENTITY) + ->findByLineString($lineString) + ; $this->assertEquals($entity, $result[0]); } + /** + * Test to store and find it by id. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + */ public function testLineString() { $lineString = new LineString( @@ -94,6 +128,15 @@ public function testLineString() $this->assertEquals($entity, $queryEntity); } + /** + * Test to store a null line string, then to find it with its id. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + */ public function testNullLineStringType() { $entity = new LineStringEntity(); @@ -109,4 +152,6 @@ public function testNullLineStringType() $this->assertEquals($entity, $queryEntity); } + + //TODO test to find all null linestring } diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php index 5889743d..bd800872 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php @@ -24,12 +24,18 @@ namespace CrEOF\Spatial\Tests\DBAL\Types\Geometry; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\MultiPolygon; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\MultiPolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * MultiPolygonType tests. @@ -44,12 +50,29 @@ */ class MultiPolygonTypeTest extends OrmTestCase { + /** + * Setup the test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::MULTIPOLYGON_ENTITY); parent::setUp(); } + /** + * Test to store and find it its by geometry. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + */ public function testFindByMultiPolygon() { $polygons = [ @@ -87,11 +110,24 @@ public function testFindByMultiPolygon() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $result = $this->getEntityManager()->getRepository(self::MULTIPOLYGON_ENTITY)->findByMultiPolygon(new MultiPolygon($polygons)); + $result = $this->getEntityManager() + ->getRepository(self::MULTIPOLYGON_ENTITY) + ->findByMultiPolygon(new MultiPolygon($polygons)) + ; $this->assertEquals($entity, $result[0]); } + /** + * Test to store and find it by id. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + */ public function testMultiPolygon() { $polygons = [ @@ -137,6 +173,15 @@ public function testMultiPolygon() $this->assertEquals($entity, $queryEntity); } + /** + * Test to store a null multipolygon and find it by id. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + */ public function testNullMultiPolygon() { $entity = new MultiPolygonEntity(); @@ -152,4 +197,6 @@ public function testNullMultiPolygon() $this->assertEquals($entity, $queryEntity); } + + //TODO Try to find a null multiploygon } diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php index 323f46ed..09df3f42 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php @@ -24,9 +24,15 @@ namespace CrEOF\Spatial\Tests\DBAL\Types\Geometry; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\PointEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * Doctrine PointType tests. @@ -41,12 +47,29 @@ */ class PointTypeTest extends OrmTestCase { + /** + * Setup the test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POINT_ENTITY); parent::setUp(); } + /** + * Test to store a point and find it by its geometric. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + */ public function testFindByPoint() { $point = new Point(1, 1); @@ -63,6 +86,15 @@ public function testFindByPoint() $this->assertEquals($entity, $result[0]); } + /** + * Test to store a null point and find it by its id. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + */ public function testNullPoint() { $entity = new PointEntity(); @@ -79,6 +111,16 @@ public function testNullPoint() $this->assertEquals($entity, $queryEntity); } + /** + * Test to store a point and find it by its id. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + */ public function testPoint() { $point = new Point(1, 1); @@ -96,4 +138,6 @@ public function testPoint() $this->assertEquals($entity, $queryEntity); } + + //TODO test to find a null geometry } diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php index 4a99c165..c10689e4 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\DBAL\Types\Geometry; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * PolygonType tests. @@ -43,12 +49,29 @@ */ class PolygonTypeTest extends OrmTestCase { + /** + * Setup the test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); parent::setUp(); } + /** + * Test to store a polygon and find it by its geometric. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + */ public function testFindByPolygon() { $rings = [ @@ -72,6 +95,15 @@ public function testFindByPolygon() $this->assertEquals($entity, $result[0]); } + /** + * Test to store a null polygon and find it by its id. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + */ public function testNullPolygon() { $entity = new PolygonEntity(); @@ -88,6 +120,16 @@ public function testNullPolygon() $this->assertEquals($entity, $queryEntity); } + /** + * Test to store a polygon ring and find it by its id. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + */ public function testPolygonRing() { $rings = [ @@ -121,6 +163,16 @@ public function testPolygonRing() $this->assertEquals($entity, $queryEntity); } + /** + * Test to store a solid polygon and find it by its id. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + */ public function testSolidPolygon() { $rings = [ diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php index bbf83b9d..e869ff5e 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php @@ -24,12 +24,18 @@ namespace CrEOF\Spatial\Tests\DBAL\Types; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\GeometryEntity; use CrEOF\Spatial\Tests\Fixtures\NoHintGeometryEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * Doctrine GeometryType tests. @@ -44,6 +50,13 @@ */ class GeometryTypeTest extends OrmTestCase { + /** + * Setup the geography type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::GEOMETRY_ENTITY); @@ -51,9 +64,17 @@ protected function setUp(): void parent::setUp(); } + /** + * When I store a bad geometry an Invalid value exception shall be thrown. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws OptimisticLockException when clear fails + */ public function testBadGeometryValue() { - $this->expectException(\CrEOF\Spatial\Exception\InvalidValueException::class); + $this->expectException(InvalidValueException::class); $this->expectExceptionMessage('Geometry column values must implement GeometryInterface'); $entity = new NoHintGeometryEntity(); @@ -63,16 +84,24 @@ public function testBadGeometryValue() $this->getEntityManager()->flush(); } + /** + * Test to store a line string geometry and retrieve it by its identifier. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + */ public function testLineStringGeometry() { $entity = new GeometryEntity(); - $entity->setGeometry(new LineString( - [ - new Point(0, 0), - new Point(1, 1), - ]) - ); + $entity->setGeometry(new LineString([ + new Point(0, 0), + new Point(1, 1), + ])); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush(); @@ -85,6 +114,15 @@ public function testLineStringGeometry() $this->assertEquals($entity, $queryEntity); } + /** + * Test to store a null geometry and retrieve it by its identifier. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + */ public function testNullGeometry() { $entity = new GeometryEntity(); @@ -101,6 +139,16 @@ public function testNullGeometry() $this->assertEquals($entity, $queryEntity); } + /** + * Test to store a point geometry and retrieve it by its identifier. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + */ public function testPointGeometry() { $entity = new GeometryEntity(); @@ -119,6 +167,15 @@ public function testPointGeometry() } /** + * Test to store a point geometry with its SRID and retrieve it by its identifier. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group srid */ public function testPointGeometryWithSrid() @@ -141,6 +198,15 @@ public function testPointGeometryWithSrid() } /** + * Test to store a point geometry without SRID and retrieve it by its identifier. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group srid */ public function testPointGeometryWithZeroSrid() @@ -162,6 +228,16 @@ public function testPointGeometryWithZeroSrid() $this->assertEquals($entity, $queryEntity); } + /** + * Test to store a polygon geometry and retrieve it by its identifier. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + */ public function testPolygonGeometry() { $entity = new GeometryEntity(); diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php index 2d41c55e..b6e3baab 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php @@ -24,8 +24,12 @@ namespace CrEOF\Spatial\Tests\DBAL\Types; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Types\Type; +use Doctrine\ORM\Mapping\ClassMetadata; +use Doctrine\ORM\ORMException; /** * Doctrine schema related tests. @@ -38,6 +42,13 @@ */ class SchemaTest extends OrmTestCase { + /** + * Setup the geography type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::GEOMETRY_ENTITY); @@ -56,6 +67,13 @@ protected function setUp(): void parent::setUp(); } + /** + * Test doctrine type mapping. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ public function testDoctrineTypeMapping() { $platform = $this->getPlatform(); @@ -75,6 +93,13 @@ public function testDoctrineTypeMapping() } } + /** + * Testto reverse shema mapping. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ public function testSchemaReverseMapping() { $result = $this->getSchemaTool()->getUpdateSchemaSql($this->getAllClassMetadata(), true); @@ -83,7 +108,13 @@ public function testSchemaReverseMapping() } /** - * @return \Doctrine\ORM\Mapping\ClassMetadata[] + * All class metadata getter. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * + * @return ClassMetadata[] */ private function getAllClassMetadata() { diff --git a/tests/CrEOF/Spatial/Tests/FileSQLLogger.php b/tests/CrEOF/Spatial/Tests/FileSQLLogger.php index f8f03b33..5f833f81 100644 --- a/tests/CrEOF/Spatial/Tests/FileSQLLogger.php +++ b/tests/CrEOF/Spatial/Tests/FileSQLLogger.php @@ -31,10 +31,17 @@ */ class FileSQLLogger implements SQLLogger { + /** + * Filename. + * + * @var string + */ protected $filename; /** - * @param string $filename + * FileSQLLogger constructor. + * + * @param string $filename the filename */ public function __construct($filename) { @@ -42,7 +49,11 @@ public function __construct($filename) } /** - * {@inheritdoc} + * Logs a SQL statement somewhere. + * + * @param string $sql the SQL to be executed + * @param mixed[]|null $params the SQL parameters + * @param int[]|string[]|null $types the SQL parameter types */ public function startQuery($sql, array $params = null, array $types = null) { @@ -58,7 +69,7 @@ public function startQuery($sql, array $params = null, array $types = null) } /** - * {@inheritdoc} + * Marks the last started query as stopped. This can be used for timing of queries. */ public function stopQuery() { diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/GeoLineStringEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/GeoLineStringEntity.php index 16907888..78bd8402 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/GeoLineStringEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/GeoLineStringEntity.php @@ -81,6 +81,8 @@ public function getLineString() /** * Set lineString. * + * @param LineString $lineString Linestring to set + * * @return self */ public function setLineString(LineString $lineString) diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/GeoPointSridEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/GeoPointSridEntity.php index 3392020c..d3671f6e 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/GeoPointSridEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/GeoPointSridEntity.php @@ -79,6 +79,8 @@ public function getPoint() /** * Set geography. * + * @param Point $point point to set + * * @return self */ public function setPoint(Point $point) diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/GeoPolygonEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/GeoPolygonEntity.php index ea66a6ed..986cda83 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/GeoPolygonEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/GeoPolygonEntity.php @@ -81,6 +81,8 @@ public function getPolygon() /** * Set polygon. * + * @param Polygon $polygon polygon to set + * * @return self */ public function setPolygon(Polygon $polygon) diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/GeographyEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/GeographyEntity.php index c5b13cbb..c44506a6 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/GeographyEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/GeographyEntity.php @@ -46,6 +46,7 @@ class GeographyEntity * @Column(type="geography", nullable=true) */ protected $geography; + /** * @var int * @@ -78,6 +79,8 @@ public function getId() /** * Set geography. * + * @param GeographyInterface $geography Geography to set + * * @return self */ public function setGeography(GeographyInterface $geography) diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/GeometryEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/GeometryEntity.php index 30c9b77d..8af2938d 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/GeometryEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/GeometryEntity.php @@ -48,6 +48,7 @@ class GeometryEntity * @Column(type="geometry", nullable=true) */ protected $geometry; + /** * @var int * @@ -80,6 +81,8 @@ public function getId() /** * Set geometry. * + * @param GeometryInterface $geometry geometry to set + * * @return self */ public function setGeometry(GeometryInterface $geometry) diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/LineStringEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/LineStringEntity.php index 1ad21c17..ac0094d4 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/LineStringEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/LineStringEntity.php @@ -81,6 +81,8 @@ public function getLineString() /** * Set lineString. * + * @param LineString $lineString linestring to set + * * @return self */ public function setLineString(LineString $lineString) diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/MultiPolygonEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/MultiPolygonEntity.php index adca307a..81551f73 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/MultiPolygonEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/MultiPolygonEntity.php @@ -81,6 +81,8 @@ public function getMultiPolygon() /** * Set multipolygon. * + * @param MultiPolygon $multiPolygon multipolygon to set + * * @return self */ public function setMultiPolygon(MultiPolygon $multiPolygon) diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/NoHintGeometryEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/NoHintGeometryEntity.php index 05273261..7b49b757 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/NoHintGeometryEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/NoHintGeometryEntity.php @@ -47,6 +47,7 @@ class NoHintGeometryEntity * @Column(type="geometry", nullable=true) */ protected $geometry; + /** * @var int * @@ -79,7 +80,7 @@ public function getId() /** * Set geometry. * - * @param mixed $geometry + * @param mixed $geometry the geometry to set * * @return self */ diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/PointEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/PointEntity.php index b9743bad..a593131d 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/PointEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/PointEntity.php @@ -81,6 +81,8 @@ public function getPoint() /** * Set point. * + * @param Point $point point to set + * * @return self */ public function setPoint(Point $point) diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/PolygonEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/PolygonEntity.php index 30d8305e..86d2c51e 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/PolygonEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/PolygonEntity.php @@ -81,6 +81,8 @@ public function getPolygon() /** * Set polygon. * + * @param Polygon $polygon polygon to set + * * @return self */ public function setPolygon(Polygon $polygon) diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php index 20ff0a36..c64405ec 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\MySql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * Area DQL function tests. @@ -43,6 +49,13 @@ */ class AreaTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); @@ -52,6 +65,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testAreaWhere() @@ -130,6 +152,15 @@ public function testAreaWhere() } /** + * Test a DQL containing function to test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectArea() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php index e1af2679..f80cc675 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php @@ -24,12 +24,15 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\MySql; +use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; use CrEOF\Spatial\Tests\OrmTestCase; use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** @@ -46,9 +49,11 @@ class AsBinaryTest extends OrmTestCase { /** - * Setup the test. + * Setup the function type test. * - * @throws UnsupportedPlatformException this should not happen + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported */ protected function setUp(): void { @@ -59,12 +64,14 @@ protected function setUp(): void } /** - * Test to convert as binary. + * Test a DQL containing function to test. * - * @group geometry - * - * @throws ORMException this should not happen - * @throws MappingException this should not happen + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid */ public function testAsBinary() { diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php index cb19e9d0..b2e08dbc 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php @@ -24,10 +24,16 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\MySql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * AsText DQL function tests. @@ -42,6 +48,13 @@ */ class AsTextTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); @@ -51,6 +64,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testAsText() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php index a8da91ca..b60e321d 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\MySql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * Contains DQL function tests. @@ -43,6 +49,13 @@ */ class ContainsTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); @@ -53,6 +66,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testContainsWhereParameter() @@ -106,6 +128,15 @@ public function testContainsWhereParameter() } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectContains() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php index 4cfef864..aad1387d 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\MySql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * Disjoint DQL function tests. @@ -43,6 +49,13 @@ */ class DisjointTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); @@ -52,6 +65,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testDisjointWhereParameter() @@ -118,6 +140,15 @@ public function testDisjointWhereParameter() } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectDisjoint() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php index 661471f3..ad479484 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\MySql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * Envelope DQL function tests. @@ -43,6 +49,13 @@ */ class EnvelopeTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); @@ -52,6 +65,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testEnvelopeWhereParameter() @@ -104,6 +126,15 @@ public function testEnvelopeWhereParameter() } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectEnvelope() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php index 895a0250..e7c254d5 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php @@ -24,10 +24,16 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\MySql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * GLength DQL function tests. @@ -42,6 +48,13 @@ */ class GLengthTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); @@ -51,6 +64,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testGLengthWhereParameter() @@ -78,6 +100,15 @@ public function testGLengthWhereParameter() } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectGLength() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php index 54808baf..64d329d7 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php @@ -24,10 +24,16 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\MySql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\GeometryEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * GeomFromText DQL function tests. @@ -42,6 +48,13 @@ */ class GeomFromTextTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::GEOMETRY_ENTITY); @@ -52,6 +65,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test with a linestring. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testLineString() @@ -80,6 +102,15 @@ public function testLineString() } /** + * Test a DQL containing function to test with a point. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testPoint() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php index 6d2a8bcb..301bf369 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\MySql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * MBRContains DQL function tests. @@ -43,6 +49,13 @@ */ class MBRContainsTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); @@ -53,6 +66,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testMBRContainsWhereParameter() @@ -106,6 +128,15 @@ public function testMBRContainsWhereParameter() } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectMBRContains() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php index bf6c0d93..305da25c 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\MySql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * MBRDisjoint DQL function tests. @@ -43,6 +49,13 @@ */ class MBRDisjointTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); @@ -52,6 +65,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testMBRDisjointWhereParameter() @@ -118,6 +140,15 @@ public function testMBRDisjointWhereParameter() } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectMBRDisjoint() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php index 87de755f..bd827490 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php @@ -24,10 +24,16 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\MySql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * StartPoint DQL function tests. @@ -42,6 +48,13 @@ */ class StartPointTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); @@ -52,6 +65,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testStartPointSelect() @@ -76,6 +98,15 @@ public function testStartPointSelect() } /** + * Test a DQL containing function to test in the predicate with a line string. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testStartPointWhereCompareLineString() @@ -113,6 +144,15 @@ public function testStartPointWhereCompareLineString() } /** + * Test a DQL containing function to test in the predicate with a point. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testStartPointWhereComparePoint() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php index 625ee8ff..b53d3910 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php @@ -24,9 +24,15 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\PointEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * Geometry DQL function tests. @@ -41,6 +47,13 @@ */ class GeometryTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POINT_ENTITY); @@ -50,6 +63,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectGeometry() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php index 7455e07f..87ae1924 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_Area DQL function tests. @@ -43,6 +49,13 @@ */ class STAreaTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); @@ -52,6 +65,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTArea() @@ -132,6 +154,15 @@ public function testSelectSTArea() } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSTAreaWhere() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php index bc7c9ce1..a2340e79 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php @@ -24,10 +24,16 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_AsBinary DQL function tests. @@ -42,6 +48,13 @@ */ class STAsBinaryTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); @@ -51,6 +64,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSTAsBinary() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php index d963a7dc..c35385df 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php @@ -24,10 +24,16 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_AsText DQL function tests. @@ -42,6 +48,13 @@ */ class STAsTextTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); @@ -51,6 +64,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSTAsText() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php index 3c2643f5..e5de302a 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_CoveredBy DQL function tests. @@ -43,6 +49,13 @@ */ class STCentroidTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); @@ -52,6 +65,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTCentroid() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php index 76c15b87..42eba2fa 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_ClosestPoint DQL function tests. @@ -43,6 +49,13 @@ */ class STClosestPointTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); @@ -53,6 +66,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTClosestPoint() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php index 7d10bdaa..43ac293b 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php @@ -24,9 +24,15 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\PointEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_Collect DQL function tests. @@ -41,6 +47,13 @@ */ class STCollectTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POINT_ENTITY); @@ -50,6 +63,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTCollect() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php index 7af391a2..76db9f54 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_ContainsProperly DQL function tests. @@ -43,6 +49,13 @@ */ class STContainsProperlyTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); @@ -52,6 +65,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTContainsProperly() @@ -96,6 +118,15 @@ public function testSelectSTContainsProperly() } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSTContainsProperlyWhereParameter() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php index f63ec033..19f79d8f 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_Contains DQL function tests. @@ -43,6 +49,13 @@ */ class STContainsTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); @@ -53,6 +66,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTContains() @@ -97,6 +119,15 @@ public function testSelectSTContains() } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSTContainsWhereParameter() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php index 996d5bd9..cf4465c8 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_CoveredBy DQL function tests. @@ -43,6 +49,13 @@ */ class STCoveredByTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); @@ -52,6 +65,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTCoveredBy() @@ -96,6 +118,15 @@ public function testSelectSTCoveredBy() } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSTCoveredByWhereParameter() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php index 6ba22ed5..d3b76788 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_Covers DQL function tests. @@ -43,6 +49,13 @@ */ class STCoversTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); @@ -52,6 +65,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTCovers() @@ -96,6 +118,15 @@ public function testSelectSTCovers() } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSTCoversWhereParameter() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php index b2b1f62f..756ccbe6 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php @@ -24,10 +24,16 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_Crosses DQL function tests. @@ -42,6 +48,13 @@ */ class STCrossesTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); @@ -51,6 +64,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTCrosses() @@ -101,6 +123,15 @@ public function testSelectSTCrosses() } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSTCrossesWhereParameter() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php index e8abf4b9..6e4935cb 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_Disjoint DQL function tests. @@ -43,6 +49,13 @@ */ class STDisjointTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); @@ -52,6 +65,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTDisjoint() @@ -112,6 +134,15 @@ public function testSelectSTDisjoint() } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSTDisjointWhereParameter() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php index ed3fbb13..41cbd392 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php @@ -24,9 +24,15 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\PointEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_Distance_Sphere DQL function tests. @@ -41,6 +47,13 @@ */ class STDistanceSphereTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POINT_ENTITY); @@ -50,6 +63,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTDistanceSphereGeometry() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php index 53b99a8c..d3ef57b7 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geography\Point as GeographyPoint; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\GeographyEntity; use CrEOF\Spatial\Tests\Fixtures\PointEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_Distance DQL function tests. @@ -43,6 +49,13 @@ */ class STDistanceTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POINT_ENTITY); @@ -54,6 +67,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geography */ public function testSelectSTDistanceGeographyCartesian() @@ -95,6 +117,15 @@ public function testSelectSTDistanceGeographyCartesian() } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geography */ public function testSelectSTDistanceGeographySpheroid() @@ -136,6 +167,15 @@ public function testSelectSTDistanceGeographySpheroid() } /** + * Test a DQL containing function to test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTDistanceGeometryCartesian() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php index 2afac371..2b63e3e8 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_Envelope DQL function tests. @@ -43,6 +49,13 @@ */ class STEnvelopeTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); @@ -52,6 +65,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTEnvelope() @@ -101,6 +123,15 @@ public function testSelectSTEnvelope() } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSTEnvelopeWhereParameter() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php index 8a079f02..b5c3ecad 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php @@ -24,10 +24,16 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\GeometryEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_GeomFromText DQL function tests. @@ -42,6 +48,13 @@ */ class STGeomFromTextTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::GEOMETRY_ENTITY); @@ -51,6 +64,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select with a linestring. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testLineString() @@ -79,6 +101,15 @@ public function testLineString() } /** + * Test a DQL containing function to test in the select with a point. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testPoint() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php index 6db46e50..2ef9344c 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php @@ -24,10 +24,16 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_Length DQL function tests. @@ -42,6 +48,13 @@ */ class STLengthTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); @@ -51,6 +64,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTLength() @@ -78,6 +100,15 @@ public function testSelectSTLength() } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSTLengthWhereParameter() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php index a3b3ba5b..92359512 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php @@ -24,10 +24,16 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_LineCrossingDirection DQL function tests. @@ -42,6 +48,13 @@ */ class STLineCrossingDirectionTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); @@ -51,6 +64,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTLineCrossingDirection() @@ -104,6 +126,15 @@ public function testSelectSTLineCrossingDirection() } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSTLineCrossingDirectionWhereParameter() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php index 5fd97788..ea9b55dd 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_MakeEnvelope DQL function tests. @@ -43,6 +49,13 @@ */ class STMakeEnvelopeTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); @@ -52,6 +65,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTMakeEnvelope() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php index 868134d6..ded05665 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php @@ -24,11 +24,17 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_Overlaps DQL function tests. @@ -43,6 +49,13 @@ */ class STOverlapsTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POLYGON_ENTITY); @@ -52,6 +65,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTMakeEnvelope() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php index 186c23b9..90935469 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php @@ -24,9 +24,15 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\PointEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_SnapToGrid DQL function tests. @@ -41,6 +47,13 @@ */ class STSnapToGridTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::POINT_ENTITY); @@ -50,6 +63,15 @@ protected function setUp(): void } /** + * Test a DQL containing function with 2 paramaters to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTSnapToGridSignature2Parameters() @@ -72,6 +94,15 @@ public function testSelectSTSnapToGridSignature2Parameters() } /** + * Test a DQL containing function with three parameters to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTSnapToGridSignature3Parameters() @@ -94,6 +125,15 @@ public function testSelectSTSnapToGridSignature3Parameters() } /** + * Test a DQL containing function with five parameters to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTSnapToGridSignature5Parameters() @@ -116,6 +156,15 @@ public function testSelectSTSnapToGridSignature5Parameters() } /** + * Test a DQL containing function with six paramters to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTSnapToGridSignature6Parameters() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php index b8ec707f..6eb5bbdc 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php @@ -24,10 +24,16 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_StartPoint DQL function tests. @@ -42,6 +48,13 @@ */ class STStartPointTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); @@ -51,6 +64,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSTStartPointSelect() @@ -75,6 +97,15 @@ public function testSTStartPointSelect() } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSTStartPointWhereCompareLineString() @@ -112,6 +143,15 @@ public function testSTStartPointWhereCompareLineString() } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSTStartPointWhereComparePoint() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php index 8cf22c74..1b5a5f9c 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php @@ -24,6 +24,8 @@ namespace CrEOF\Spatial\Tests\ORM\Query\AST\Functions\PostgreSql; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geography\LineString as GeographyLineString; use CrEOF\Spatial\PHP\Types\Geography\Point as GeographyPoint; use CrEOF\Spatial\PHP\Types\Geography\Polygon as GeographyPolygon; @@ -33,6 +35,10 @@ use CrEOF\Spatial\Tests\Fixtures\GeographyEntity; use CrEOF\Spatial\Tests\Fixtures\GeometryEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; /** * ST_Summary DQL function tests. @@ -47,6 +53,13 @@ */ class STSummaryTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::GEOMETRY_ENTITY); @@ -57,6 +70,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the select with a geography. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geography */ public function testSelectSTSummaryGeography() @@ -110,6 +132,15 @@ public function testSelectSTSummaryGeography() } /** + * Test a DQL containing function to test in the select with a geometry. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testSelectSTSummaryGeometry() diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php index 42430afc..a03b9474 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php @@ -24,6 +24,7 @@ namespace CrEOF\Spatial\Tests\ORM\Query; +use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; @@ -31,7 +32,11 @@ use CrEOF\Spatial\Tests\Fixtures\GeometryEntity; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Types\Type; +use Doctrine\ORM\OptimisticLockException; +use Doctrine\ORM\ORMException; use Doctrine\ORM\Version; /** @@ -47,6 +52,13 @@ */ class WrappingTest extends OrmTestCase { + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::GEOMETRY_ENTITY); @@ -55,6 +67,15 @@ protected function setUp(): void } /** + * Test a DQL containing function to test in the predicate. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws MappingException when mapping + * @throws OptimisticLockException when clear fails + * @throws InvalidValueException when geometries are not valid + * * @group geometry */ public function testTypeWrappingSelect() @@ -83,7 +104,11 @@ public function testTypeWrappingSelect() $function = 'Contains'; break; default: - throw new UnsupportedPlatformException(sprintf('DBAL platform "%s" is not currently supported.', $this->getPlatform()->getName())); + //TODO create a static function to throw exception. + throw new UnsupportedPlatformException(sprintf( + 'DBAL platform "%s" is not currently supported.', + $this->getPlatform()->getName() + )); } $dql = sprintf($dql, $function); diff --git a/tests/CrEOF/Spatial/Tests/OrmMockTestCase.php b/tests/CrEOF/Spatial/Tests/OrmMockTestCase.php index 85ae3e28..6a9b17a4 100644 --- a/tests/CrEOF/Spatial/Tests/OrmMockTestCase.php +++ b/tests/CrEOF/Spatial/Tests/OrmMockTestCase.php @@ -49,7 +49,7 @@ abstract class OrmMockTestCase extends TestCase * Setup the mocked entity manager. * * @throws DBALException when connection is not successful - * @throws ORMException when + * @throws ORMException when cache is not set */ protected function setUp(): void { @@ -59,9 +59,9 @@ protected function setUp(): void /** * Return the mocked connection. * - * @return Connection + * @throws DBALException when connection is not successful * - * @throws DBALException This should not happen because connection is mocked + * @return Connection */ protected function getMockConnection() { @@ -88,10 +88,10 @@ protected function getMockConnection() /** * Get the mocked entity manager. * - * @return EntityManagerInterface a mocked entity manager + * @throws DBALException When connection is not successful + * @throws ORMException won't happen because Metadata cache is set * - * @throws DBALException When connection is not successfule - * @throws ORMException when + * @return EntityManagerInterface a mocked entity manager */ protected function getMockEntityManager() { diff --git a/tests/CrEOF/Spatial/Tests/OrmTestCase.php b/tests/CrEOF/Spatial/Tests/OrmTestCase.php index 2253a6dd..420bf4ea 100644 --- a/tests/CrEOF/Spatial/Tests/OrmTestCase.php +++ b/tests/CrEOF/Spatial/Tests/OrmTestCase.php @@ -170,7 +170,7 @@ abstract class OrmTestCase extends TestCase * Setup connection before class creation. * * @throws UnsupportedPlatformException this happen when platform is not mysql or postgresql - * @throws DBALException this can happen when database or credentials are not set + * @throws DBALException when connection is not successful */ public static function setUpBeforeClass(): void { @@ -257,10 +257,13 @@ protected static function getCommonConnectionParameters() return $connectionParams; } + // phpcs:disable Squiz.Commenting.FunctionCommentThrowTag.WrongNumber + // phpcs miss the DBALException /** * Establish the connection if it is not already done, then returns it. * - * @throws UnsupportedPlatformException this should not happen + * @throws DBALException when connection is not successful + * @throws UnsupportedPlatformException when platform is unsupported * * @return Connection */ @@ -287,11 +290,12 @@ protected static function getConnection() return $connection; } + // phpcs:enable /** * Return connection parameters. * - * @throws DBALException this can happen when database or credentials are not set + * @throws DBALException when connection is not successful * * @return array */ @@ -326,9 +330,9 @@ protected function getCurrentQueryCount() /** * Return the entity manager. * - * @throws DBALException this can happen when database or credentials are not set - * @throws ORMException this can happen when database or credentials are not set - * @throws UnsupportedPlatformException this should not happen + * @throws DBALException when connection is not successful + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported * * @return EntityManager */ @@ -401,7 +405,7 @@ protected function getUsedEntityClasses() * * @param Throwable $throwable the exception * - * @throws Exception The exception provided by parameter. + * @throws Exception the exception provided by parameter */ protected function onNotSuccessfulTest(Throwable $throwable): void { @@ -459,8 +463,8 @@ protected function onNotSuccessfulTest(Throwable $throwable): void * Create entities used by tests. * * @throws DBALException when connection is not successful - * @throws ORMException when - * @throws UnsupportedPlatformException when platform is not supported + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported * @throws ToolsException when schema cannot be created */ protected function setUpEntities() @@ -484,7 +488,7 @@ protected function setUpEntities() * * @throws DBALException when connection is not successful * @throws ORMException when - * @throws UnsupportedPlatformException when platform is not supported + * @throws UnsupportedPlatformException when platform is unsupported */ protected function setUpFunctions() { @@ -543,7 +547,7 @@ protected function setUpFunctions() * Add types used by test to DBAL. * * @throws DBALException when credential or connection failed - * @throws UnsupportedPlatformException when platform is not supported + * @throws UnsupportedPlatformException when platform is unsupported */ protected function setUpTypes() { From 6c8a6096606a1602f39497b70202d0b28e2d0288 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sun, 23 Feb 2020 20:30:25 +0100 Subject: [PATCH 24/44] Test simplified --- .../Query/AST/Functions/MySql/AreaTest.php | 84 ++++++++++--------- .../Query/AST/Functions/MySql/AsTextTest.php | 41 ++++++--- .../AST/Functions/MySql/ContainsTest.php | 65 +++++++------- 3 files changed, 110 insertions(+), 80 deletions(-) diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php index c64405ec..32a6f37a 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php @@ -78,8 +78,7 @@ protected function setUp(): void */ public function testAreaWhere() { - $entity1 = new PolygonEntity(); - $rings1 = [ + $ring = [ new LineString([ new Point(0, 0), new Point(10, 0), @@ -89,11 +88,9 @@ public function testAreaWhere() ]), ]; - $entity1->setPolygon(new Polygon($rings1)); - $this->getEntityManager()->persist($entity1); + $this->createPolygon($ring); - $entity2 = new PolygonEntity(); - $rings2 = [ + $ring = [ new LineString([ new Point(0, 0), new Point(10, 0), @@ -109,12 +106,9 @@ public function testAreaWhere() new Point(5, 5), ]), ]; + $this->createPolygon($ring); - $entity2->setPolygon(new Polygon($rings2)); - $this->getEntityManager()->persist($entity2); - - $entity3 = new PolygonEntity(); - $rings3 = [ + $ring = [ new LineString([ new Point(0, 0), new Point(10, 0), @@ -124,12 +118,9 @@ public function testAreaWhere() new Point(0, 0), ]), ]; + $this->createPolygon($ring); - $entity3->setPolygon(new Polygon($rings3)); - $this->getEntityManager()->persist($entity3); - - $entity4 = new PolygonEntity(); - $rings4 = [ + $ring = [ new LineString([ new Point(5, 5), new Point(7, 5), @@ -139,16 +130,17 @@ public function testAreaWhere() ]), ]; - $entity4->setPolygon(new Polygon($rings4)); - $this->getEntityManager()->persist($entity4); + $expected = $this->createPolygon($ring); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Area(p.polygon) < 50'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Area(p.polygon) < 50' + ); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity4, $result[0]); + $this->assertEquals($expected, $result[0]); } /** @@ -165,8 +157,7 @@ public function testAreaWhere() */ public function testSelectArea() { - $entity1 = new PolygonEntity(); - $rings1 = [ + $ring = [ new LineString([ new Point(0, 0), new Point(10, 0), @@ -175,12 +166,9 @@ public function testSelectArea() new Point(0, 0), ]), ]; + $this->createPolygon($ring); - $entity1->setPolygon(new Polygon($rings1)); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - $rings2 = [ + $ring = [ new LineString([ new Point(0, 0), new Point(10, 0), @@ -196,12 +184,9 @@ public function testSelectArea() new Point(5, 5), ]), ]; + $this->createPolygon($ring); - $entity2->setPolygon(new Polygon($rings2)); - $this->getEntityManager()->persist($entity2); - - $entity3 = new PolygonEntity(); - $rings3 = [ + $ring = [ new LineString([ new Point(0, 0), new Point(10, 0), @@ -211,12 +196,9 @@ public function testSelectArea() new Point(0, 0), ]), ]; + $this->createPolygon($ring); - $entity3->setPolygon(new Polygon($rings3)); - $this->getEntityManager()->persist($entity3); - - $entity4 = new PolygonEntity(); - $rings4 = [ + $ring = [ new LineString([ new Point(5, 5), new Point(7, 5), @@ -225,13 +207,14 @@ public function testSelectArea() new Point(5, 5), ]), ]; + $this->createPolygon($ring); - $entity4->setPolygon(new Polygon($rings4)); - $this->getEntityManager()->persist($entity4); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT Area(p.polygon) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT Area(p.polygon) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + ); $result = $query->getResult(); $this->assertEquals(100, $result[0][1]); @@ -239,4 +222,25 @@ public function testSelectArea() $this->assertEquals(100, $result[2][1]); $this->assertEquals(4, $result[3][1]); } + + /** + * Create and persist a polygon from a ring. + * + * @param array $ring The ring to create polygon + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws InvalidValueException when geometries are not valid + * + * @return PolygonEntity + */ + private function createPolygon(array $ring) + { + $polygonEntity = new PolygonEntity(); + $polygonEntity->setPolygon(new Polygon($ring)); + $this->getEntityManager()->persist($polygonEntity); + + return $polygonEntity; + } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php index b2e08dbc..61756568 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php @@ -77,32 +77,51 @@ protected function setUp(): void */ public function testAsText() { - $lineString1 = [ + $points = [ new Point(0, 0), new Point(2, 2), new Point(5, 5), ]; - $lineString2 = [ + $this->createLinestring($points); + + $points = [ new Point(3, 3), new Point(4, 15), new Point(5, 22), ]; - $entity1 = new LineStringEntity(); - - $entity1->setLineString(new LineString($lineString1)); - $this->getEntityManager()->persist($entity1); - - $entity2 = new LineStringEntity(); + $this->createLinestring($points); - $entity2->setLineString(new LineString($lineString2)); - $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT AsText(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); + $query = $this->getEntityManager()->createQuery( + 'SELECT AsText(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l' + ); $result = $query->getResult(); $this->assertEquals('LINESTRING(0 0,2 2,5 5)', $result[0][1]); $this->assertEquals('LINESTRING(3 3,4 15,5 22)', $result[1][1]); } + + /** + * Create and persist a linestring from an array of points. + * + * @param array $points The points to create linestring + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws InvalidValueException when geometries are not valid + * + * @return LineStringEntity + */ + private function createLinestring(array $points) + { + $entity = new LineStringEntity(); + + $entity->setLineString(new LineString($points)); + $this->getEntityManager()->persist($entity); + + return $entity; + } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php index b60e321d..2264f931 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php @@ -79,52 +79,56 @@ protected function setUp(): void */ public function testContainsWhereParameter() { - $lineString1 = new LineString([ + $lineString = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), new Point(0, 0), ]); - $lineString2 = new LineString([ + $entityA = new PolygonEntity(); + + $entityA->setPolygon(new Polygon([$lineString])); + $this->getEntityManager()->persist($entityA); + + $lineString = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), new Point(5, 5), ]); - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); + $entityB = new PolygonEntity(); - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString1, $lineString2])); - $this->getEntityManager()->persist($entity2); + $entityB->setPolygon(new Polygon([$lineString, $lineString])); + $this->getEntityManager()->persist($entityB); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Contains(p.polygon, GeomFromText(:p1)) = 1'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Contains(p.polygon, GeomFromText(:p1))= 1' + ); $query->setParameter('p1', 'POINT(6 6)', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0]); - $this->assertEquals($entity2, $result[1]); + $this->assertEquals($entityA, $result[0]); + $this->assertEquals($entityB, $result[1]); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Contains(p.polygon, GeomFromText(:p1)) = 1'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Contains(p.polygon, GeomFromText(:p1))= 1' + ); $query->setParameter('p1', 'POINT(2 2)', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0]); - $this->assertEquals($entity2, $result[1]); + $this->assertEquals($entityA, $result[0]); + $this->assertEquals($entityB, $result[1]); } /** @@ -141,42 +145,45 @@ public function testContainsWhereParameter() */ public function testSelectContains() { - $lineString1 = new LineString([ + $lineString = new LineString([ new Point(0, 0), new Point(10, 0), new Point(10, 10), new Point(0, 10), new Point(0, 0), ]); - $lineString2 = new LineString([ + $polygonA = new PolygonEntity(); + + $polygonA->setPolygon(new Polygon([$lineString])); + $this->getEntityManager()->persist($polygonA); + + $lineString = new LineString([ new Point(5, 5), new Point(7, 5), new Point(7, 7), new Point(5, 7), new Point(5, 5), ]); - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); + $polygonB = new PolygonEntity(); - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString2])); - $this->getEntityManager()->persist($entity2); + $polygonB->setPolygon(new Polygon([$lineString])); + $this->getEntityManager()->persist($polygonB); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, Contains(p.polygon, GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p, Contains(p.polygon, GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + ); $query->setParameter('p1', 'POINT(2 2)', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals($polygonA, $result[0][0]); $this->assertEquals(1, $result[0][1]); - $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals($polygonB, $result[1][0]); $this->assertEquals(0, $result[1][1]); } + } From 4292b86db0f751b1a11adc6462f814bb2d317390 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sun, 23 Feb 2020 22:56:30 +0100 Subject: [PATCH 25/44] Methods move into parent class --- .../Query/AST/Functions/MySql/AreaTest.php | 2 +- .../AST/Functions/MySql/ContainsTest.php | 92 ++++---------- .../AST/Functions/MySql/DisjointTest.php | 112 ++++-------------- .../AST/Functions/MySql/EnvelopeTest.php | 86 ++------------ .../Query/AST/Functions/MySql/GLengthTest.php | 14 ++- .../AST/Functions/MySql/GeomFromTextTest.php | 25 ++-- .../AST/Functions/MySql/MBRContainsTest.php | 88 ++++---------- tests/CrEOF/Spatial/Tests/OrmTestCase.php | 80 +++++++++++++ 8 files changed, 191 insertions(+), 308 deletions(-) diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php index 32a6f37a..f3e2b610 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php @@ -235,7 +235,7 @@ public function testSelectArea() * * @return PolygonEntity */ - private function createPolygon(array $ring) + protected function createPolygon(array $ring) { $polygonEntity = new PolygonEntity(); $polygonEntity->setPolygon(new Polygon($ring)); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php index 2264f931..4ad23d1f 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php @@ -26,10 +26,6 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; @@ -79,56 +75,33 @@ protected function setUp(): void */ public function testContainsWhereParameter() { - $lineString = new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]); - $entityA = new PolygonEntity(); - - $entityA->setPolygon(new Polygon([$lineString])); - $this->getEntityManager()->persist($entityA); - - $lineString = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $entityB = new PolygonEntity(); - - $entityB->setPolygon(new Polygon([$lineString, $lineString])); - $this->getEntityManager()->persist($entityB); + $bigPolygon = $this->createPolygon([$this->createEnvelopingLineString()]); + $smallPolygon = $this->createPolygon([$this->createInternalLineString()]); + $holeyPolygon = $this->createPolygon([$this->createEnvelopingLineString(), $this->createInternalLineString()]); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( - 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Contains(p.polygon, GeomFromText(:p1))= 1' + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Contains(p.polygon, GeomFromText(:p)) = 1' ); - $query->setParameter('p1', 'POINT(6 6)', 'string'); - + $query->setParameter('p', 'POINT(6 6)', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entityA, $result[0]); - $this->assertEquals($entityB, $result[1]); + $this->assertEquals($bigPolygon, $result[0]); + $this->assertEquals($smallPolygon, $result[1]); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( - 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Contains(p.polygon, GeomFromText(:p1))= 1' + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Contains(p.polygon, GeomFromText(:p)) = 1' ); - - $query->setParameter('p1', 'POINT(2 2)', 'string'); - + $query->setParameter('p', 'POINT(2 2)', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entityA, $result[0]); - $this->assertEquals($entityB, $result[1]); + $this->assertEquals($bigPolygon, $result[0]); + $this->assertEquals($holeyPolygon, $result[1]); } /** @@ -145,45 +118,32 @@ public function testContainsWhereParameter() */ public function testSelectContains() { - $lineString = new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]); - $polygonA = new PolygonEntity(); - - $polygonA->setPolygon(new Polygon([$lineString])); - $this->getEntityManager()->persist($polygonA); - - $lineString = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $polygonB = new PolygonEntity(); - - $polygonB->setPolygon(new Polygon([$lineString])); - $this->getEntityManager()->persist($polygonB); + $bigPolygon = $this->createPolygon([$this->createEnvelopingLineString()]); + $smallPolygon = $this->createPolygon([$this->createInternalLineString()]); + $holeyPolygon = $this->createPolygon([$this->createEnvelopingLineString(), $this->createInternalLineString()]); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( - 'SELECT p, Contains(p.polygon, GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT p, Contains(p.polygon, GeomFromText(:p1)), Contains(p.polygon, GeomFromText(:p2)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + // phpcs:enable ); $query->setParameter('p1', 'POINT(2 2)', 'string'); + $query->setParameter('p2', 'POINT(6 6)', 'string'); $result = $query->getResult(); - $this->assertCount(2, $result); - $this->assertEquals($polygonA, $result[0][0]); + $this->assertCount(3, $result); + $this->assertEquals($bigPolygon, $result[0][0]); $this->assertEquals(1, $result[0][1]); - $this->assertEquals($polygonB, $result[1][0]); + $this->assertEquals(1, $result[0][2]); + $this->assertEquals($smallPolygon, $result[1][0]); $this->assertEquals(0, $result[1][1]); + $this->assertEquals(1, $result[1][2]); + $this->assertEquals($holeyPolygon, $result[2][0]); + $this->assertEquals(1, $result[2][1]); + $this->assertEquals(0, $result[2][2]); } - } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php index aad1387d..fee9b7d3 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php @@ -26,10 +26,6 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; @@ -78,65 +74,35 @@ protected function setUp(): void */ public function testDisjointWhereParameter() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]); - $lineString2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $lineString3 = new LineString([ - new Point(15, 15), - new Point(17, 15), - new Point(17, 17), - new Point(15, 17), - new Point(15, 15), - ]); - - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString2])); - $this->getEntityManager()->persist($entity2); - $this->getEntityManager()->flush(); - - $entity3 = new PolygonEntity(); - - $entity3->setPolygon(new Polygon([$lineString3])); - $this->getEntityManager()->persist($entity3); + $bigPolygon = $this->createPolygon([$this->createEnvelopingLineString()]); + $insidePolygon = $this->createPolygon([$this->createInternalLineString()]); + $externalPolygon = $this->createPolygon([$this->createOuterLineString()]); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Disjoint(p.polygon, GeomFromText(:p1)) = 1'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Disjoint(p.polygon, GeomFromText(:p)) = 1' + ); - $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); + $query->setParameter('p', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity3, $result[0]); + $this->assertEquals($externalPolygon, $result[0]); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Disjoint(p.polygon, GeomFromText(:p1)) = 1'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Disjoint(p.polygon, GeomFromText(:p)) = 1' + ); - $query->setParameter('p1', 'POLYGON((15 15,17 15,17 17,15 17,15 15))', 'string'); + $query->setParameter('p', 'POLYGON((15 15,17 15,17 17,15 17,15 15))', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0]); - $this->assertEquals($entity2, $result[1]); + $this->assertEquals($bigPolygon, $result[0]); + $this->assertEquals($insidePolygon, $result[1]); } /** @@ -153,58 +119,26 @@ public function testDisjointWhereParameter() */ public function testSelectDisjoint() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]); - $lineString2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $lineString3 = new LineString([ - new Point(15, 15), - new Point(17, 15), - new Point(17, 17), - new Point(15, 17), - new Point(15, 15), - ]); - - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString2])); - $this->getEntityManager()->persist($entity2); - $this->getEntityManager()->flush(); - - $entity3 = new PolygonEntity(); - - $entity3->setPolygon(new Polygon([$lineString3])); - $this->getEntityManager()->persist($entity3); + $bigPolygon = $this->createPolygon([$this->createEnvelopingLineString()]); + $insidePolygon = $this->createPolygon([$this->createInternalLineString()]); + $externalPolygon = $this->createPolygon([$this->createOuterLineString()]); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, Disjoint(p.polygon, GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p, Disjoint(p.polygon, GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + ); $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); $result = $query->getResult(); $this->assertCount(3, $result); - $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals($bigPolygon, $result[0][0]); $this->assertEquals(0, $result[0][1]); - $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals($insidePolygon, $result[1][0]); $this->assertEquals(0, $result[1][1]); - $this->assertEquals($entity3, $result[2][0]); + $this->assertEquals($externalPolygon, $result[2][0]); $this->assertEquals(1, $result[2][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php index ad479484..0c995ce8 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php @@ -26,10 +26,6 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; @@ -78,51 +74,21 @@ protected function setUp(): void */ public function testEnvelopeWhereParameter() { - $entity1 = new PolygonEntity(); - $rings1 = [ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]), - new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]), - ]; - - $entity1->setPolygon(new Polygon($rings1)); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - $rings2 = [ - new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]), - ]; - - $entity2->setPolygon(new Polygon($rings2)); - $this->getEntityManager()->persist($entity2); + $holeyPolygon = $this->createPolygon([$this->createEnvelopingLineString(), $this->createInternalLineString()]); + $this->createPolygon([$this->createInternalLineString()]); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Envelope(p.polygon) = GeomFromText(:p1)'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE Envelope(p.polygon) = GeomFromText(:p1)' + ); $query->setParameter('p1', 'POLYGON((0 0,10 0,10 10,0 10,0 0))', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity1, $result[0]); + $this->assertEquals($holeyPolygon, $result[0]); } /** @@ -139,44 +105,14 @@ public function testEnvelopeWhereParameter() */ public function testSelectEnvelope() { - $entity1 = new PolygonEntity(); - $rings1 = [ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]), - ]; - - $entity1->setPolygon(new Polygon($rings1)); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - $rings2 = [ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]), - new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]), - ]; - - $entity2->setPolygon(new Polygon($rings2)); - $this->getEntityManager()->persist($entity2); + $this->createPolygon([$this->createEnvelopingLineString()]); + $this->createPolygon([$this->createEnvelopingLineString(), $this->createInternalLineString()]); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT AsText(Envelope(p.polygon)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT AsText(Envelope(p.polygon)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + ); $result = $query->getResult(); $this->assertEquals('POLYGON((0 0,10 0,10 10,0 10,0 0))', $result[0][1]); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php index e7c254d5..0f6edb15 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php @@ -75,7 +75,7 @@ protected function setUp(): void * * @group geometry */ - public function testGLengthWhereParameter() + public function testLengthWhereParameter() { $entity = new LineStringEntity(); @@ -89,7 +89,11 @@ public function testGLengthWhereParameter() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE GLength(GeomFromText(:p1)) > GLength(l.lineString)'); + // phpcs:disable Generic.Files.LineLength.MaxExceeded + $query = $this->getEntityManager()->createQuery( + 'SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE GLength(GeomFromText(:p1)) > GLength(l.lineString)' + ); + // phpcs:enable $query->setParameter('p1', 'LINESTRING(0 0,1 1,2 2,3 3,4 4,5 5)', 'string'); @@ -111,7 +115,7 @@ public function testGLengthWhereParameter() * * @group geometry */ - public function testSelectGLength() + public function testSelectLength() { $entity = new LineStringEntity(); @@ -125,7 +129,9 @@ public function testSelectGLength() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l, GLength(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); + $query = $this->getEntityManager()->createQuery( + 'SELECT l, GLength(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l' + ); $result = $query->getResult(); $this->assertCount(1, $result); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php index 64d329d7..04f704fe 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php @@ -84,21 +84,22 @@ public function testLineString() new Point(10, 10), ]; - $entity1 = new GeometryEntity(); - - $entity1->setGeometry(new LineString($value)); - $this->getEntityManager()->persist($entity1); + $linestring = new GeometryEntity(); + $linestring->setGeometry(new LineString($value)); + $this->getEntityManager()->persist($linestring); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT g FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g WHERE g.geometry = GeomFromText(:p1)'); + $query = $this->getEntityManager()->createQuery( + 'SELECT g FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g WHERE g.geometry = GeomFromText(:p1)' + ); $query->setParameter('p1', 'LINESTRING(0 0,5 5,10 10)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity1, $result[0]); + $this->assertEquals($linestring, $result[0]); } /** @@ -115,20 +116,22 @@ public function testLineString() */ public function testPoint() { - $entity1 = new GeometryEntity(); + $point = new GeometryEntity(); - $entity1->setGeometry(new Point(5, 5)); - $this->getEntityManager()->persist($entity1); + $point->setGeometry(new Point(5, 5)); + $this->getEntityManager()->persist($point); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT g FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g WHERE g.geometry = GeomFromText(:p1)'); + $query = $this->getEntityManager()->createQuery( + 'SELECT g FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g WHERE g.geometry = GeomFromText(:p1)' + ); $query->setParameter('p1', 'POINT(5 5)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity1, $result[0]); + $this->assertEquals($point, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php index 301bf369..39eefa2e 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php @@ -26,10 +26,6 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; @@ -77,54 +73,41 @@ protected function setUp(): void * * @group geometry */ - public function testMBRContainsWhereParameter() + public function testMbrContainsWhereParameter() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]); - $lineString2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString1, $lineString2])); - $this->getEntityManager()->persist($entity2); + $bigPolygon = $this->createPolygon([$this->createEnvelopingLineString()]); + $holeyPolygon = $this->createPolygon([$this->createEnvelopingLineString(), $this->createInternalLineString()]); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE MBRContains(p.polygon, GeomFromText(:p1)) = 1'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE MBRContains(p.polygon, GeomFromText(:p1)) = 1' + // phpcs:enable + ); $query->setParameter('p1', 'POINT(6 6)', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0]); - $this->assertEquals($entity2, $result[1]); + $this->assertEquals($bigPolygon, $result[0]); + $this->assertEquals($holeyPolygon, $result[1]); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE MBRContains(p.polygon, GeomFromText(:p1)) = 1'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE MBRContains(p.polygon, GeomFromText(:p)) = 1' + // phpcs:enable + ); - $query->setParameter('p1', 'POINT(2 2)', 'string'); + $query->setParameter('p', 'POINT(2 2)', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0]); - $this->assertEquals($entity2, $result[1]); + $this->assertEquals($bigPolygon, $result[0]); + $this->assertEquals($holeyPolygon, $result[1]); } /** @@ -139,44 +122,25 @@ public function testMBRContainsWhereParameter() * * @group geometry */ - public function testSelectMBRContains() + public function testSelectMbrContains() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]); - $lineString2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString2])); - $this->getEntityManager()->persist($entity2); + $envelopingPolygon = $this->createPolygon([$this->createEnvelopingLineString()]); + $internalPolygon = $this->createPolygon([$this->createInternalLineString()]); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, MBRContains(p.polygon, GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p, MBRContains(p.polygon, GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + ); $query->setParameter('p1', 'POINT(2 2)', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals($envelopingPolygon, $result[0][0]); $this->assertEquals(1, $result[0][1]); - $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals($internalPolygon, $result[1][0]); $this->assertEquals(0, $result[1][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/OrmTestCase.php b/tests/CrEOF/Spatial/Tests/OrmTestCase.php index 420bf4ea..d6211a15 100644 --- a/tests/CrEOF/Spatial/Tests/OrmTestCase.php +++ b/tests/CrEOF/Spatial/Tests/OrmTestCase.php @@ -24,7 +24,12 @@ namespace CrEOF\Spatial\Tests; +use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; +use CrEOF\Spatial\PHP\Types\Geometry\LineString; +use CrEOF\Spatial\PHP\Types\Geometry\Point; +use CrEOF\Spatial\PHP\Types\Geometry\Polygon; +use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use Doctrine\Common\Cache\ArrayCache; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\Connection; @@ -259,6 +264,7 @@ protected static function getCommonConnectionParameters() // phpcs:disable Squiz.Commenting.FunctionCommentThrowTag.WrongNumber // phpcs miss the DBALException + /** * Establish the connection if it is not already done, then returns it. * @@ -290,6 +296,7 @@ protected static function getConnection() return $connection; } + // phpcs:enable /** @@ -317,6 +324,79 @@ protected static function getConnectionParameters() return $parameters; } + /** + * Return an external linestring. + * + * @throws InvalidValueException this cannot happen + * + * @return LineString + */ + protected function createEnvelopingLineString() + { + return new LineString([ + new Point(0, 0), + new Point(10, 0), + new Point(10, 10), + new Point(0, 10), + new Point(0, 0), + ]); + } + + /** + * Return an internal linestring. + * + * @throws InvalidValueException this cannot happen + * + * @return LineString + */ + protected function createInternalLineString() + { + return new LineString([ + new Point(5, 5), + new Point(7, 5), + new Point(7, 7), + new Point(5, 7), + new Point(5, 5), + ]); + } + + /** + * Return a linestring out of the enveloping linestring. + * + * @throws InvalidValueException this cannot happen + * + * @return LineString + */ + protected function createOuterLineString() + { + return new LineString([ + new Point(15, 15), + new Point(17, 15), + new Point(17, 17), + new Point(15, 17), + new Point(15, 15), + ]); + } + + /** + * Create a Polygon from an array of linestrings. + * + * @param array $lineStrings the array of linestrings + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws InvalidValueException when geometries are not valid + */ + protected function createPolygon(array $lineStrings) + { + $polygon = new PolygonEntity(); + $polygon->setPolygon(new Polygon($lineStrings)); + $this->getEntityManager()->persist($polygon); + + return $polygon; + } + /** * Using the SQL Logger Stack this method retrieves the current query count executed in this test. * From 24e08f2f8e626672a3f6822f45c6b3bd1c854d71 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Sun, 23 Feb 2020 23:55:55 +0100 Subject: [PATCH 26/44] Methods move into parent class --- .../Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php index 4ad23d1f..a5585d20 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php @@ -88,9 +88,10 @@ public function testContainsWhereParameter() $query->setParameter('p', 'POINT(6 6)', 'string'); $result = $query->getResult(); - $this->assertCount(2, $result); + $this->assertCount(3, $result); $this->assertEquals($bigPolygon, $result[0]); $this->assertEquals($smallPolygon, $result[1]); + $this->assertEquals($holeyPolygon, $result[2]); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( @@ -144,6 +145,6 @@ public function testSelectContains() $this->assertEquals(1, $result[1][2]); $this->assertEquals($holeyPolygon, $result[2][0]); $this->assertEquals(1, $result[2][1]); - $this->assertEquals(0, $result[2][2]); + $this->assertEquals(1, $result[2][2]); } } From fbe8b04a1f4142a0785fcb666a4a71f1ec1bba40 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Mon, 24 Feb 2020 11:22:21 +0100 Subject: [PATCH 27/44] Documentation for tests improved --- .gitignore | 5 +++ .travis.yml | 2 - CONTRIBUTING.md | 29 +++++++++++++- composer.json | 3 +- doc/test.md | 89 ++++++++++++++++++++++++++++++++++++++++++ phpmd.xml.dist | 16 -------- phpunit.mysql.xml.dist | 37 ++++++++++++++++++ phpunit.pgsql.xml.dist | 38 ++++++++++++++++++ 8 files changed, 199 insertions(+), 20 deletions(-) create mode 100644 doc/test.md delete mode 100644 phpmd.xml.dist create mode 100644 phpunit.mysql.xml.dist create mode 100644 phpunit.pgsql.xml.dist diff --git a/.gitignore b/.gitignore index c6db676c..32d77bfc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,10 @@ +*.phar .phpcs-cache .php_cs.cache +.php-version +.phpunit.result.cache +composer.*.lock composer.lock phpunit.xml +phpunit.*.xml vendor/ diff --git a/.travis.yml b/.travis.yml index 85a387d3..e71f513a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,6 @@ php: - 7.2 - 7.3 - 7.4 - - hhvm env: # Only stable and upcoming releases are tested https://www.doctrine-project.org/projects/orm.html @@ -50,7 +49,6 @@ notifications: matrix: allow_failures: - - php: hhvm # driver for PostgreSQL currently unsupported by HHVM, requires 3rd party dependency # Upcoming releases can fail - env: ORM=2.8 - env: ORM=3.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5d4fe026..e729592d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,10 +1,37 @@ Contributing ============ +## Code quality Quality of code is auto-verified by php-cs-fixer, php code sniffer and php mess detector. Before a commit, launch the quality script: ```bash composer quality -``` \ No newline at end of file +``` + +You can launch PHPCS-FIXER only with: +```bash +composer phpcsfixer +``` + +You can launch PHP Code Sniffer only with: +```bash +composer phpcs +``` + +You can launch PHP Mess Detector only with: +```bash +composer phpmd +``` + + +## Tests + +This [page](./doc/test.md) describes how to prepare your test environment and launch the six test-suites: +1. Testsuite for PHP7.2 and MySQL environments executed by Phpunit8 +2. Testsuite for PHP7.2 and PostgreSQL environments executed by Phpunit8 +3. Testsuite for PHP7.3 and MySQL environments executed by Phpunit9 +4. Testsuite for PHP7.3 and PostgreSQL environments executed by Phpunit9 +5. Testsuite for PHP7.4 and MySQL environments executed by Phpunit9 +6. Testsuite for PHP7.4 and PostgreSQL environments executed by Phpunit9 diff --git a/composer.json b/composer.json index b44252fc..7c0a4e6b 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,8 @@ "phpcs": "phpcs --standard=phpcs.xml.dist -s", "phpcsfixer": "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", "phpmd": "phpmd bin,config,public,src,tests text ./phpmd.xml.dist", - "test": "phpunit" + "test-mysql": "phpunit --configuration phpunit.mysql.xml", + "test-pgsql": "phpunit --configuration phpunit.pgsql.xml" }, "autoload": { "psr-0": { diff --git a/doc/test.md b/doc/test.md new file mode 100644 index 00000000..8f37dff8 --- /dev/null +++ b/doc/test.md @@ -0,0 +1,89 @@ +# Tests + +If you want to contribute to this library, you're welcome. This chapter will help you to prepare your development +environment. + +## How to test library? + +Doctrine library is available for MySQL and PostGreSQL. Be aware that MariaDB spatial functions does not returns the +same results than MySQL spatial functions. Then tests failed on MariaDB (especially with the Contains function). So do +not use MariaDB. + +### How to test on MySQL? +I supposed that composer and MySQL are installed. +1. Create a role that can create database and locally connect with a password, +2. Create a phpunit.mysql.xml file copied from phpunit.mysql.xml.dist file, +3. Edit this phpunit.mysql.xml to change connection parameters. +4. run the command `composer test-mysql` + +### How to test on PostgreSQL? +I supposed that composer, PgSQL and its Postgis extension are installed. +1. Create a role that is a superuser because this user will create a database and create postgis extension, +2. Create a `phpunit.pgsql.xml` file copied from `phpunit.pgsql.xml.dist` file, +3. Edit this `phpunit.pgsql.xml` to change connection parameters. +4. run the command `composer test-pgsql` + +### How to test with the three PHP versions? +This library is available for PHP7.2, PHP7.3 and PHP7.4 versions. +So you have to test library with this three versions. + +If you use an IDE like PHPStorm, you can create configurations to launch the six tests suite with the corresponding to: +* MySQL, PHP7.2 and PHPUnit 8.5 +* PostgreSQL, PHP7.2 and PHPUnit +* MySQL, PHP7.3 and PHPUnit 9.0 +* PostgreSQL, PHP7.3 and PHPUnit +* MySQL, PHP7.4 and PHPUnit 9.0 +* PostgreSQL, PHP7.4 and PHPUnit + +Here I described an easy way to switch PHP version via console. (But there is a lot of way to do it.) + +**Symfony console** +I suppose you have installed all php versions on your dev environment. +1. Download symfony binary, +2. Verify that PHP7.2,PHP7.3 and PHP7.4 are available: +```bash + symfony local:php:list +┌─────────┬────────────────────────────────┬─────────┬─────────┬─────────────┬─────────┬─────────┐ +│ Version │ Directory │ PHP CLI │ PHP FPM │ PHP CGI │ Server │ System? │ +├─────────┼────────────────────────────────┼─────────┼─────────┼─────────────┼─────────┼─────────┤ +│ 7.1.30 │ C:\Users\alexandre\Php\php-7.1 │ php.exe │ │ php-cgi.exe │ PHP CGI │ │ +│ 7.2.25 │ C:\Users\alexandre\Php\php-7.2 │ php.exe │ │ php-cgi.exe │ PHP CGI │ │ +│ 7.3.12 │ C:\Users\alexandre\Php\php-7.3 │ php.exe │ │ php-cgi.exe │ PHP CGI │ │ +│ 7.4.1 │ C:\Users\alexandre\Php\php-7.4 │ php.exe │ │ php-cgi.exe │ PHP CGI │ * │ +└─────────┴────────────────────────────────┴─────────┴─────────┴─────────────┴─────────┴─────────┘ +``` +3.Create a `.php-version` containing the PHP version to change php version +```bash +echo 7.2 > .php-version +``` +Now PHP 7.2 will be used each time you use one of this command: +``` +symfony php +symfony composer +``` +4. Download PHPUnit.phar for version 8 and version 9: Go on https://phar.phpunit.de +5. You should now have a phpunit-8.phar and a phpunit-9.phar in your directory +5. This script launch the six test-suites: +```bash +echo 7.2 > .php-version +symfony php phpunit-8.phar --configuration phpunit.mysql.xml +symfony php phpunit-8.phar --configuration phpunit.pgsql.xml +echo 7.3 > .php-version +symfony php phpunit-9.phar --configuration phpunit.mysql.xml +symfony php phpunit-9.phar --configuration phpunit.pgsql.xml +echo 7.4 > .php-version +symfony php phpunit-9.phar --configuration phpunit.mysql.xml +symfony php phpunit-9.phar --configuration phpunit.pgsql.xml +``` + +## Quality checks +A code can works, be successfully tested but still be unmaintenable. +To help contributors as you, there is a composer script that will launch three process to verify the quality of the +code. This script will launch PHPCSFIXER, PHP Code sniffer and PHP Mess detector. +Simply launch: +``` +composer quality +``` +Read the output and completes your script. + +Thanks a lot! \ No newline at end of file diff --git a/phpmd.xml.dist b/phpmd.xml.dist deleted file mode 100644 index f3883fc6..00000000 --- a/phpmd.xml.dist +++ /dev/null @@ -1,16 +0,0 @@ - - - Alexandre Tranchant rule set. - - - - - - - - diff --git a/phpunit.mysql.xml.dist b/phpunit.mysql.xml.dist new file mode 100644 index 00000000..767519fe --- /dev/null +++ b/phpunit.mysql.xml.dist @@ -0,0 +1,37 @@ + + + + + + ./tests/CrEOF/Spatial/Tests + + + + + + + + + + + + + + + + + + + ./lib/ + + ./tests/CrEOF/Spatial/Tests + + + + diff --git a/phpunit.pgsql.xml.dist b/phpunit.pgsql.xml.dist new file mode 100644 index 00000000..963b0954 --- /dev/null +++ b/phpunit.pgsql.xml.dist @@ -0,0 +1,38 @@ + + + + + + ./tests/CrEOF/Spatial/Tests + + + + + + + + + + + + + + + + + + + + ./lib/ + + ./tests/CrEOF/Spatial/Tests + + + + From fb9336ba24a14bb6f3ca21fd57f12c399e901c5f Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Mon, 24 Feb 2020 11:24:55 +0100 Subject: [PATCH 28/44] Documentation for tests improved --- phpunit.mysql.xml.dist | 6 ++++++ phpunit.xml.dist | 35 ----------------------------------- 2 files changed, 6 insertions(+), 35 deletions(-) delete mode 100644 phpunit.xml.dist diff --git a/phpunit.mysql.xml.dist b/phpunit.mysql.xml.dist index 767519fe..6d366cd1 100644 --- a/phpunit.mysql.xml.dist +++ b/phpunit.mysql.xml.dist @@ -7,6 +7,12 @@ xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/9.0/phpunit.xsd" > + + + srid + + + ./tests/CrEOF/Spatial/Tests diff --git a/phpunit.xml.dist b/phpunit.xml.dist deleted file mode 100644 index 69976193..00000000 --- a/phpunit.xml.dist +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - ./tests/CrEOF/Spatial/Tests - - - - - - - - - - - - - - - - - ./lib/ - - ./tests/CrEOF/Spatial/Tests - - - - From 8c20cde57246a77168865f8298b8bf085b4664ce Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Mon, 24 Feb 2020 11:36:29 +0100 Subject: [PATCH 29/44] Test code simplified --- .../AST/Functions/PostgreSql/GeometryTest.php | 16 +- .../AST/Functions/PostgreSql/STAreaTest.php | 159 ++---------------- .../Functions/PostgreSql/STAsBinaryTest.php | 27 +-- 3 files changed, 33 insertions(+), 169 deletions(-) diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php index b53d3910..a0756c9e 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php @@ -76,17 +76,19 @@ protected function setUp(): void */ public function testSelectGeometry() { - $entity = new PointEntity(); - $entity->setPoint(new Point(1, 2)); - $this->getEntityManager()->persist($entity); - $entity2 = new PointEntity(); - $entity2->setPoint(new Point(-2, 3)); - $this->getEntityManager()->persist($entity2); + $pointA = new PointEntity(); + $pointA->setPoint(new Point(1, 2)); + $this->getEntityManager()->persist($pointA); + $pointB = new PointEntity(); + $pointB->setPoint(new Point(-2, 3)); + $this->getEntityManager()->persist($pointB); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(geometry(p.point)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT ST_AsText(geometry(p.point)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p' + ); $result = $query->getResult(); $expected = [ diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php index 87ae1924..18ef8fa7 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php @@ -28,8 +28,6 @@ use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; @@ -76,45 +74,11 @@ protected function setUp(): void * * @group geometry */ - public function testSelectSTArea() + public function testSelectStArea() { - $entity1 = new PolygonEntity(); - $rings1 = [ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]), - ]; - - $entity1->setPolygon(new Polygon($rings1)); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - $rings2 = [ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]), - new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]), - ]; - - $entity2->setPolygon(new Polygon($rings2)); - $this->getEntityManager()->persist($entity2); - - $entity3 = new PolygonEntity(); - $rings3 = [ + $this->createPolygon([$this->createEnvelopingLineString()]); + $this->createPolygon([$this->createEnvelopingLineString(), $this->createInternalLineString()]); + $this->createPolygon([ new LineString([ new Point(0, 0), new Point(10, 0), @@ -123,120 +87,17 @@ public function testSelectSTArea() new Point(10, 10), new Point(0, 0), ]), - ]; - - $entity3->setPolygon(new Polygon($rings3)); - $this->getEntityManager()->persist($entity3); - - $entity4 = new PolygonEntity(); - $rings4 = [ - new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]), - ]; - - $entity4->setPolygon(new Polygon($rings4)); - $this->getEntityManager()->persist($entity4); - $this->getEntityManager()->flush(); - $this->getEntityManager()->clear(); - - $query = $this->getEntityManager()->createQuery('SELECT ST_Area(p.polygon) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); - $result = $query->getResult(); - - $this->assertEquals(100, $result[0][1]); - $this->assertEquals(96, $result[1][1]); - $this->assertEquals(100, $result[2][1]); - $this->assertEquals(4, $result[3][1]); - } - - /** - * Test a DQL containing function to test in the predicate. - * - * @throws DBALException when connection failed - * @throws ORMException when cache is not set - * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails - * @throws InvalidValueException when geometries are not valid - * - * @group geometry - */ - public function testSTAreaWhere() - { - $entity1 = new PolygonEntity(); - $rings1 = [ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]), - ]; - - $entity1->setPolygon(new Polygon($rings1)); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - $rings2 = [ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]), - new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]), - ]; - - $entity2->setPolygon(new Polygon($rings2)); - $this->getEntityManager()->persist($entity2); - - $entity3 = new PolygonEntity(); - $rings3 = [ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 20), - new Point(0, 20), - new Point(10, 10), - new Point(0, 0), - ]), - ]; - - $entity3->setPolygon(new Polygon($rings3)); - $this->getEntityManager()->persist($entity3); - - $entity4 = new PolygonEntity(); - $rings4 = [ - new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]), - ]; - - $entity4->setPolygon(new Polygon($rings4)); - $this->getEntityManager()->persist($entity4); + ]); + $smallPolygon = $this->createPolygon([$this->createInternalLineString()]); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Area(p.polygon) < 50'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Area(p.polygon) < 50' + ); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity4, $result[0]); + $this->assertEquals($smallPolygon, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php index a2340e79..0579badd 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php @@ -77,32 +77,33 @@ protected function setUp(): void */ public function testSTAsBinary() { - $lineString1 = [ + $lineStringA = new LineStringEntity(); + $lineStringA->setLineString(new LineString([ new Point(0, 0), new Point(2, 2), new Point(5, 5), - ]; - $lineString2 = [ + ])); + $this->getEntityManager()->persist($lineStringA); + + $linestringB = new LineStringEntity(); + $linestringB->setLineString(new LineString([ new Point(3, 3), new Point(4, 15), new Point(5, 22), - ]; - $entity1 = new LineStringEntity(); - - $entity1->setLineString(new LineString($lineString1)); - $this->getEntityManager()->persist($entity1); - - $entity2 = new LineStringEntity(); + ])); + $this->getEntityManager()->persist($linestringB); - $entity2->setLineString(new LineString($lineString2)); - $this->getEntityManager()->persist($entity2); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT ST_AsBinary(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); + $query = $this->getEntityManager()->createQuery( + 'SELECT ST_AsBinary(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l' + ); $result = $query->getResult(); + // phpcs:disable Generic.Files.LineLength.MaxExceeded $this->assertEquals('010200000003000000000000000000000000000000000000000000000000000040000000000000004000000000000014400000000000001440', bin2hex(stream_get_contents($result[0][1]))); $this->assertEquals('0102000000030000000000000000000840000000000000084000000000000010400000000000002e4000000000000014400000000000003640', bin2hex(stream_get_contents($result[1][1]))); + // phpcs:enable } } From c35c6da6f8da6b127533b1b64a7dc2a4c700e240 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Mon, 24 Feb 2020 16:04:23 +0100 Subject: [PATCH 30/44] Helper created to simplify tests --- doc/test.md | 13 +- .../Query/AST/Functions/MySql/AreaTest.php | 47 +----- .../AST/Functions/MySql/ContainsTest.php | 15 +- .../AST/Functions/MySql/DisjointTest.php | 11 +- .../AST/Functions/MySql/EnvelopeTest.php | 11 +- .../AST/Functions/MySql/MBRContainsTest.php | 11 +- .../AST/Functions/PostgreSql/STAreaTest.php | 9 +- .../AST/Functions/PostgreSql/STAsTextTest.php | 30 ++-- .../Functions/PostgreSql/STCentroidTest.php | 40 ++--- .../PostgreSql/STClosestPointTest.php | 7 +- .../Functions/PostgreSql/STDistanceTest.php | 118 ++++++-------- .../Functions/PostgreSql/STEnvelopeTest.php | 9 +- tests/CrEOF/Spatial/Tests/OrmTestCase.php | 78 --------- tests/CrEOF/Spatial/Tests/TestHelperTrait.php | 154 ++++++++++++++++++ 14 files changed, 293 insertions(+), 260 deletions(-) create mode 100644 tests/CrEOF/Spatial/Tests/TestHelperTrait.php diff --git a/doc/test.md b/doc/test.md index 8f37dff8..53d6f2bb 100644 --- a/doc/test.md +++ b/doc/test.md @@ -76,14 +76,7 @@ symfony php phpunit-9.phar --configuration phpunit.mysql.xml symfony php phpunit-9.phar --configuration phpunit.pgsql.xml ``` -## Quality checks -A code can works, be successfully tested but still be unmaintenable. -To help contributors as you, there is a composer script that will launch three process to verify the quality of the -code. This script will launch PHPCSFIXER, PHP Code sniffer and PHP Mess detector. -Simply launch: -``` -composer quality -``` -Read the output and completes your script. +## Which geometries are in test suite? -Thanks a lot! \ No newline at end of file +[TestHelperTrait.php](../tests/CrEOF/Spatial/Tests/TestHelperTrait.php) provides some protected methods to create +and persist some geometry entities. diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php index f3e2b610..239c811c 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php @@ -31,6 +31,7 @@ use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use CrEOF\Spatial\Tests\TestHelperTrait; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; use Doctrine\ORM\OptimisticLockException; @@ -49,6 +50,8 @@ */ class AreaTest extends OrmTestCase { + use TestHelperTrait; + /** * Setup the function type test. * @@ -78,47 +81,9 @@ protected function setUp(): void */ public function testAreaWhere() { - $ring = [ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]), - ]; - - $this->createPolygon($ring); - - $ring = [ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]), - new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]), - ]; - $this->createPolygon($ring); - - $ring = [ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 20), - new Point(0, 20), - new Point(10, 10), - new Point(0, 0), - ]), - ]; - $this->createPolygon($ring); + $this->createBigPolygon(); + $this->createHoleyPolygon(); + $this->createPolygonW(); $ring = [ new LineString([ diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php index a5585d20..0d42a862 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php @@ -27,6 +27,7 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\Tests\OrmTestCase; +use CrEOF\Spatial\Tests\TestHelperTrait; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; use Doctrine\ORM\OptimisticLockException; @@ -45,6 +46,8 @@ */ class ContainsTest extends OrmTestCase { + use TestHelperTrait; + /** * Setup the function type test. * @@ -75,9 +78,9 @@ protected function setUp(): void */ public function testContainsWhereParameter() { - $bigPolygon = $this->createPolygon([$this->createEnvelopingLineString()]); - $smallPolygon = $this->createPolygon([$this->createInternalLineString()]); - $holeyPolygon = $this->createPolygon([$this->createEnvelopingLineString(), $this->createInternalLineString()]); + $bigPolygon = $this->createBigPolygon(); + $smallPolygon = $this->createSmallPolygon(); + $holeyPolygon = $this->createHoleyPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); @@ -119,9 +122,9 @@ public function testContainsWhereParameter() */ public function testSelectContains() { - $bigPolygon = $this->createPolygon([$this->createEnvelopingLineString()]); - $smallPolygon = $this->createPolygon([$this->createInternalLineString()]); - $holeyPolygon = $this->createPolygon([$this->createEnvelopingLineString(), $this->createInternalLineString()]); + $bigPolygon = $this->createBigPolygon(); + $smallPolygon = $this->createSmallPolygon(); + $holeyPolygon = $this->createHoleyPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php index fee9b7d3..94cca5b7 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php @@ -27,6 +27,7 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\Tests\OrmTestCase; +use CrEOF\Spatial\Tests\TestHelperTrait; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; use Doctrine\ORM\OptimisticLockException; @@ -45,6 +46,8 @@ */ class DisjointTest extends OrmTestCase { + use TestHelperTrait; + /** * Setup the function type test. * @@ -74,8 +77,8 @@ protected function setUp(): void */ public function testDisjointWhereParameter() { - $bigPolygon = $this->createPolygon([$this->createEnvelopingLineString()]); - $insidePolygon = $this->createPolygon([$this->createInternalLineString()]); + $bigPolygon = $this->createBigPolygon(); + $insidePolygon = $this->createSmallPolygon(); $externalPolygon = $this->createPolygon([$this->createOuterLineString()]); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); @@ -119,8 +122,8 @@ public function testDisjointWhereParameter() */ public function testSelectDisjoint() { - $bigPolygon = $this->createPolygon([$this->createEnvelopingLineString()]); - $insidePolygon = $this->createPolygon([$this->createInternalLineString()]); + $bigPolygon = $this->createBigPolygon(); + $insidePolygon = $this->createSmallPolygon(); $externalPolygon = $this->createPolygon([$this->createOuterLineString()]); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php index 0c995ce8..4a86421d 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php @@ -27,6 +27,7 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\Tests\OrmTestCase; +use CrEOF\Spatial\Tests\TestHelperTrait; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; use Doctrine\ORM\OptimisticLockException; @@ -45,6 +46,8 @@ */ class EnvelopeTest extends OrmTestCase { + use TestHelperTrait; + /** * Setup the function type test. * @@ -74,8 +77,8 @@ protected function setUp(): void */ public function testEnvelopeWhereParameter() { - $holeyPolygon = $this->createPolygon([$this->createEnvelopingLineString(), $this->createInternalLineString()]); - $this->createPolygon([$this->createInternalLineString()]); + $holeyPolygon = $this->createHoleyPolygon(); + $this->createSmallPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); @@ -105,8 +108,8 @@ public function testEnvelopeWhereParameter() */ public function testSelectEnvelope() { - $this->createPolygon([$this->createEnvelopingLineString()]); - $this->createPolygon([$this->createEnvelopingLineString(), $this->createInternalLineString()]); + $this->createBigPolygon(); + $this->createHoleyPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php index 39eefa2e..20cf21c2 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php @@ -27,6 +27,7 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\Tests\OrmTestCase; +use CrEOF\Spatial\Tests\TestHelperTrait; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; use Doctrine\ORM\OptimisticLockException; @@ -45,6 +46,8 @@ */ class MBRContainsTest extends OrmTestCase { + use TestHelperTrait; + /** * Setup the function type test. * @@ -75,8 +78,8 @@ protected function setUp(): void */ public function testMbrContainsWhereParameter() { - $bigPolygon = $this->createPolygon([$this->createEnvelopingLineString()]); - $holeyPolygon = $this->createPolygon([$this->createEnvelopingLineString(), $this->createInternalLineString()]); + $bigPolygon = $this->createBigPolygon(); + $holeyPolygon = $this->createHoleyPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); @@ -124,8 +127,8 @@ public function testMbrContainsWhereParameter() */ public function testSelectMbrContains() { - $envelopingPolygon = $this->createPolygon([$this->createEnvelopingLineString()]); - $internalPolygon = $this->createPolygon([$this->createInternalLineString()]); + $envelopingPolygon = $this->createBigPolygon(); + $internalPolygon = $this->createSmallPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php index 18ef8fa7..e6e14344 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php @@ -29,6 +29,7 @@ use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\OrmTestCase; +use CrEOF\Spatial\Tests\TestHelperTrait; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; use Doctrine\ORM\OptimisticLockException; @@ -47,6 +48,8 @@ */ class STAreaTest extends OrmTestCase { + use TestHelperTrait; + /** * Setup the function type test. * @@ -76,8 +79,8 @@ protected function setUp(): void */ public function testSelectStArea() { - $this->createPolygon([$this->createEnvelopingLineString()]); - $this->createPolygon([$this->createEnvelopingLineString(), $this->createInternalLineString()]); + $this->createBigPolygon(); + $this->createHoleyPolygon(); $this->createPolygon([ new LineString([ new Point(0, 0), @@ -88,7 +91,7 @@ public function testSelectStArea() new Point(0, 0), ]), ]); - $smallPolygon = $this->createPolygon([$this->createInternalLineString()]); + $smallPolygon = $this->createSmallPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php index c35385df..7eef18ba 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php @@ -75,31 +75,31 @@ protected function setUp(): void * * @group geometry */ - public function testSTAsText() + public function testStAsText() { - $lineString1 = [ + $lineStringA = new LineStringEntity(); + + $lineStringA->setLineString(new LineString([ new Point(0, 0), new Point(2, 2), new Point(5, 5), - ]; - $lineString2 = [ + ])); + $this->getEntityManager()->persist($lineStringA); + + $lineStringB = new LineStringEntity(); + + $lineStringB->setLineString(new LineString([ new Point(3, 3), new Point(4, 15), new Point(5, 22), - ]; - $entity1 = new LineStringEntity(); - - $entity1->setLineString(new LineString($lineString1)); - $this->getEntityManager()->persist($entity1); - - $entity2 = new LineStringEntity(); - - $entity2->setLineString(new LineString($lineString2)); - $this->getEntityManager()->persist($entity2); + ])); + $this->getEntityManager()->persist($lineStringB); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); + $query = $this->getEntityManager()->createQuery( + 'SELECT ST_AsText(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l' + ); $result = $query->getResult(); $this->assertEquals('LINESTRING(0 0,2 2,5 5)', $result[0][1]); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php index e5de302a..1b84782e 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php @@ -31,6 +31,7 @@ use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use CrEOF\Spatial\Tests\TestHelperTrait; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; use Doctrine\ORM\OptimisticLockException; @@ -49,6 +50,8 @@ */ class STCentroidTest extends OrmTestCase { + use TestHelperTrait; + /** * Setup the function type test. * @@ -76,41 +79,22 @@ protected function setUp(): void * * @group geometry */ - public function testSelectSTCentroid() + public function testSelectStCentroid() { - $lineString1 = new LineString([ - new Point(6, 6), - new Point(10, 6), - new Point(10, 10), - new Point(6, 10), - new Point(6, 6), - ]); - $lineString2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString2])); - $this->getEntityManager()->persist($entity2); + $bigPolygon = $this->createBigPolygon(); + $smallPolygon = $this->createSmallPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_AsText(ST_Centroid(p.polygon)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p, ST_AsText(ST_Centroid(p.polygon)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + ); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0][0]); - $this->assertEquals('POINT(8 8)', $result[0][1]); - $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals($bigPolygon, $result[0][0]); + $this->assertEquals('POINT(5 5)', $result[0][1]); + $this->assertEquals($smallPolygon, $result[1][0]); $this->assertEquals('POINT(6 6)', $result[1][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php index 42eba2fa..1fcb1af8 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php @@ -31,6 +31,7 @@ use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use CrEOF\Spatial\Tests\TestHelperTrait; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; use Doctrine\ORM\OptimisticLockException; @@ -49,6 +50,8 @@ */ class STClosestPointTest extends OrmTestCase { + use TestHelperTrait; + /** * Setup the function type test. * @@ -105,7 +108,9 @@ public function testSelectSTClosestPoint() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_AsText(ST_ClosestPoint(p.polygon, ST_GeomFromText(:p1))) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p, ST_AsText(ST_ClosestPoint(p.polygon, ST_GeomFromText(:p1))) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + ); $query->setParameter('p1', 'POINT(2 2)', 'string'); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php index d3ef57b7..c3eddbcf 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php @@ -31,6 +31,7 @@ use CrEOF\Spatial\Tests\Fixtures\GeographyEntity; use CrEOF\Spatial\Tests\Fixtures\PointEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use CrEOF\Spatial\Tests\TestHelperTrait; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; use Doctrine\ORM\OptimisticLockException; @@ -49,6 +50,8 @@ */ class STDistanceTest extends OrmTestCase { + use TestHelperTrait; + /** * Setup the function type test. * @@ -78,41 +81,36 @@ protected function setUp(): void * * @group geography */ - public function testSelectSTDistanceGeographyCartesian() + public function testSelectStDistanceGeographyCartesian() { - $newYork = new GeographyPoint(-73.938611, 40.664167); - $losAngles = new GeographyPoint(-118.2430, 34.0522); - $dallas = new GeographyPoint(-96.803889, 32.782778); - - $entity1 = new GeographyEntity(); - - $entity1->setGeography($newYork); - $this->getEntityManager()->persist($entity1); + $newYork = new GeographyEntity(); + $newYork->setGeography(new GeographyPoint(-73.938611, 40.664167)); + $this->getEntityManager()->persist($newYork); - $entity2 = new GeographyEntity(); + $losAngeles = new GeographyEntity(); + $losAngeles->setGeography(new GeographyPoint(-118.2430, 34.0522)); + $this->getEntityManager()->persist($losAngeles); - $entity2->setGeography($losAngles); - $this->getEntityManager()->persist($entity2); - - $entity3 = new GeographyEntity(); - - $entity3->setGeography($dallas); - $this->getEntityManager()->persist($entity3); + $dallas = new GeographyEntity(); + $dallas->setGeography(new GeographyPoint(-96.803889, 32.782778)); + $this->getEntityManager()->persist($dallas); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT g, ST_Distance(g.geography, ST_GeographyFromText(:p1), false) FROM CrEOF\Spatial\Tests\Fixtures\GeographyEntity g'); + $query = $this->getEntityManager()->createQuery( + 'SELECT g, ST_Distance(g.geography, ST_GeographyFromText(:p1), false) FROM CrEOF\Spatial\Tests\Fixtures\GeographyEntity g' + ); $query->setParameter('p1', 'POINT(-89.4 43.066667)', 'string'); $result = $query->getResult(); $this->assertCount(3, $result); - $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals($newYork, $result[0][0]); $this->assertEquals(1305895.94823465, $result[0][1]); - $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals($losAngeles, $result[1][0]); $this->assertEquals(2684082.08249337, $result[1][1]); - $this->assertEquals($entity3, $result[2][0]); + $this->assertEquals($dallas, $result[2][0]); $this->assertEquals(1313754.60684762, $result[2][1]); } @@ -128,42 +126,38 @@ public function testSelectSTDistanceGeographyCartesian() * * @group geography */ - public function testSelectSTDistanceGeographySpheroid() + public function testSelectStDistanceGeographySpheroid() { - $newYork = new GeographyPoint(-73.938611, 40.664167); - $losAngles = new GeographyPoint(-118.2430, 34.0522); - $dallas = new GeographyPoint(-96.803889, 32.782778); - - $entity1 = new GeographyEntity(); + $newYork = new GeographyEntity(); + $newYork->setGeography(new GeographyPoint(-73.938611, 40.664167)); + $this->getEntityManager()->persist($newYork); - $entity1->setGeography($newYork); - $this->getEntityManager()->persist($entity1); + $losAngeles = new GeographyEntity(); + $losAngeles->setGeography(new GeographyPoint(-118.2430, 34.0522)); + $this->getEntityManager()->persist($losAngeles); - $entity2 = new GeographyEntity(); + $dallas = new GeographyEntity(); + $dallas->setGeography(new GeographyPoint(-96.803889, 32.782778)); + $this->getEntityManager()->persist($dallas); - $entity2->setGeography($losAngles); - $this->getEntityManager()->persist($entity2); - - $entity3 = new GeographyEntity(); - - $entity3->setGeography($dallas); - $this->getEntityManager()->persist($entity3); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT g, ST_Distance(g.geography, ST_GeographyFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\GeographyEntity g'); + $query = $this->getEntityManager()->createQuery( + 'SELECT g, ST_Distance(g.geography, ST_GeographyFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\GeographyEntity g' + ); $query->setParameter('p1', 'POINT(-89.4 43.066667)', 'string'); $result = $query->getResult(); $this->assertCount(3, $result); - $this->assertEquals($entity1, $result[0][0]); - $this->assertEquals(1309106.31457703, $result[0][1]); - $this->assertEquals($entity2, $result[1][0]); - $this->assertEquals(2689041.41286683, $result[1][1]); - $this->assertEquals($entity3, $result[2][0]); - $this->assertEquals(1312731.61416563, $result[2][1]); + $this->assertEquals($newYork, $result[0][0]); + $this->assertEquals(1309106.31458423, $result[0][1]); + $this->assertEquals($losAngeles, $result[1][0]); + $this->assertEquals(2689041.41288843, $result[1][1]); + $this->assertEquals($dallas, $result[2][0]); + $this->assertEquals(1312731.61417061, $result[2][1]); } /** @@ -178,41 +172,37 @@ public function testSelectSTDistanceGeographySpheroid() * * @group geometry */ - public function testSelectSTDistanceGeometryCartesian() + public function testSelectStDistanceGeometryCartesian() { - $newYork = new Point(-73.938611, 40.664167); - $losAngles = new Point(-118.2430, 34.0522); - $dallas = new Point(-96.803889, 32.782778); - - $entity1 = new PointEntity(); - - $entity1->setPoint($newYork); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PointEntity(); + $newYork = new PointEntity(); + $newYork->setPoint(new Point(-73.938611, 40.664167)); + $this->getEntityManager()->persist($newYork); - $entity2->setPoint($losAngles); - $this->getEntityManager()->persist($entity2); + $losAngeles = new PointEntity(); + $losAngeles->setPoint(new Point(-118.2430, 34.0522)); + $this->getEntityManager()->persist($losAngeles); - $entity3 = new PointEntity(); + $dallas = new PointEntity(); + $dallas->setPoint(new Point(-96.803889, 32.782778)); + $this->getEntityManager()->persist($dallas); - $entity3->setPoint($dallas); - $this->getEntityManager()->persist($entity3); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_Distance(p.point, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p, ST_Distance(p.point, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p' + ); $query->setParameter('p1', 'POINT(-89.4 43.066667)', 'string'); $result = $query->getResult(); $this->assertCount(3, $result); - $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals($newYork, $result[0][0]); $this->assertEquals(15.646934398128, $result[0][1]); - $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals($losAngeles, $result[1][0]); $this->assertEquals(30.2188561049899, $result[1][1]); - $this->assertEquals($entity3, $result[2][0]); + $this->assertEquals($dallas, $result[2][0]); $this->assertEquals(12.6718564262953, $result[2][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php index 2b63e3e8..78b78014 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php @@ -31,6 +31,7 @@ use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use CrEOF\Spatial\Tests\OrmTestCase; +use CrEOF\Spatial\Tests\TestHelperTrait; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; use Doctrine\ORM\OptimisticLockException; @@ -49,6 +50,8 @@ */ class STEnvelopeTest extends OrmTestCase { + use TestHelperTrait; + /** * Setup the function type test. * @@ -173,9 +176,11 @@ public function testSTEnvelopeWhereParameter() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Envelope(p.polygon) = ST_GeomFromText(:p1)'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Envelope(p.polygon) = ST_GeomFromText(:p)' + ); - $query->setParameter('p1', 'POLYGON((0 0,10 0,10 10,0 10,0 0))', 'string'); + $query->setParameter('p', 'POLYGON((0 0,0 10,10 10,10 0,0 0))', 'string'); $result = $query->getResult(); diff --git a/tests/CrEOF/Spatial/Tests/OrmTestCase.php b/tests/CrEOF/Spatial/Tests/OrmTestCase.php index d6211a15..0ed88a34 100644 --- a/tests/CrEOF/Spatial/Tests/OrmTestCase.php +++ b/tests/CrEOF/Spatial/Tests/OrmTestCase.php @@ -24,12 +24,7 @@ namespace CrEOF\Spatial\Tests; -use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; use Doctrine\Common\Cache\ArrayCache; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\Connection; @@ -324,79 +319,6 @@ protected static function getConnectionParameters() return $parameters; } - /** - * Return an external linestring. - * - * @throws InvalidValueException this cannot happen - * - * @return LineString - */ - protected function createEnvelopingLineString() - { - return new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]); - } - - /** - * Return an internal linestring. - * - * @throws InvalidValueException this cannot happen - * - * @return LineString - */ - protected function createInternalLineString() - { - return new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - } - - /** - * Return a linestring out of the enveloping linestring. - * - * @throws InvalidValueException this cannot happen - * - * @return LineString - */ - protected function createOuterLineString() - { - return new LineString([ - new Point(15, 15), - new Point(17, 15), - new Point(17, 17), - new Point(15, 17), - new Point(15, 15), - ]); - } - - /** - * Create a Polygon from an array of linestrings. - * - * @param array $lineStrings the array of linestrings - * - * @throws DBALException when connection failed - * @throws ORMException when cache is not set - * @throws UnsupportedPlatformException when platform is unsupported - * @throws InvalidValueException when geometries are not valid - */ - protected function createPolygon(array $lineStrings) - { - $polygon = new PolygonEntity(); - $polygon->setPolygon(new Polygon($lineStrings)); - $this->getEntityManager()->persist($polygon); - - return $polygon; - } - /** * Using the SQL Logger Stack this method retrieves the current query count executed in this test. * diff --git a/tests/CrEOF/Spatial/Tests/TestHelperTrait.php b/tests/CrEOF/Spatial/Tests/TestHelperTrait.php new file mode 100644 index 00000000..3d4c8758 --- /dev/null +++ b/tests/CrEOF/Spatial/Tests/TestHelperTrait.php @@ -0,0 +1,154 @@ +createPolygon([self::createEnvelopingLineString()]); + } + + /** + * Create the HOLEY Polygon and persist it in database. + * (Big polygon minus Small Polygon) + * + * @return PolygonEntity + * + * @throws InvalidValueException when geometries are not valid + */ + protected function createHoleyPolygon() + { + return $this->createPolygon([self::createEnvelopingLineString(),self::createInternalLineString()]); + } + + /** + * Create the W Polygon and persist it in database. + * + * @return PolygonEntity + * + * @throws InvalidValueException when geometries are not valid + */ + protected function createPolygonW() + { + return $this->createPolygon([ + new LineString([ + new Point(0, 0), + new Point(10, 0), + new Point(10, 20), + new Point(0, 20), + new Point(10, 10), + new Point(0, 0), + ]) + ]); + } + + /** + * Create the SMALL Polygon and persist it in database. + * + * @return PolygonEntity + * + * @throws InvalidValueException when geometries are not valid + */ + protected function createSmallPolygon() + { + return $this->createPolygon([self::createInternalLineString()]); + } + + /** + * Create a Polygon from an array of linestrings. + * + * @param array $lineStrings the array of linestrings + * + * @return PolygonEntity + * + * @throws InvalidValueException when geometries are not valid + */ + protected function createPolygon(array $lineStrings) + { + $polygon = new PolygonEntity(); + $polygon->setPolygon(new Polygon($lineStrings)); + $this->getEntityManager()->persist($polygon); + + return $polygon; + } + +} \ No newline at end of file From c53e009cfc2274f362d3f3bcb74646cf18da4faf Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Tue, 25 Feb 2020 17:19:39 +0100 Subject: [PATCH 31/44] 3 Helpers created to simplify tests --- .../Tests/Helper/LineStringHelperTrait.php | 233 ++++++++++++++++++ .../Spatial/Tests/Helper/PointHelperTrait.php | 219 ++++++++++++++++ .../Tests/Helper/PolygonHelperTrait.php | 223 +++++++++++++++++ .../Query/AST/Functions/MySql/AreaTest.php | 105 +------- .../AST/Functions/MySql/AsBinaryTest.php | 32 +-- .../Query/AST/Functions/MySql/AsTextTest.php | 49 +--- .../AST/Functions/MySql/ContainsTest.php | 11 +- .../AST/Functions/MySql/DisjointTest.php | 15 +- .../AST/Functions/MySql/EnvelopeTest.php | 11 +- .../Query/AST/Functions/MySql/GLengthTest.php | 43 +--- .../AST/Functions/MySql/GeomFromTextTest.php | 39 +-- .../AST/Functions/MySql/MBRContainsTest.php | 11 +- .../AST/Functions/MySql/MBRDisjointTest.php | 132 +++------- .../AST/Functions/MySql/StartPointTest.php | 87 ++----- .../AST/Functions/PostgreSql/GeometryTest.php | 19 +- .../AST/Functions/PostgreSql/STAreaTest.php | 22 +- .../Functions/PostgreSql/STAsBinaryTest.php | 31 +-- .../AST/Functions/PostgreSql/STAsTextTest.php | 30 +-- .../Functions/PostgreSql/STCentroidTest.php | 12 +- .../PostgreSql/STClosestPointTest.php | 46 +--- .../Functions/PostgreSql/STCollectTest.php | 10 +- .../PostgreSql/STContainsProperlyTest.php | 81 ++---- .../Functions/PostgreSql/STContainsTest.php | 94 +++---- .../Functions/PostgreSql/STCoveredByTest.php | 92 ++----- .../AST/Functions/PostgreSql/STCoversTest.php | 84 ++----- .../Functions/PostgreSql/STCrossesTest.php | 107 +++----- .../Functions/PostgreSql/STDisjointTest.php | 125 +++------- .../PostgreSql/STDistanceSphereTest.php | 45 ++-- .../Functions/PostgreSql/STDistanceTest.php | 67 ++--- .../Functions/PostgreSql/STEnvelopeTest.php | 93 ++----- .../PostgreSql/STGeomFromTextTest.php | 52 ++-- .../AST/Functions/PostgreSql/STLengthTest.php | 61 ++--- .../STLineCrossingDirectionTest.php | 103 ++------ .../PostgreSql/STMakeEnvelopeTest.php | 33 +-- .../Functions/PostgreSql/STOverlapsTest.php | 49 +--- .../Functions/PostgreSql/STSnapToGridTest.php | 46 ++-- .../Functions/PostgreSql/STStartPointTest.php | 94 +++---- .../Functions/PostgreSql/STSummaryTest.php | 139 +++++------ tests/CrEOF/Spatial/Tests/OrmTestCase.php | 2 +- tests/CrEOF/Spatial/Tests/TestHelperTrait.php | 154 ------------ 40 files changed, 1245 insertions(+), 1656 deletions(-) create mode 100644 tests/CrEOF/Spatial/Tests/Helper/LineStringHelperTrait.php create mode 100644 tests/CrEOF/Spatial/Tests/Helper/PointHelperTrait.php create mode 100644 tests/CrEOF/Spatial/Tests/Helper/PolygonHelperTrait.php delete mode 100644 tests/CrEOF/Spatial/Tests/TestHelperTrait.php diff --git a/tests/CrEOF/Spatial/Tests/Helper/LineStringHelperTrait.php b/tests/CrEOF/Spatial/Tests/Helper/LineStringHelperTrait.php new file mode 100644 index 00000000..2294d0ce --- /dev/null +++ b/tests/CrEOF/Spatial/Tests/Helper/LineStringHelperTrait.php @@ -0,0 +1,233 @@ + + * @license http://alexandre-tranchant.mit-license.org MIT + * + * @method EntityManagerInterface getEntityManager Return the entity interface + */ +trait LineStringHelperTrait +{ + /** + * Create a broken linestring and persist it in database. + * Line is created with three aligned points: (3 3) (4 15) (5 22). + * + * @throws InvalidValueException when geometries are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + * + * @return LineStringEntity + */ + protected function createAngularLineString() + { + return $this->createLineString([ + new Point(3, 3), + new Point(4, 15), + new Point(5, 22), + ]); + } + + /** + * Create a linestring A and persist it in database. + * Line is created with two points: (0 0, 10 10). + * + * @throws InvalidValueException when geometries are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + * + * @return LineStringEntity + */ + protected function createLineStringA() + { + return $this->createLineString([ + new Point(0, 0), + new Point(10, 10), + ]); + } + + /** + * Create a linestring B and persist it in database. + * Line B crosses lines A and C. + * Line is created with two points: (0 10, 15 0). + * + * @throws InvalidValueException when geometries are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + * + * @return LineStringEntity + */ + protected function createLineStringB() + { + return $this->createLineString([ + new Point(0, 10), + new Point(15, 0), + ]); + } + + /** + * Create a linestring C and persist it in database. + * Linestring C does not cross linestring A. + * Linestring C crosses linestring B. + * Line is created with two points: (2 0, 12 10). + * + * @throws InvalidValueException when geometries are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + * + * @return LineStringEntity + */ + protected function createLineStringC() + { + return $this->createLineString([ + new Point(2, 0), + new Point(12, 10), + ]); + } + + /** + * Create a linestring X and persist it in database. + * + * @throws InvalidValueException when geometries are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + * + * @return LineStringEntity + */ + protected function createLineStringX() + { + return $this->createLineString([ + new Point(8, 15), + new Point(4, 8), + ]); + } + + /** + * Create a linestring Y and persist it in database. + * + * @throws InvalidValueException when geometries are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + * + * @return LineStringEntity + */ + protected function createLineStringY() + { + return $this->createLineString([ + new Point(12, 14), + new Point(3, 4), + ]); + } + + /** + * Create a linestring Z and persist it in database. + * + * @throws InvalidValueException when geometries are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + * + * @return LineStringEntity + */ + protected function createLineStringZ() + { + return $this->createLineString([ + new Point(2, 5), + new Point(3, 6), + new Point(12, 8), + new Point(10, 10), + new Point(13, 11), + ]); + } + + /** + * Create a straight linestring and persist it in database. + * Line is created with three aligned points: (0 0) (2 2) (5 5). + * + * @throws InvalidValueException when geometries are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + * + * @return LineStringEntity + */ + protected function createStraightLineString() + { + return $this->createLineString([ + new Point(0, 0), + new Point(2, 2), + new Point(5, 5), + ]); + } + + /** + * Create a LineString entity from an array of points. + * + * @param Point[] $points the array of points + * + * @throws InvalidValueException when geometries are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + * + * @return LineStringEntity + */ + private function createLineString(array $points) + { + $lineStringEntity = new LineStringEntity(); + $lineStringEntity->setLineString(new LineString($points)); + $this->getEntityManager()->persist($lineStringEntity); + + return $lineStringEntity; + } +} diff --git a/tests/CrEOF/Spatial/Tests/Helper/PointHelperTrait.php b/tests/CrEOF/Spatial/Tests/Helper/PointHelperTrait.php new file mode 100644 index 00000000..73d54c3d --- /dev/null +++ b/tests/CrEOF/Spatial/Tests/Helper/PointHelperTrait.php @@ -0,0 +1,219 @@ + + * @license http://alexandre-tranchant.mit-license.org MIT + * + * @method EntityManagerInterface getEntityManager Return the entity interface + */ +trait PointHelperTrait +{ + /** + * Create Dallas geography Point entity and store it in database. + * + * @throws InvalidValueException when geographies are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + */ + protected function createDallasGeography(): GeographyEntity + { + return $this->createGeography(new GeographyPoint(-96.803889, 32.782778)); + } + + /** + * Create Dallas geometry Point entity and store it in database. + * + * @throws InvalidValueException when geometries are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + */ + protected function createDallasGeometry(): PointEntity + { + return $this->createGeometry(new GeometryPoint(-96.803889, 32.782778)); + } + + /** + * Create Los Angeles geography Point entity and store it in database. + * + * @throws InvalidValueException when geographies are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + */ + protected function createLosAngelesGeography(): GeographyEntity + { + return $this->createGeography(new GeographyPoint(-118.2430, 34.0522)); + } + + /** + * Create Los Angeles geometry Point entity and store it in database. + * + * @throws InvalidValueException when geometries are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + */ + protected function createLosAngelesGeometry(): PointEntity + { + return $this->createGeometry(new GeometryPoint(-118.2430, 34.0522)); + } + + /** + * Create New York geography Point entity and store it in database. + * + * @throws InvalidValueException when geographies are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + */ + protected function createNewYorkGeography(): GeographyEntity + { + return $this->createGeography(new GeographyPoint(-73.938611, 40.664167)); + } + + /** + * Create New York geometry Point entity and store it in database. + * + * @throws InvalidValueException when geometries are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + */ + protected function createNewYorkGeometry(): PointEntity + { + return $this->createGeometry(new GeometryPoint(-73.938611, 40.664167)); + } + + /** + * Create the point A (1, 2). + * + * @throws InvalidValueException when geometries are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + */ + protected function createPointA(): PointEntity + { + return $this->createGeometry(new GeometryPoint(1, 2)); + } + + /** + * Create the point B (-2, 3). + * + * @throws InvalidValueException when geometries are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + */ + protected function createPointB(): PointEntity + { + return $this->createGeometry(new GeometryPoint(-2, 3)); + } + + /** + * Create the point E (5, 5). + * + * @throws InvalidValueException when geometries are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + */ + protected function createPointE(): PointEntity + { + return $this->createGeometry(new GeometryPoint(5, 5)); + } + + /** + * Create the point origin (0, 0). + * + * @throws InvalidValueException when geometries are not valid + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + */ + protected function createPointO(): PointEntity + { + return $this->createGeometry(new GeometryPoint(0, 0)); + } + + /** + * Create a geographic Point entity from an array of points. + * + * @param GeographyPoint|array $point Point could be an array of X, Y or an instance of Point class + * + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + */ + private function createGeography(GeographyPoint $point): GeographyEntity + { + $pointEntity = new GeographyEntity(); + $pointEntity->setGeography($point); + $this->getEntityManager()->persist($pointEntity); + + return $pointEntity; + } + + /** + * Create a geometric Point entity from an array of points. + * + * @param GeometryPoint|array $point Point could be an array of X, Y or an instance of Point class + * + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + */ + private function createGeometry(GeometryPoint $point): PointEntity + { + $pointEntity = new PointEntity(); + $pointEntity->setPoint($point); + $this->getEntityManager()->persist($pointEntity); + + return $pointEntity; + } +} diff --git a/tests/CrEOF/Spatial/Tests/Helper/PolygonHelperTrait.php b/tests/CrEOF/Spatial/Tests/Helper/PolygonHelperTrait.php new file mode 100644 index 00000000..b67fc18c --- /dev/null +++ b/tests/CrEOF/Spatial/Tests/Helper/PolygonHelperTrait.php @@ -0,0 +1,223 @@ + + * @license http://alexandre-tranchant.mit-license.org MIT + * + * @method EntityManagerInterface getEntityManager Return the entity interface + */ +trait PolygonHelperTrait +{ + /** + * Create the BIG Polygon and persist it in database. + * Square (0 0, 10 10). + * + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + * @throws InvalidValueException when geometries are not valid + * + * @return PolygonEntity + */ + protected function createBigPolygon() + { + return $this->createPolygon([ + new LineString([ + new Point(0, 0), + new Point(10, 0), + new Point(10, 10), + new Point(0, 10), + new Point(0, 0), + ]), + ]); + } + + /** + * Create an eccentric polygon and persist it in database. + * Square (6 6, 10 10). + * + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + * @throws InvalidValueException when geometries are not valid + * + * @return PolygonEntity + */ + protected function createEccentricPolygon() + { + return $this->createPolygon([new LineString([ + new Point(6, 6), + new Point(10, 6), + new Point(10, 10), + new Point(6, 10), + new Point(6, 6), + ])]); + } + + /** + * Create the HOLEY Polygon and persist it in database. + * (Big polygon minus Small Polygon). + * + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + * @throws InvalidValueException when geometries are not valid + * + * @return PolygonEntity + */ + protected function createHoleyPolygon() + { + return $this->createPolygon([ + new LineString([ + new Point(0, 0), + new Point(10, 0), + new Point(10, 10), + new Point(0, 10), + new Point(0, 0), + ]), + new LineString([ + new Point(5, 5), + new Point(7, 5), + new Point(7, 7), + new Point(5, 7), + new Point(5, 5), + ]), + ]); + } + + /** + * Create the Outer Polygon and persist it in database. + * Square (15 15, 17 17). + * + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + * @throws InvalidValueException when geometries are not valid + * + * @return PolygonEntity + */ + protected function createOuterPolygon() + { + return $this->createPolygon([ + new LineString([ + new Point(15, 15), + new Point(17, 15), + new Point(17, 17), + new Point(15, 17), + new Point(15, 15), + ]), + ]); + } + + /** + * Create a Polygon from an array of linestrings. + * + * @param array $lineStrings the array of linestrings + * + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + * @throws InvalidValueException when geometries are not valid + * + * @return PolygonEntity + */ + protected function createPolygon(array $lineStrings) + { + $polygon = new PolygonEntity(); + $polygon->setPolygon(new Polygon($lineStrings)); + $this->getEntityManager()->persist($polygon); + + return $polygon; + } + + /** + * Create the W Polygon and persist it in database. + * + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + * @throws InvalidValueException when geometries are not valid + * + * @return PolygonEntity + */ + protected function createPolygonW() + { + return $this->createPolygon([ + new LineString([ + new Point(0, 0), + new Point(10, 0), + new Point(10, 20), + new Point(0, 20), + new Point(10, 10), + new Point(0, 0), + ]), + ]); + } + + /** + * Create the SMALL Polygon and persist it in database. + * SQUARE (5 5, 7 7). + * + * @throws UnsupportedPlatformException when platform is not supported + * @throws DBALException when credentials fail + * @throws ORMException when cache is not created + * @throws InvalidValueException when geometries are not valid + * + * @return PolygonEntity + */ + protected function createSmallPolygon() + { + return $this->createPolygon([ + new LineString([ + new Point(5, 5), + new Point(7, 5), + new Point(7, 7), + new Point(5, 7), + new Point(5, 5), + ]), + ]); + } +} diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php index 239c811c..f57c6339 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php @@ -26,21 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use CrEOF\Spatial\Tests\TestHelperTrait; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * Area DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -50,7 +45,7 @@ */ class AreaTest extends OrmTestCase { - use TestHelperTrait; + use PolygonHelperTrait; /** * Setup the function type test. @@ -73,8 +68,6 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry @@ -84,18 +77,7 @@ public function testAreaWhere() $this->createBigPolygon(); $this->createHoleyPolygon(); $this->createPolygonW(); - - $ring = [ - new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]), - ]; - - $expected = $this->createPolygon($ring); + $expected = $this->createSmallPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); @@ -114,66 +96,16 @@ public function testAreaWhere() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ public function testSelectArea() { - $ring = [ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]), - ]; - $this->createPolygon($ring); - - $ring = [ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]), - new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]), - ]; - $this->createPolygon($ring); - - $ring = [ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 20), - new Point(0, 20), - new Point(10, 10), - new Point(0, 0), - ]), - ]; - $this->createPolygon($ring); - - $ring = [ - new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]), - ]; - $this->createPolygon($ring); - + $this->createBigPolygon(); + $this->createHoleyPolygon(); + $this->createPolygonW(); + $this->createSmallPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); @@ -187,25 +119,4 @@ public function testSelectArea() $this->assertEquals(100, $result[2][1]); $this->assertEquals(4, $result[3][1]); } - - /** - * Create and persist a polygon from a ring. - * - * @param array $ring The ring to create polygon - * - * @throws DBALException when connection failed - * @throws ORMException when cache is not set - * @throws UnsupportedPlatformException when platform is unsupported - * @throws InvalidValueException when geometries are not valid - * - * @return PolygonEntity - */ - protected function createPolygon(array $ring) - { - $polygonEntity = new PolygonEntity(); - $polygonEntity->setPolygon(new Polygon($ring)); - $this->getEntityManager()->persist($polygonEntity); - - return $polygonEntity; - } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php index f80cc675..f720b910 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php @@ -26,19 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; +use CrEOF\Spatial\Tests\Helper\LineStringHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * AsBinary DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -48,6 +45,8 @@ */ class AsBinaryTest extends OrmTestCase { + use LineStringHelperTrait; + /** * Setup the function type test. * @@ -69,31 +68,12 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid */ public function testAsBinary() { - $lineStringA = [ - new Point(0, 0), - new Point(2, 2), - new Point(5, 5), - ]; - $lineStringB = [ - new Point(3, 3), - new Point(4, 15), - new Point(5, 22), - ]; - $entityA = new LineStringEntity(); - - $entityA->setLineString(new LineString($lineStringA)); - $this->getEntityManager()->persist($entityA); - - $entityB = new LineStringEntity(); - - $entityB->setLineString(new LineString($lineStringB)); - $this->getEntityManager()->persist($entityB); + $this->createStraightLineString(); + $this->createAngularLineString(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php index 61756568..442ab9e6 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php @@ -26,19 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; +use CrEOF\Spatial\Tests\Helper\LineStringHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * AsText DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -48,6 +45,8 @@ */ class AsTextTest extends OrmTestCase { + use LineStringHelperTrait; + /** * Setup the function type test. * @@ -69,28 +68,14 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ public function testAsText() { - $points = [ - new Point(0, 0), - new Point(2, 2), - new Point(5, 5), - ]; - $this->createLinestring($points); - - $points = [ - new Point(3, 3), - new Point(4, 15), - new Point(5, 22), - ]; - $this->createLinestring($points); - + $this->createStraightLineString(); + $this->createAngularLineString(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); @@ -102,26 +87,4 @@ public function testAsText() $this->assertEquals('LINESTRING(0 0,2 2,5 5)', $result[0][1]); $this->assertEquals('LINESTRING(3 3,4 15,5 22)', $result[1][1]); } - - /** - * Create and persist a linestring from an array of points. - * - * @param array $points The points to create linestring - * - * @throws DBALException when connection failed - * @throws ORMException when cache is not set - * @throws UnsupportedPlatformException when platform is unsupported - * @throws InvalidValueException when geometries are not valid - * - * @return LineStringEntity - */ - private function createLinestring(array $points) - { - $entity = new LineStringEntity(); - - $entity->setLineString(new LineString($points)); - $this->getEntityManager()->persist($entity); - - return $entity; - } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php index 0d42a862..7280546b 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php @@ -26,17 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use CrEOF\Spatial\Tests\TestHelperTrait; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * Contains DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -46,7 +45,7 @@ */ class ContainsTest extends OrmTestCase { - use TestHelperTrait; + use PolygonHelperTrait; /** * Setup the function type test. @@ -70,8 +69,6 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry @@ -114,8 +111,6 @@ public function testContainsWhereParameter() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php index 94cca5b7..5cb63709 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php @@ -26,17 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use CrEOF\Spatial\Tests\TestHelperTrait; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * Disjoint DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -46,7 +45,7 @@ */ class DisjointTest extends OrmTestCase { - use TestHelperTrait; + use PolygonHelperTrait; /** * Setup the function type test. @@ -69,8 +68,6 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry @@ -79,7 +76,7 @@ public function testDisjointWhereParameter() { $bigPolygon = $this->createBigPolygon(); $insidePolygon = $this->createSmallPolygon(); - $externalPolygon = $this->createPolygon([$this->createOuterLineString()]); + $externalPolygon = $this->createOuterPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); @@ -114,8 +111,6 @@ public function testDisjointWhereParameter() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry @@ -124,7 +119,7 @@ public function testSelectDisjoint() { $bigPolygon = $this->createBigPolygon(); $insidePolygon = $this->createSmallPolygon(); - $externalPolygon = $this->createPolygon([$this->createOuterLineString()]); + $externalPolygon = $this->createOuterPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php index 4a86421d..5c2202b5 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php @@ -26,17 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use CrEOF\Spatial\Tests\TestHelperTrait; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * Envelope DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -46,7 +45,7 @@ */ class EnvelopeTest extends OrmTestCase { - use TestHelperTrait; + use PolygonHelperTrait; /** * Setup the function type test. @@ -69,8 +68,6 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry @@ -100,8 +97,6 @@ public function testEnvelopeWhereParameter() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php index 0f6edb15..ba1954e1 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php @@ -26,20 +26,17 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; +use CrEOF\Spatial\Tests\Helper\LineStringHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * GLength DQL function tests. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @author Alexandre Tranchant + * @license http://dlambert.mit-license.org MITIT * * @group dql * @@ -48,6 +45,8 @@ */ class GLengthTest extends OrmTestCase { + use LineStringHelperTrait; + /** * Setup the function type test. * @@ -69,23 +68,13 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ public function testLengthWhereParameter() { - $entity = new LineStringEntity(); - - $entity->setLineString(new LineString([ - new Point(0, 0), - new Point(1, 1), - new Point(2, 2), - ])); - - $this->getEntityManager()->persist($entity); + $smallLineString = $this->createStraightLineString(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); @@ -95,12 +84,12 @@ public function testLengthWhereParameter() ); // phpcs:enable - $query->setParameter('p1', 'LINESTRING(0 0,1 1,2 2,3 3,4 4,5 5)', 'string'); + $query->setParameter('p1', 'LINESTRING(0 0,2 2,4 4,6 6,8 8)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity, $result[0]); + $this->assertEquals($smallLineString, $result[0]); } /** @@ -109,23 +98,13 @@ public function testLengthWhereParameter() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ public function testSelectLength() { - $entity = new LineStringEntity(); - - $entity->setLineString(new LineString([ - new Point(0, 0), - new Point(1, 1), - new Point(2, 2), - ])); - - $this->getEntityManager()->persist($entity); + $smallLineString = $this->createStraightLineString(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); @@ -135,7 +114,7 @@ public function testSelectLength() $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity, $result[0][0]); - $this->assertEquals(2.82842712474619, $result[0][1]); + $this->assertEquals($smallLineString, $result[0][0]); + $this->assertEquals(7.0710678118654755, $result[0][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php index 04f704fe..9f1b6474 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php @@ -26,19 +26,17 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\Tests\Fixtures\GeometryEntity; +use CrEOF\Spatial\Tests\Helper\LineStringHelperTrait; +use CrEOF\Spatial\Tests\Helper\PointHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * GeomFromText DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -48,6 +46,9 @@ */ class GeomFromTextTest extends OrmTestCase { + use LineStringHelperTrait; + use PointHelperTrait; + /** * Setup the function type test. * @@ -57,7 +58,8 @@ class GeomFromTextTest extends OrmTestCase */ protected function setUp(): void { - $this->usesEntity(self::GEOMETRY_ENTITY); + $this->usesEntity(self::LINESTRING_ENTITY); + $this->usesEntity(self::POINT_ENTITY); $this->usesType('point'); $this->supportsPlatform('mysql'); @@ -70,31 +72,21 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ public function testLineString() { - $value = [ - new Point(0, 0), - new Point(5, 5), - new Point(10, 10), - ]; - - $linestring = new GeometryEntity(); - $linestring->setGeometry(new LineString($value)); - $this->getEntityManager()->persist($linestring); + $linestring = $this->createStraightLineString(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( - 'SELECT g FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g WHERE g.geometry = GeomFromText(:p1)' + 'SELECT g FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity g WHERE g.lineString = GeomFromText(:p1)' ); - $query->setParameter('p1', 'LINESTRING(0 0,5 5,10 10)', 'string'); + $query->setParameter('p1', 'LINESTRING(0 0,2 2,5 5)', 'string'); $result = $query->getResult(); @@ -108,23 +100,18 @@ public function testLineString() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ public function testPoint() { - $point = new GeometryEntity(); - - $point->setGeometry(new Point(5, 5)); - $this->getEntityManager()->persist($point); + $point = $this->createPointE(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( - 'SELECT g FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g WHERE g.geometry = GeomFromText(:p1)' + 'SELECT g FROM CrEOF\Spatial\Tests\Fixtures\PointEntity g WHERE g.point = GeomFromText(:p1)' ); $query->setParameter('p1', 'POINT(5 5)', 'string'); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php index 20cf21c2..a7a55c5b 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php @@ -26,17 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use CrEOF\Spatial\Tests\TestHelperTrait; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * MBRContains DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -46,7 +45,7 @@ */ class MBRContainsTest extends OrmTestCase { - use TestHelperTrait; + use PolygonHelperTrait; /** * Setup the function type test. @@ -70,8 +69,6 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry @@ -119,8 +116,6 @@ public function testMbrContainsWhereParameter() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php index 305da25c..b0db183d 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php @@ -26,20 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * MBRDisjoint DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -49,6 +45,8 @@ */ class MBRDisjointTest extends OrmTestCase { + use PolygonHelperTrait; + /** * Setup the function type test. * @@ -70,73 +68,45 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testMBRDisjointWhereParameter() + public function testMbrDisjointWhereParameter() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]); - $lineString2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $lineString3 = new LineString([ - new Point(15, 15), - new Point(17, 15), - new Point(17, 17), - new Point(15, 17), - new Point(15, 15), - ]); - - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString2])); - $this->getEntityManager()->persist($entity2); - $this->getEntityManager()->flush(); - - $entity3 = new PolygonEntity(); - - $entity3->setPolygon(new Polygon([$lineString3])); - $this->getEntityManager()->persist($entity3); + $bigPolygon = $this->createBigPolygon(); + $smallPolygon = $this->createSmallPolygon(); + $outerPolygon = $this->createOuterPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE MBRDisjoint(p.polygon, GeomFromText(:p1)) = 1'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE MBRDisjoint(p.polygon, GeomFromText(:p)) = 1' + // phpcs: enable + ); - $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); + $query->setParameter('p', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity3, $result[0]); + $this->assertEquals($outerPolygon, $result[0]); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE MBRDisjoint(p.polygon, GeomFromText(:p1)) = 1'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE MBRDisjoint(p.polygon, GeomFromText(:p)) = 1' + // phpcs: enable + ); - $query->setParameter('p1', 'POLYGON((15 15,17 15,17 17,15 17,15 15))', 'string'); + $query->setParameter('p', 'POLYGON((15 15,17 15,17 17,15 17,15 15))', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0]); - $this->assertEquals($entity2, $result[1]); + $this->assertEquals($bigPolygon, $result[0]); + $this->assertEquals($smallPolygon, $result[1]); } /** @@ -145,66 +115,32 @@ public function testMBRDisjointWhereParameter() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectMBRDisjoint() + public function testSelectMbrDisjoint() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]); - $lineString2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $lineString3 = new LineString([ - new Point(15, 15), - new Point(17, 15), - new Point(17, 17), - new Point(15, 17), - new Point(15, 15), - ]); - - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString2])); - $this->getEntityManager()->persist($entity2); - $this->getEntityManager()->flush(); - - $entity3 = new PolygonEntity(); - - $entity3->setPolygon(new Polygon([$lineString3])); - $this->getEntityManager()->persist($entity3); + $bigPolygon = $this->createBigPolygon(); + $smallPolygon = $this->createSmallPolygon(); + $outerPolygon = $this->createOuterPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, MBRDisjoint(p.polygon, GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p, MBRDisjoint(p.polygon, GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + ); - $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); + $query->setParameter('p1', 'POLYGON((5 5,5 7,7 7,7 5,5 5))', 'string'); $result = $query->getResult(); $this->assertCount(3, $result); - $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals($bigPolygon, $result[0][0]); $this->assertEquals(0, $result[0][1]); - $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals($smallPolygon, $result[1][0]); $this->assertEquals(0, $result[1][1]); - $this->assertEquals($entity3, $result[2][0]); + $this->assertEquals($outerPolygon, $result[2][0]); $this->assertEquals(1, $result[2][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php index bd827490..cc648467 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php @@ -26,19 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; +use CrEOF\Spatial\Tests\Helper\LineStringHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * StartPoint DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -48,6 +45,8 @@ */ class StartPointTest extends OrmTestCase { + use LineStringHelperTrait; + /** * Setup the function type test. * @@ -70,27 +69,19 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ public function testStartPointSelect() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(2, 2), - new Point(5, 5), - ]); - $entity1 = new LineStringEntity(); - - $entity1->setLineString($lineString1); - $this->getEntityManager()->persist($entity1); + $this->createStraightLineString(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT AsText(StartPoint(l.lineString)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); + $query = $this->getEntityManager()->createQuery( + 'SELECT AsText(StartPoint(l.lineString)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l' + ); $result = $query->getResult(); @@ -103,44 +94,29 @@ public function testStartPointSelect() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ public function testStartPointWhereCompareLineString() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(2, 2), - new Point(5, 5), - ]); - $lineString2 = new LineString([ - new Point(3, 3), - new Point(4, 15), - new Point(5, 22), - ]); - $entity1 = new LineStringEntity(); - - $entity1->setLineString($lineString1); - $this->getEntityManager()->persist($entity1); - - $entity2 = new LineStringEntity(); - - $entity2->setLineString($lineString2); - $this->getEntityManager()->persist($entity2); + $this->createStraightLineString(); + $angular = $this->createAngularLineString(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE StartPoint(l.lineString) = StartPoint(GeomFromText(:p1))'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE StartPoint(l.lineString) = StartPoint(GeomFromText(:p1))' + // phpcs:enable + ); $query->setParameter('p1', 'LINESTRING(3 3,4 15,5 22)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity2, $result[0]); + $this->assertEquals($angular, $result[0]); } /** @@ -149,43 +125,28 @@ public function testStartPointWhereCompareLineString() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ public function testStartPointWhereComparePoint() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(2, 2), - new Point(5, 5), - ]); - $lineString2 = new LineString([ - new Point(3, 3), - new Point(4, 15), - new Point(5, 22), - ]); - $entity1 = new LineStringEntity(); - - $entity1->setLineString($lineString1); - $this->getEntityManager()->persist($entity1); - - $entity2 = new LineStringEntity(); - - $entity2->setLineString($lineString2); - $this->getEntityManager()->persist($entity2); + $straight = $this->createStraightLineString(); + $this->createAngularLineString(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE StartPoint(l.lineString) = GeomFromText(:p1)'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE StartPoint(l.lineString) = GeomFromText(:p1)' + // phpcs:enable + ); $query->setParameter('p1', 'POINT(0 0)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity1, $result[0]); + $this->assertEquals($straight, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php index a0756c9e..8923ab6c 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php @@ -26,18 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\Tests\Fixtures\PointEntity; +use CrEOF\Spatial\Tests\Helper\PointHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * Geometry DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -47,6 +45,8 @@ */ class GeometryTest extends OrmTestCase { + use PointHelperTrait; + /** * Setup the function type test. * @@ -68,21 +68,14 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ public function testSelectGeometry() { - $pointA = new PointEntity(); - $pointA->setPoint(new Point(1, 2)); - $this->getEntityManager()->persist($pointA); - $pointB = new PointEntity(); - $pointB->setPoint(new Point(-2, 3)); - $this->getEntityManager()->persist($pointB); - + $this->createPointA(); + $this->createPointB(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php index e6e14344..7e7080ee 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php @@ -26,19 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use CrEOF\Spatial\Tests\TestHelperTrait; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_Area DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -48,7 +45,7 @@ */ class STAreaTest extends OrmTestCase { - use TestHelperTrait; + use PolygonHelperTrait; /** * Setup the function type test. @@ -71,8 +68,6 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry @@ -81,16 +76,7 @@ public function testSelectStArea() { $this->createBigPolygon(); $this->createHoleyPolygon(); - $this->createPolygon([ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 20), - new Point(0, 20), - new Point(10, 10), - new Point(0, 0), - ]), - ]); + $this->createPolygonW(); $smallPolygon = $this->createSmallPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php index 0579badd..738815bc 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php @@ -26,19 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; +use CrEOF\Spatial\Tests\Helper\LineStringHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_AsBinary DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -48,6 +45,8 @@ */ class STAsBinaryTest extends OrmTestCase { + use LineStringHelperTrait; + /** * Setup the function type test. * @@ -69,30 +68,14 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSTAsBinary() + public function testStAsBinary() { - $lineStringA = new LineStringEntity(); - $lineStringA->setLineString(new LineString([ - new Point(0, 0), - new Point(2, 2), - new Point(5, 5), - ])); - $this->getEntityManager()->persist($lineStringA); - - $linestringB = new LineStringEntity(); - $linestringB->setLineString(new LineString([ - new Point(3, 3), - new Point(4, 15), - new Point(5, 22), - ])); - $this->getEntityManager()->persist($linestringB); - + $this->createStraightLineString(); + $this->createAngularLineString(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php index 7eef18ba..5f8fe888 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php @@ -26,19 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; +use CrEOF\Spatial\Tests\Helper\LineStringHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_AsText DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -48,6 +45,8 @@ */ class STAsTextTest extends OrmTestCase { + use LineStringHelperTrait; + /** * Setup the function type test. * @@ -69,31 +68,14 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ public function testStAsText() { - $lineStringA = new LineStringEntity(); - - $lineStringA->setLineString(new LineString([ - new Point(0, 0), - new Point(2, 2), - new Point(5, 5), - ])); - $this->getEntityManager()->persist($lineStringA); - - $lineStringB = new LineStringEntity(); - - $lineStringB->setLineString(new LineString([ - new Point(3, 3), - new Point(4, 15), - new Point(5, 22), - ])); - $this->getEntityManager()->persist($lineStringB); + $this->createStraightLineString(); + $this->createAngularLineString(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php index 1b84782e..cc8447e0 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php @@ -26,15 +26,9 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use CrEOF\Spatial\Tests\TestHelperTrait; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** @@ -50,7 +44,7 @@ */ class STCentroidTest extends OrmTestCase { - use TestHelperTrait; + use PolygonHelperTrait; /** * Setup the function type test. @@ -73,8 +67,6 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php index 1fcb1af8..d2fddae3 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php @@ -26,21 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use CrEOF\Spatial\Tests\TestHelperTrait; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_ClosestPoint DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -50,7 +45,7 @@ */ class STClosestPointTest extends OrmTestCase { - use TestHelperTrait; + use PolygonHelperTrait; /** * Setup the function type test. @@ -74,42 +69,21 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectSTClosestPoint() + public function testSelectStClosestPoint() { - $ring1 = new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]); - $ring2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$ring1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$ring2])); - $this->getEntityManager()->persist($entity2); + $bigPolygon = $this->createBigPolygon(); + $smallPolygon = $this->createSmallPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded 'SELECT p, ST_AsText(ST_ClosestPoint(p.polygon, ST_GeomFromText(:p1))) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + // phpcs:enable ); $query->setParameter('p1', 'POINT(2 2)', 'string'); @@ -117,9 +91,9 @@ public function testSelectSTClosestPoint() $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals($bigPolygon, $result[0][0]); $this->assertEquals('POINT(2 2)', $result[0][1]); - $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals($smallPolygon, $result[1][0]); $this->assertEquals('POINT(5 5)', $result[1][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php index 43ac293b..a5552c66 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php @@ -38,8 +38,10 @@ * ST_Collect DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * + * * @group dql * * @internal @@ -74,7 +76,7 @@ protected function setUp(): void * * @group geometry */ - public function testSelectSTCollect() + public function testSelectStCollect() { $entity = new PointEntity(); $entity->setPoint(new Point(1, 2)); @@ -83,7 +85,11 @@ public function testSelectSTCollect() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(ST_Collect(geometry(p.point), ST_GeomFromText(\'POINT(-2 3)\'))) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT ST_AsText(ST_Collect(geometry(p.point), ST_GeomFromText(\'POINT(-2 3)\'))) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p' + // phpcs:enable + ); $result = $query->getResult(); $expected = [ diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php index 76db9f54..9e487970 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php @@ -26,22 +26,19 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_ContainsProperly DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * + * * @group dql * * @internal @@ -49,6 +46,8 @@ */ class STContainsProperlyTest extends OrmTestCase { + use PolygonHelperTrait; + /** * Setup the function type test. * @@ -70,50 +69,31 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectSTContainsProperly() + public function testSelectStContainsProperly() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]); - $lineString2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString2])); - $this->getEntityManager()->persist($entity2); + $bigPolygon = $this->createBigPolygon(); + $smallPolygon = $this->createSmallPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_ContainsProperly(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT p, ST_ContainsProperly(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + // phpcs: enable + ); $query->setParameter('p1', 'LINESTRING(5 5,7 5,7 7,5 7,5 5)', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals($bigPolygon, $result[0][0]); $this->assertTrue($result[0][1]); - $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals($smallPolygon, $result[1][0]); $this->assertFalse($result[1][1]); } @@ -123,37 +103,14 @@ public function testSelectSTContainsProperly() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSTContainsProperlyWhereParameter() + public function testStContainsProperlyWhereParameter() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]); - $lineString2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString2])); - $this->getEntityManager()->persist($entity2); + $bigPolygon = $this->createBigPolygon(); + $this->createSmallPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); @@ -164,6 +121,6 @@ public function testSTContainsProperlyWhereParameter() $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity1, $result[0]); + $this->assertEquals($bigPolygon, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php index 19f79d8f..a5d05696 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php @@ -26,20 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_Contains DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -49,6 +45,8 @@ */ class STContainsTest extends OrmTestCase { + use PolygonHelperTrait; + /** * Setup the function type test. * @@ -71,50 +69,29 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectSTContains() + public function testSelectStContains() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]); - $lineString2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString2])); - $this->getEntityManager()->persist($entity2); + $bigPolygon = $this->createBigPolygon(); + $smallPolygon = $this->createSmallPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_Contains(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p, ST_Contains(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + ); $query->setParameter('p1', 'POINT(2 2)', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals($bigPolygon, $result[0][0]); $this->assertTrue($result[0][1]); - $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals($smallPolygon, $result[1][0]); $this->assertFalse($result[1][1]); } @@ -124,58 +101,43 @@ public function testSelectSTContains() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSTContainsWhereParameter() + public function testStContainsWhereParameter() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]); - $lineString2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString1, $lineString2])); - $this->getEntityManager()->persist($entity2); + $bigPolygon = $this->createBigPolygon(); + $holeyPolygon = $this->createHoleyPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Contains(p.polygon, ST_GeomFromText(:p1)) = true'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Contains(p.polygon, ST_GeomFromText(:p1)) = true' + // phpcs:enable + ); $query->setParameter('p1', 'POINT(6 6)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity1, $result[0]); + $this->assertEquals($bigPolygon, $result[0]); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Contains(p.polygon, ST_GeomFromText(:p1)) = true'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Contains(p.polygon, ST_GeomFromText(:p1)) = true' + // phpcs:enable + ); $query->setParameter('p1', 'POINT(2 2)', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0]); - $this->assertEquals($entity2, $result[1]); + $this->assertEquals($bigPolygon, $result[0]); + $this->assertEquals($holeyPolygon, $result[1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php index cf4465c8..7ed35b3d 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php @@ -26,20 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_CoveredBy DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -49,6 +45,8 @@ */ class STCoveredByTest extends OrmTestCase { + use PolygonHelperTrait; + /** * Setup the function type test. * @@ -70,51 +68,33 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectSTCoveredBy() + public function testSelectStCoveredBy() { - $lineString1 = new LineString([ - new Point(6, 6), - new Point(10, 6), - new Point(10, 10), - new Point(6, 10), - new Point(6, 6), - ]); - $lineString2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString2])); - $this->getEntityManager()->persist($entity2); + $bigPolygon = $this->createBigPolygon(); + $eccentricPolygon = $this->createEccentricPolygon(); + $smallPolygon = $this->createSmallPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_CoveredBy(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p, ST_CoveredBy(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + ); $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); $result = $query->getResult(); - $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0][0]); + $this->assertCount(3, $result); + $this->assertEquals($bigPolygon, $result[0][0]); $this->assertFalse($result[0][1]); - $this->assertEquals($entity2, $result[1][0]); - $this->assertTrue($result[1][1]); + $this->assertEquals($eccentricPolygon, $result[1][0]); + $this->assertFalse($result[1][1]); + $this->assertEquals($smallPolygon, $result[2][0]); + $this->assertTrue($result[2][1]); } /** @@ -123,47 +103,29 @@ public function testSelectSTCoveredBy() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSTCoveredByWhereParameter() + public function testStCoveredByWhereParameter() { - $lineString1 = new LineString([ - new Point(6, 6), - new Point(10, 6), - new Point(10, 10), - new Point(6, 10), - new Point(6, 6), - ]); - $lineString2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString2])); - $this->getEntityManager()->persist($entity2); + $this->createBigPolygon(); + $this->createEccentricPolygon(); + $smallPolygon = $this->createSmallPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_CoveredBy(p.polygon, ST_GeomFromText(:p1)) = true'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_CoveredBy(p.polygon, ST_GeomFromText(:p1)) = true' + // phpcs:enable + ); $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity2, $result[0]); + $this->assertEquals($smallPolygon, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php index d3b76788..40012c12 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php @@ -26,20 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_Covers DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -49,6 +45,8 @@ */ class STCoversTest extends OrmTestCase { + use PolygonHelperTrait; + /** * Setup the function type test. * @@ -70,50 +68,29 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectSTCovers() + public function testSelectStCovers() { - $lineString1 = new LineString([ - new Point(6, 6), - new Point(10, 6), - new Point(10, 10), - new Point(6, 10), - new Point(6, 6), - ]); - $lineString2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString2])); - $this->getEntityManager()->persist($entity2); + $eccentricPolygon = $this->createEccentricPolygon(); + $smallPolygon = $this->createSmallPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_Covers(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p, ST_Covers(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + ); $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals($eccentricPolygon, $result[0][0]); $this->assertFalse($result[0][1]); - $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals($smallPolygon, $result[1][0]); $this->assertTrue($result[1][1]); } @@ -123,47 +100,28 @@ public function testSelectSTCovers() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSTCoversWhereParameter() + public function testStCoversWhereParameter() { - $lineString1 = new LineString([ - new Point(6, 6), - new Point(10, 6), - new Point(10, 10), - new Point(6, 10), - new Point(6, 6), - ]); - $lineString2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString2])); - $this->getEntityManager()->persist($entity2); + $this->createEccentricPolygon(); + $smallPolygon = $this->createSmallPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Covers(p.polygon, ST_GeomFromText(:p1)) = true'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Covers(p.polygon, ST_GeomFromText(:p1)) = true' + // phpcs:enable + ); $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity2, $result[0]); + $this->assertEquals($smallPolygon, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php index 756ccbe6..af330029 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php @@ -26,19 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; +use CrEOF\Spatial\Tests\Helper\LineStringHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_Crosses DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -48,6 +45,8 @@ */ class STCrossesTest extends OrmTestCase { + use LineStringHelperTrait; + /** * Setup the function type test. * @@ -69,56 +68,34 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectSTCrosses() + public function testSelectStCrosses() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(10, 10), - ]); - $lineString2 = new LineString([ - new Point(0, 10), - new Point(15, 0), - ]); - $lineString3 = new LineString([ - new Point(2, 0), - new Point(12, 10), - ]); - - $entity1 = new LineStringEntity(); - - $entity1->setLineString($lineString1); - $this->getEntityManager()->persist($entity1); - - $entity2 = new LineStringEntity(); - - $entity2->setLineString($lineString2); - $this->getEntityManager()->persist($entity2); - - $entity3 = new LineStringEntity(); - - $entity3->setLineString($lineString3); - $this->getEntityManager()->persist($entity3); + $lineStringA = $this->createLineStringA(); + $lineStringB = $this->createLineStringB(); + $lineStringC = $this->createLineStringC(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l, ST_Crosses(l.lineString, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT l, ST_Crosses(l.lineString, ST_GeomFromText(:p)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l' + // phpcs:enable + ); - $query->setParameter('p1', 'LINESTRING(0 0, 10 10)', 'string'); + $query->setParameter('p', 'LINESTRING(0 0, 10 10)', 'string'); $result = $query->getResult(); $this->assertCount(3, $result); - $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals($lineStringA, $result[0][0]); $this->assertFalse($result[0][1]); - $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals($lineStringB, $result[1][0]); $this->assertTrue($result[1][1]); - $this->assertEquals($entity3, $result[2][0]); + $this->assertEquals($lineStringC, $result[2][0]); $this->assertFalse($result[2][1]); } @@ -128,61 +105,43 @@ public function testSelectSTCrosses() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSTCrossesWhereParameter() + public function testStCrossesWhereParameter() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(10, 10), - ]); - $lineString2 = new LineString([ - new Point(0, 10), - new Point(15, 0), - ]); - $lineString3 = new LineString([ - new Point(2, 0), - new Point(12, 10), - ]); - - $entity1 = new LineStringEntity(); - - $entity1->setLineString($lineString1); - $this->getEntityManager()->persist($entity1); - - $entity2 = new LineStringEntity(); - - $entity2->setLineString($lineString2); - $this->getEntityManager()->persist($entity2); - - $entity3 = new LineStringEntity(); - - $entity3->setLineString($lineString3); - $this->getEntityManager()->persist($entity3); + $this->createLineStringA(); + $lineStringB = $this->createLineStringB(); + $this->createLineStringC(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_Crosses(l.lineString, ST_GeomFromText(:p1)) = true'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_Crosses(l.lineString, ST_GeomFromText(:p1)) = true' + // phpcs:enable + ); $query->setParameter('p1', 'LINESTRING(0 0, 10 10)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity2, $result[0]); + $this->assertEquals($lineStringB, $result[0]); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_Crosses(l.lineString, ST_GeomFromText(:p1)) = true'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_Crosses(l.lineString, ST_GeomFromText(:p1)) = true' + // phpcs:enable + ); $query->setParameter('p1', 'LINESTRING(2 0, 12 10)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity2, $result[0]); + $this->assertEquals($lineStringB, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php index 6e4935cb..80f129af 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php @@ -26,20 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_Disjoint DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -49,6 +45,8 @@ */ class STDisjointTest extends OrmTestCase { + use PolygonHelperTrait; + /** * Setup the function type test. * @@ -70,66 +68,32 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectSTDisjoint() + public function testSelectStDisjoint() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]); - $lineString2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $lineString3 = new LineString([ - new Point(15, 15), - new Point(17, 15), - new Point(17, 17), - new Point(15, 17), - new Point(15, 15), - ]); - - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString2])); - $this->getEntityManager()->persist($entity2); - $this->getEntityManager()->flush(); - - $entity3 = new PolygonEntity(); - - $entity3->setPolygon(new Polygon([$lineString3])); - $this->getEntityManager()->persist($entity3); + $bigPolygon = $this->createBigPolygon(); + $smallPolygon = $this->createSmallPolygon(); + $outerPolygon = $this->createOuterPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_Disjoint(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p, ST_Disjoint(p.polygon, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + ); $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); $result = $query->getResult(); $this->assertCount(3, $result); - $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals($bigPolygon, $result[0][0]); $this->assertFalse($result[0][1]); - $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals($smallPolygon, $result[1][0]); $this->assertFalse($result[1][1]); - $this->assertEquals($entity3, $result[2][0]); + $this->assertEquals($outerPolygon, $result[2][0]); $this->assertTrue($result[2][1]); } @@ -139,72 +103,45 @@ public function testSelectSTDisjoint() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSTDisjointWhereParameter() + public function testStDisjointWhereParameter() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]); - $lineString2 = new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]); - $lineString3 = new LineString([ - new Point(15, 15), - new Point(17, 15), - new Point(17, 17), - new Point(15, 17), - new Point(15, 15), - ]); - - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString2])); - $this->getEntityManager()->persist($entity2); - $this->getEntityManager()->flush(); - - $entity3 = new PolygonEntity(); + $bigPolygon = $this->createBigPolygon(); + $smallPolygon = $this->createSmallPolygon(); + $outerPolygon = $this->createOuterPolygon(); - $entity3->setPolygon(new Polygon([$lineString3])); - $this->getEntityManager()->persist($entity3); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Disjoint(p.polygon, ST_GeomFromText(:p1)) = true'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Disjoint(p.polygon, ST_GeomFromText(:p1)) = true' + // phpcs:enable + ); $query->setParameter('p1', 'POLYGON((5 5,7 5,7 7,5 7,5 5))', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity3, $result[0]); + $this->assertEquals($outerPolygon, $result[0]); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Disjoint(p.polygon, ST_GeomFromText(:p1)) = true'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Disjoint(p.polygon, ST_GeomFromText(:p1)) = true' + // phpcs:enable + ); $query->setParameter('p1', 'POLYGON((15 15,17 15,17 17,15 17,15 15))', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0]); - $this->assertEquals($entity2, $result[1]); + $this->assertEquals($bigPolygon, $result[0]); + $this->assertEquals($smallPolygon, $result[1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php index 41cbd392..326fa979 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php @@ -26,18 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\Tests\Fixtures\PointEntity; +use CrEOF\Spatial\Tests\Helper\PointHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_Distance_Sphere DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -47,6 +45,8 @@ */ class STDistanceSphereTest extends OrmTestCase { + use PointHelperTrait; + /** * Setup the function type test. * @@ -68,47 +68,32 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectSTDistanceSphereGeometry() + public function testSelectStDistanceSphereGeometry() { - $newYork = new Point(-73.938611, 40.664167); - $losAngles = new Point(-118.2430, 34.0522); - $dallas = new Point(-96.803889, 32.782778); - - $entity1 = new PointEntity(); - - $entity1->setPoint($newYork); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PointEntity(); - - $entity2->setPoint($losAngles); - $this->getEntityManager()->persist($entity2); - - $entity3 = new PointEntity(); - - $entity3->setPoint($dallas); - $this->getEntityManager()->persist($entity3); + $newYork = $this->createNewYorkGeometry(); + $losAngeles = $this->createLosAngelesGeometry(); + $dallas = $this->createDallasGeometry(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT p, ST_Distance_Sphere(p.point, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT p, ST_Distance_Sphere(p.point, ST_GeomFromText(:p)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p' + ); - $query->setParameter('p1', 'POINT(-89.4 43.066667)', 'string'); + $query->setParameter('p', 'POINT(-89.4 43.066667)', 'string'); $result = $query->getResult(); $this->assertCount(3, $result); - $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals($newYork, $result[0][0]); $this->assertEquals(1305895.94823465, $result[0][1]); - $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals($losAngeles, $result[1][0]); $this->assertEquals(2684082.08249337, $result[1][1]); - $this->assertEquals($entity3, $result[2][0]); + $this->assertEquals($dallas, $result[2][0]); $this->assertEquals(1313754.60684762, $result[2][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php index c3eddbcf..2671275e 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php @@ -26,21 +26,17 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geography\Point as GeographyPoint; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\Tests\Fixtures\GeographyEntity; -use CrEOF\Spatial\Tests\Fixtures\PointEntity; +use CrEOF\Spatial\Tests\Helper\PointHelperTrait; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use CrEOF\Spatial\Tests\TestHelperTrait; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_Distance DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -50,7 +46,8 @@ */ class STDistanceTest extends OrmTestCase { - use TestHelperTrait; + use PointHelperTrait; + use PolygonHelperTrait; /** * Setup the function type test. @@ -75,30 +72,22 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geography */ public function testSelectStDistanceGeographyCartesian() { - $newYork = new GeographyEntity(); - $newYork->setGeography(new GeographyPoint(-73.938611, 40.664167)); - $this->getEntityManager()->persist($newYork); - - $losAngeles = new GeographyEntity(); - $losAngeles->setGeography(new GeographyPoint(-118.2430, 34.0522)); - $this->getEntityManager()->persist($losAngeles); - - $dallas = new GeographyEntity(); - $dallas->setGeography(new GeographyPoint(-96.803889, 32.782778)); - $this->getEntityManager()->persist($dallas); + $newYork = $this->createNewYorkGeography(); + $losAngeles = $this->createLosAngelesGeography(); + $dallas = $this->createDallasGeography(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded 'SELECT g, ST_Distance(g.geography, ST_GeographyFromText(:p1), false) FROM CrEOF\Spatial\Tests\Fixtures\GeographyEntity g' + // phpcs:enable ); $query->setParameter('p1', 'POINT(-89.4 43.066667)', 'string'); @@ -120,31 +109,22 @@ public function testSelectStDistanceGeographyCartesian() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geography */ public function testSelectStDistanceGeographySpheroid() { - $newYork = new GeographyEntity(); - $newYork->setGeography(new GeographyPoint(-73.938611, 40.664167)); - $this->getEntityManager()->persist($newYork); - - $losAngeles = new GeographyEntity(); - $losAngeles->setGeography(new GeographyPoint(-118.2430, 34.0522)); - $this->getEntityManager()->persist($losAngeles); - - $dallas = new GeographyEntity(); - $dallas->setGeography(new GeographyPoint(-96.803889, 32.782778)); - $this->getEntityManager()->persist($dallas); - + $newYork = $this->createNewYorkGeography(); + $losAngeles = $this->createLosAngelesGeography(); + $dallas = $this->createDallasGeography(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded 'SELECT g, ST_Distance(g.geography, ST_GeographyFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\GeographyEntity g' + // phpcs:enable ); $query->setParameter('p1', 'POINT(-89.4 43.066667)', 'string'); @@ -166,26 +146,15 @@ public function testSelectStDistanceGeographySpheroid() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ public function testSelectStDistanceGeometryCartesian() { - $newYork = new PointEntity(); - $newYork->setPoint(new Point(-73.938611, 40.664167)); - $this->getEntityManager()->persist($newYork); - - $losAngeles = new PointEntity(); - $losAngeles->setPoint(new Point(-118.2430, 34.0522)); - $this->getEntityManager()->persist($losAngeles); - - $dallas = new PointEntity(); - $dallas->setPoint(new Point(-96.803889, 32.782778)); - $this->getEntityManager()->persist($dallas); - + $newYork = $this->createNewYorkGeometry(); + $losAngeles = $this->createLosAngelesGeometry(); + $dallas = $this->createDallasGeometry(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php index 78b78014..5c34b1eb 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php @@ -26,12 +26,8 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use CrEOF\Spatial\Tests\TestHelperTrait; use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; use Doctrine\ORM\OptimisticLockException; @@ -41,6 +37,7 @@ * ST_Envelope DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -50,7 +47,7 @@ */ class STEnvelopeTest extends OrmTestCase { - use TestHelperTrait; + use PolygonHelperTrait; /** * Setup the function type test. @@ -73,52 +70,20 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectSTEnvelope() + public function testSelectStEnvelope() { - $entity1 = new PolygonEntity(); - $rings1 = [ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]), - ]; - - $entity1->setPolygon(new Polygon($rings1)); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - $rings2 = [ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]), - new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]), - ]; - - $entity2->setPolygon(new Polygon($rings2)); - $this->getEntityManager()->persist($entity2); + $this->createBigPolygon(); + $this->createHoleyPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(ST_Envelope(p.polygon)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT ST_AsText(ST_Envelope(p.polygon)) FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + ); $result = $query->getResult(); $this->assertEquals('POLYGON((0 0,0 10,10 10,10 0,0 0))', $result[0][1]); @@ -139,45 +104,15 @@ public function testSelectSTEnvelope() */ public function testSTEnvelopeWhereParameter() { - $entity1 = new PolygonEntity(); - $rings1 = [ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]), - new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]), - ]; - - $entity1->setPolygon(new Polygon($rings1)); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - $rings2 = [ - new LineString([ - new Point(5, 5), - new Point(7, 5), - new Point(7, 7), - new Point(5, 7), - new Point(5, 5), - ]), - ]; - - $entity2->setPolygon(new Polygon($rings2)); - $this->getEntityManager()->persist($entity2); + $holeyPolygon = $this->createHoleyPolygon(); + $this->createSmallPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded 'SELECT p FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p WHERE ST_Envelope(p.polygon) = ST_GeomFromText(:p)' + // phpcs:enable ); $query->setParameter('p', 'POLYGON((0 0,0 10,10 10,10 0,0 0))', 'string'); @@ -185,6 +120,6 @@ public function testSTEnvelopeWhereParameter() $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity1, $result[0]); + $this->assertEquals($holeyPolygon, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php index b5c3ecad..58560395 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php @@ -26,19 +26,17 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\Tests\Fixtures\GeometryEntity; +use CrEOF\Spatial\Tests\Helper\LineStringHelperTrait; +use CrEOF\Spatial\Tests\Helper\PointHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_GeomFromText DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -48,6 +46,9 @@ */ class STGeomFromTextTest extends OrmTestCase { + use LineStringHelperTrait; + use PointHelperTrait; + /** * Setup the function type test. * @@ -57,7 +58,8 @@ class STGeomFromTextTest extends OrmTestCase */ protected function setUp(): void { - $this->usesEntity(self::GEOMETRY_ENTITY); + $this->usesEntity(self::LINESTRING_ENTITY); + $this->usesEntity(self::POINT_ENTITY); $this->supportsPlatform('postgresql'); parent::setUp(); @@ -69,35 +71,28 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ public function testLineString() { - $value = [ - new Point(0, 0), - new Point(5, 5), - new Point(10, 10), - ]; - - $entity1 = new GeometryEntity(); - - $entity1->setGeometry(new LineString($value)); - $this->getEntityManager()->persist($entity1); + $lineString = $this->createStraightLineString(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT g FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g WHERE g.geometry = ST_GeomFromText(:geometry)'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT g FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity g WHERE g.lineString = ST_GeomFromText(:geometry)' + // phpcs:enable + ); - $query->setParameter('geometry', 'LINESTRING(0 0,5 5,10 10)', 'string'); + $query->setParameter('geometry', 'LINESTRING(0 0,2 2,5 5)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity1, $result[0]); + $this->assertEquals($lineString, $result[0]); } /** @@ -106,28 +101,25 @@ public function testLineString() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ public function testPoint() { - $entity1 = new GeometryEntity(); - - $entity1->setGeometry(new Point(5, 5)); - $this->getEntityManager()->persist($entity1); + $pointA = $this->createPointA(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT g FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g WHERE g.geometry = ST_GeomFromText(:geometry)'); + $query = $this->getEntityManager()->createQuery( + 'SELECT g FROM CrEOF\Spatial\Tests\Fixtures\PointEntity g WHERE g.point = ST_GeomFromText(:geometry)' + ); - $query->setParameter('geometry', 'POINT(5 5)', 'string'); + $query->setParameter('geometry', 'POINT(1 2)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity1, $result[0]); + $this->assertEquals($pointA, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php index 2ef9344c..2b759ea6 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php @@ -26,19 +26,17 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; +use CrEOF\Spatial\Tests\Helper\LineStringHelperTrait; +use CrEOF\Spatial\Tests\Helper\PointHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_Length DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -48,6 +46,9 @@ */ class STLengthTest extends OrmTestCase { + use LineStringHelperTrait; + use PointHelperTrait; + /** * Setup the function type test. * @@ -69,34 +70,24 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectSTLength() + public function testSelectStLength() { - $entity = new LineStringEntity(); - - $entity->setLineString(new LineString( - [ - new Point(0, 0), - new Point(1, 1), - new Point(2, 2), - ]) - ); - - $this->getEntityManager()->persist($entity); + $angularLineString = $this->createAngularLineString(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l, ST_Length(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); + $query = $this->getEntityManager()->createQuery( + 'SELECT l, ST_Length(l.lineString) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l' + ); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity, $result[0][0]); - $this->assertEquals(2.82842712474619, $result[0][1]); + $this->assertEquals($angularLineString, $result[0][0]); + $this->assertEquals(19.1126623906578, $result[0][1]); } /** @@ -105,35 +96,27 @@ public function testSelectSTLength() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSTLengthWhereParameter() + public function testStLengthWhereParameter() { - $entity = new LineStringEntity(); - - $entity->setLineString(new LineString( - [ - new Point(0, 0), - new Point(1, 1), - new Point(2, 2), - ]) - ); - - $this->getEntityManager()->persist($entity); + $angularLineString = $this->createAngularLineString(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_Length(ST_GeomFromText(:p1)) > ST_Length(l.lineString)'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_Length(ST_GeomFromText(:p1)) > ST_Length(l.lineString)' + // phpcs:enable + ); - $query->setParameter('p1', 'LINESTRING(0 0,1 1,2 2,3 3)', 'string'); + $query->setParameter('p1', 'LINESTRING(0 0,21 21)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity, $result[0]); + $this->assertEquals($angularLineString, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php index 92359512..82f7a2cd 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php @@ -26,19 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; +use CrEOF\Spatial\Tests\Helper\LineStringHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_LineCrossingDirection DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -48,6 +45,8 @@ */ class STLineCrossingDirectionTest extends OrmTestCase { + use LineStringHelperTrait; + /** * Setup the function type test. * @@ -69,59 +68,34 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectSTLineCrossingDirection() + public function testSelectStLineCrossingDirection() { - $lineString1 = new LineString([ - new Point(8, 15), - new Point(4, 8), - ]); - $lineString2 = new LineString([ - new Point(12, 14), - new Point(3, 4), - ]); - $lineString3 = new LineString([ - new Point(2, 5), - new Point(3, 6), - new Point(12, 8), - new Point(10, 10), - new Point(13, 11), - ]); - - $entity1 = new LineStringEntity(); - - $entity1->setLineString($lineString1); - $this->getEntityManager()->persist($entity1); - - $entity2 = new LineStringEntity(); - - $entity2->setLineString($lineString2); - $this->getEntityManager()->persist($entity2); - - $entity3 = new LineStringEntity(); - - $entity3->setLineString($lineString3); - $this->getEntityManager()->persist($entity3); + $lineStringX = $this->createLineStringX(); + $lineStringY = $this->createLineStringY(); + $lineStringZ = $this->createLineStringZ(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l, ST_LineCrossingDirection(l.lineString, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT l, ST_LineCrossingDirection(l.lineString, ST_GeomFromText(:p1)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l' + // phpcs:enable + ); $query->setParameter('p1', 'LINESTRING(12 6,5 11,8 12,5 15)', 'string'); $result = $query->getResult(); $this->assertCount(3, $result); - $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals($lineStringX, $result[0][0]); $this->assertEquals(2, $result[0][1]); - $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals($lineStringY, $result[1][0]); $this->assertEquals(1, $result[1][1]); - $this->assertEquals($entity3, $result[2][0]); + $this->assertEquals($lineStringZ, $result[2][0]); $this->assertEquals(-1, $result[2][1]); } @@ -131,54 +105,29 @@ public function testSelectSTLineCrossingDirection() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSTLineCrossingDirectionWhereParameter() + public function testStLineCrossingDirectionWhereParameter() { - $lineString1 = new LineString([ - new Point(8, 15), - new Point(4, 8), - ]); - $lineString2 = new LineString([ - new Point(12, 14), - new Point(3, 4), - ]); - $lineString3 = new LineString([ - new Point(2, 5), - new Point(3, 6), - new Point(12, 8), - new Point(10, 10), - new Point(13, 11), - ]); - - $entity1 = new LineStringEntity(); - - $entity1->setLineString($lineString1); - $this->getEntityManager()->persist($entity1); - - $entity2 = new LineStringEntity(); - - $entity2->setLineString($lineString2); - $this->getEntityManager()->persist($entity2); - - $entity3 = new LineStringEntity(); - - $entity3->setLineString($lineString3); - $this->getEntityManager()->persist($entity3); + $this->createLineStringX(); + $lineStringY = $this->createLineStringY(); + $this->createLineStringZ(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_LineCrossingDirection(l.lineString, ST_GeomFromText(:p1)) = 1'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_LineCrossingDirection(l.lineString, ST_GeomFromText(:p1)) = 1' + // phpcs:enable + ); $query->setParameter('p1', 'LINESTRING(12 6,5 11,8 12,5 15)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity2, $result[0]); + $this->assertEquals($lineStringY, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php index ea9b55dd..c97bae56 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php @@ -26,20 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_MakeEnvelope DQL function tests. * - * @author Dragos Protung + * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -49,6 +45,8 @@ */ class STMakeEnvelopeTest extends OrmTestCase { + use PolygonHelperTrait; + /** * Setup the function type test. * @@ -70,30 +68,13 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectSTMakeEnvelope() + public function testSelectStMakeEnvelope() { - $entity = new PolygonEntity(); - $rings = [ - new LineString( - [ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ] - ), - ]; - - $entity->setPolygon(new Polygon($rings)); - $this->getEntityManager()->persist($entity); - + $this->createBigPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php index ded05665..8fea6f95 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php @@ -26,20 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_Overlaps DQL function tests. * - * @author Dragos Protung + * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -49,6 +45,8 @@ */ class STOverlapsTest extends OrmTestCase { + use PolygonHelperTrait; + /** * Setup the function type test. * @@ -70,50 +68,29 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectSTMakeEnvelope() + public function testSelectStMakeEnvelope() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(2, 0), - new Point(2, 2), - new Point(0, 2), - new Point(0, 0), - ]); - $lineString2 = new LineString([ - new Point(2, 2), - new Point(7, 2), - new Point(7, 7), - new Point(2, 7), - new Point(2, 2), - ]); - $entity1 = new PolygonEntity(); - - $entity1->setPolygon(new Polygon([$lineString1])); - $this->getEntityManager()->persist($entity1); - - $entity2 = new PolygonEntity(); - - $entity2->setPolygon(new Polygon([$lineString2])); - $this->getEntityManager()->persist($entity2); + $bigPolygon = $this->createBigPolygon(); + $smallPolygon = $this->createSmallPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded 'SELECT p as point, ST_Overlaps(p.polygon, ST_Buffer(ST_GeomFromText(:p1), 3)) as overlap FROM CrEOF\Spatial\Tests\Fixtures\PolygonEntity p' + // phpcs:enable ); - $query->setParameter('p1', 'POINT(0 0)', 'string'); + $query->setParameter('p1', 'POINT(4 4)', 'string'); $result = $query->getResult(); $this->assertCount(2, $result); - $this->assertEquals($entity1, $result[0]['point']); + $this->assertEquals($bigPolygon, $result[0]['point']); $this->assertFalse($result[0]['overlap']); - $this->assertEquals($entity2, $result[1]['point']); + $this->assertEquals($smallPolygon, $result[1]['point']); $this->assertTrue($result[1]['overlap']); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php index 90935469..de290dec 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php @@ -28,16 +28,16 @@ use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\Point; use CrEOF\Spatial\Tests\Fixtures\PointEntity; +use CrEOF\Spatial\Tests\Helper\PointHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_SnapToGrid DQL function tests. * - * @author Dragos Protung + * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -47,6 +47,8 @@ */ class STSnapToGridTest extends OrmTestCase { + use PointHelperTrait; + /** * Setup the function type test. * @@ -63,18 +65,16 @@ protected function setUp(): void } /** - * Test a DQL containing function with 2 paramaters to test in the select. + * Test a DQL containing function with 2 parameters to test in the select. * * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectSTSnapToGridSignature2Parameters() + public function testSelectStSnapToGridSignature2Parameters() { $entity = new PointEntity(); $entity->setPoint(new Point(1.25, 2.55)); @@ -83,7 +83,9 @@ public function testSelectSTSnapToGridSignature2Parameters() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(ST_SnapToGrid(geometry(p.point), 0.5)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT ST_AsText(ST_SnapToGrid(geometry(p.point), 0.5)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p' + ); $result = $query->getResult(); $expected = [ @@ -99,13 +101,11 @@ public function testSelectSTSnapToGridSignature2Parameters() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectSTSnapToGridSignature3Parameters() + public function testSelectStSnapToGridSignature3Parameters() { $entity = new PointEntity(); $entity->setPoint(new Point(1.25, 2.55)); @@ -114,7 +114,9 @@ public function testSelectSTSnapToGridSignature3Parameters() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(ST_SnapToGrid(geometry(p.point), 0.5, 1)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); + $query = $this->getEntityManager()->createQuery( + 'SELECT ST_AsText(ST_SnapToGrid(geometry(p.point), 0.5, 1)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p' + ); $result = $query->getResult(); $expected = [ @@ -130,13 +132,11 @@ public function testSelectSTSnapToGridSignature3Parameters() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectSTSnapToGridSignature5Parameters() + public function testSelectStSnapToGridSignature5Parameters() { $entity = new PointEntity(); $entity->setPoint(new Point(5.25, 6.55)); @@ -145,7 +145,11 @@ public function testSelectSTSnapToGridSignature5Parameters() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(ST_SnapToGrid(geometry(p.point), 5.55, 6.25, 0.5, 0.5)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT ST_AsText(ST_SnapToGrid(geometry(p.point), 5.55, 6.25, 0.5, 0.5)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p' + // phpcs:enable + ); $result = $query->getResult(); $expected = [ @@ -161,13 +165,11 @@ public function testSelectSTSnapToGridSignature5Parameters() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSelectSTSnapToGridSignature6Parameters() + public function testSelectStSnapToGridSignature6Parameters() { $entity = new PointEntity(); $entity->setPoint(new Point(5.25, 6.55)); @@ -176,7 +178,11 @@ public function testSelectSTSnapToGridSignature6Parameters() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(ST_SnapToGrid(geometry(p.point), geometry(p.point), 0.005, 0.025, 0.5, 0.01)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT ST_AsText(ST_SnapToGrid(geometry(p.point), geometry(p.point), 0.005, 0.025, 0.5, 0.01)) FROM CrEOF\Spatial\Tests\Fixtures\PointEntity p' + // phpcs:enable + ); $result = $query->getResult(); $expected = [ diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php index 6eb5bbdc..085e6fd2 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php @@ -26,19 +26,16 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; +use CrEOF\Spatial\Tests\Helper\LineStringHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** * ST_StartPoint DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -48,6 +45,8 @@ */ class STStartPointTest extends OrmTestCase { + use LineStringHelperTrait; + /** * Setup the function type test. * @@ -69,27 +68,19 @@ protected function setUp(): void * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSTStartPointSelect() + public function testStStartPointSelect() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(2, 2), - new Point(5, 5), - ]); - $entity1 = new LineStringEntity(); - - $entity1->setLineString($lineString1); - $this->getEntityManager()->persist($entity1); + $this->createStraightLineString(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT ST_AsText(ST_StartPoint(l.lineString)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l'); + $query = $this->getEntityManager()->createQuery( + 'SELECT ST_AsText(ST_StartPoint(l.lineString)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l' + ); $result = $query->getResult(); @@ -102,44 +93,29 @@ public function testSTStartPointSelect() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSTStartPointWhereCompareLineString() + public function testStStartPointWhereCompareLineString() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(2, 2), - new Point(5, 5), - ]); - $lineString2 = new LineString([ - new Point(3, 3), - new Point(4, 15), - new Point(5, 22), - ]); - $entity1 = new LineStringEntity(); - - $entity1->setLineString($lineString1); - $this->getEntityManager()->persist($entity1); - - $entity2 = new LineStringEntity(); - - $entity2->setLineString($lineString2); - $this->getEntityManager()->persist($entity2); + $this->createStraightLineString(); + $angularLineString = $this->createAngularLineString(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_StartPoint(l.lineString) = ST_StartPoint(ST_GeomFromText(:p1))'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_StartPoint(l.lineString) = ST_StartPoint(ST_GeomFromText(:p1))' + // phpcs:enable + ); $query->setParameter('p1', 'LINESTRING(3 3, 4 15, 5 22)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity2, $result[0]); + $this->assertEquals($angularLineString, $result[0]); } /** @@ -148,43 +124,29 @@ public function testSTStartPointWhereCompareLineString() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSTStartPointWhereComparePoint() + public function testStStartPointWhereComparePoint() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(2, 2), - new Point(5, 5), - ]); - $lineString2 = new LineString([ - new Point(3, 3), - new Point(4, 15), - new Point(5, 22), - ]); - $entity1 = new LineStringEntity(); - - $entity1->setLineString($lineString1); - $this->getEntityManager()->persist($entity1); - - $entity2 = new LineStringEntity(); - - $entity2->setLineString($lineString2); - $this->getEntityManager()->persist($entity2); + $straightLineString = $this->createStraightLineString(); + $this->createAngularLineString(); + $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_StartPoint(l.lineString) = ST_GeomFromText(:p1)'); + $query = $this->getEntityManager()->createQuery( + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'SELECT l FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l WHERE ST_StartPoint(l.lineString) = ST_GeomFromText(:p1)' + // phpcs:enable + ); $query->setParameter('p1', 'POINT(0 0)', 'string'); $result = $query->getResult(); $this->assertCount(1, $result); - $this->assertEquals($entity1, $result[0]); + $this->assertEquals($straightLineString, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php index 1b5a5f9c..bee1cab9 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php @@ -29,9 +29,9 @@ use CrEOF\Spatial\PHP\Types\Geography\LineString as GeographyLineString; use CrEOF\Spatial\PHP\Types\Geography\Point as GeographyPoint; use CrEOF\Spatial\PHP\Types\Geography\Polygon as GeographyPolygon; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; -use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; +use CrEOF\Spatial\PHP\Types\Geometry\LineString as GeometryLineString; +use CrEOF\Spatial\PHP\Types\Geometry\Point as GeometryPoint; +use CrEOF\Spatial\PHP\Types\Geometry\Polygon as GeometryPolygon; use CrEOF\Spatial\Tests\Fixtures\GeographyEntity; use CrEOF\Spatial\Tests\Fixtures\GeometryEntity; use CrEOF\Spatial\Tests\OrmTestCase; @@ -44,6 +44,7 @@ * ST_Summary DQL function tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -81,53 +82,43 @@ protected function setUp(): void * * @group geography */ - public function testSelectSTSummaryGeography() + public function testSelectStSummaryGeography() { - $entity1 = new GeographyEntity(); - $point1 = new GeographyPoint(5, 5); - - $entity1->setGeography($point1); - $this->getEntityManager()->persist($entity1); - - $entity2 = new GeographyEntity(); - $lineString2 = new GeographyLineString( - [ - [1, 1], - [2, 2], - [3, 3], - ] - ); - - $entity2->setGeography($lineString2); - $this->getEntityManager()->persist($entity2); - - $entity3 = new GeographyEntity(); - $polygon3 = new GeographyPolygon( - [ - [ - [0, 0], - [10, 0], - [10, 10], - [0, 10], - [0, 0], - ], - ] - ); - - $entity3->setGeography($polygon3); - $this->getEntityManager()->persist($entity3); + $point = new GeographyEntity(); + $point->setGeography(new GeographyPoint(5, 5)); + $this->getEntityManager()->persist($point); + + $linestring = new GeographyEntity(); + $linestring->setGeography(new GeographyLineString([ + [1, 1], + [2, 2], + [3, 3], + ])); + $this->getEntityManager()->persist($linestring); + + $polygon = new GeographyEntity(); + $polygon->setGeography(new GeographyPolygon([[ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ]])); + $this->getEntityManager()->persist($polygon); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT g, ST_Summary(g.geography) FROM CrEOF\Spatial\Tests\Fixtures\GeographyEntity g'); + $query = $this->getEntityManager()->createQuery( + 'SELECT g, ST_Summary(g.geography) FROM CrEOF\Spatial\Tests\Fixtures\GeographyEntity g' + ); $result = $query->getResult(); $this->assertCount(3, $result); - $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals($point, $result[0][0]); $this->assertRegExp('/^Point\[.*G.*\]/', $result[0][1]); - $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals($linestring, $result[1][0]); $this->assertRegExp('/^LineString\[.*G.*\]/', $result[1][1]); - $this->assertEquals($entity3, $result[2][0]); + $this->assertEquals($polygon, $result[2][0]); $this->assertRegExp('/^Polygon\[.*G.*\]/', $result[2][1]); } @@ -143,53 +134,43 @@ public function testSelectSTSummaryGeography() * * @group geometry */ - public function testSelectSTSummaryGeometry() + public function testSelectStSummaryGeometry() { - $entity1 = new GeometryEntity(); - $point1 = new Point(5, 5); - - $entity1->setGeometry($point1); - $this->getEntityManager()->persist($entity1); - - $entity2 = new GeometryEntity(); - $lineString2 = new LineString( - [ - [1, 1], - [2, 2], - [3, 3], - ] - ); - - $entity2->setGeometry($lineString2); - $this->getEntityManager()->persist($entity2); - - $entity3 = new GeometryEntity(); - $polygon3 = new Polygon( - [ - [ - [0, 0], - [10, 0], - [10, 10], - [0, 10], - [0, 0], - ], - ] - ); - - $entity3->setGeometry($polygon3); - $this->getEntityManager()->persist($entity3); + $point = new GeometryEntity(); + $point->setGeometry(new GeometryPoint(5, 5)); + $this->getEntityManager()->persist($point); + + $linestring = new GeometryEntity(); + $linestring->setGeometry(new GeometryLineString([ + [1, 1], + [2, 2], + [3, 3], + ])); + $this->getEntityManager()->persist($linestring); + + $polygon = new GeometryEntity(); + $polygon->setGeometry(new GeometryPolygon([[ + [0, 0], + [10, 0], + [10, 10], + [0, 10], + [0, 0], + ]])); + $this->getEntityManager()->persist($polygon); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT g, ST_Summary(g.geometry) FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g'); + $query = $this->getEntityManager()->createQuery( + 'SELECT g, ST_Summary(g.geometry) FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g' + ); $result = $query->getResult(); $this->assertCount(3, $result); - $this->assertEquals($entity1, $result[0][0]); + $this->assertEquals($point, $result[0][0]); $this->assertRegExp('/^Point\[[^G]*\]/', $result[0][1]); - $this->assertEquals($entity2, $result[1][0]); + $this->assertEquals($linestring, $result[1][0]); $this->assertRegExp('/^LineString\[[^G]*\]/', $result[1][1]); - $this->assertEquals($entity3, $result[2][0]); + $this->assertEquals($polygon, $result[2][0]); $this->assertRegExp('/^Polygon\[[^G]*\]/', $result[2][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/OrmTestCase.php b/tests/CrEOF/Spatial/Tests/OrmTestCase.php index 0ed88a34..e8e95562 100644 --- a/tests/CrEOF/Spatial/Tests/OrmTestCase.php +++ b/tests/CrEOF/Spatial/Tests/OrmTestCase.php @@ -581,7 +581,7 @@ protected function supportsPlatform($platform) } /** - * Declare the used entities. + * Declare the used entity class to initialized them (and delete its content before the test). * * @param string $entityClass the entity class */ diff --git a/tests/CrEOF/Spatial/Tests/TestHelperTrait.php b/tests/CrEOF/Spatial/Tests/TestHelperTrait.php deleted file mode 100644 index 3d4c8758..00000000 --- a/tests/CrEOF/Spatial/Tests/TestHelperTrait.php +++ /dev/null @@ -1,154 +0,0 @@ -createPolygon([self::createEnvelopingLineString()]); - } - - /** - * Create the HOLEY Polygon and persist it in database. - * (Big polygon minus Small Polygon) - * - * @return PolygonEntity - * - * @throws InvalidValueException when geometries are not valid - */ - protected function createHoleyPolygon() - { - return $this->createPolygon([self::createEnvelopingLineString(),self::createInternalLineString()]); - } - - /** - * Create the W Polygon and persist it in database. - * - * @return PolygonEntity - * - * @throws InvalidValueException when geometries are not valid - */ - protected function createPolygonW() - { - return $this->createPolygon([ - new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 20), - new Point(0, 20), - new Point(10, 10), - new Point(0, 0), - ]) - ]); - } - - /** - * Create the SMALL Polygon and persist it in database. - * - * @return PolygonEntity - * - * @throws InvalidValueException when geometries are not valid - */ - protected function createSmallPolygon() - { - return $this->createPolygon([self::createInternalLineString()]); - } - - /** - * Create a Polygon from an array of linestrings. - * - * @param array $lineStrings the array of linestrings - * - * @return PolygonEntity - * - * @throws InvalidValueException when geometries are not valid - */ - protected function createPolygon(array $lineStrings) - { - $polygon = new PolygonEntity(); - $polygon->setPolygon(new Polygon($lineStrings)); - $this->getEntityManager()->persist($polygon); - - return $polygon; - } - -} \ No newline at end of file From 8d556c97d116beaaed9ea1562f6bf9e1c947afb6 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Tue, 25 Feb 2020 18:59:21 +0100 Subject: [PATCH 32/44] phpcsfixer --- .../Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php | 1 - .../Query/AST/Functions/PostgreSql/STContainsProperlyTest.php | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php index a5552c66..b46b6692 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php @@ -41,7 +41,6 @@ * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * - * * @group dql * * @internal diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php index 9e487970..a437ae2d 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php @@ -38,7 +38,6 @@ * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * - * * @group dql * * @internal From 0b6698f0101ee118b9b6b854288e5ab158278c93 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Tue, 25 Feb 2020 20:04:19 +0100 Subject: [PATCH 33/44] Upgrade of tests finished preparing php mess detector --- composer.json | 4 +- .../Functions/PostgreSql/STEnvelopeTest.php | 6 +- .../Tests/ORM/Query/GeometryWalkerTest.php | 102 ++++++++++-------- .../Spatial/Tests/ORM/Query/WrappingTest.php | 43 ++++---- 4 files changed, 80 insertions(+), 75 deletions(-) diff --git a/composer.json b/composer.json index 7c0a4e6b..6bd14b6c 100644 --- a/composer.json +++ b/composer.json @@ -35,11 +35,11 @@ "quality": [ "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", "phpcs --standard=phpcs.xml.dist -s", - "phpmd bin,config,public,src,tests text ./phpmd.xml.dist" + "phpmd lib,tests text ./phpmd.xml.dist" ], "phpcs": "phpcs --standard=phpcs.xml.dist -s", "phpcsfixer": "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", - "phpmd": "phpmd bin,config,public,src,tests text ./phpmd.xml.dist", + "phpmd": "phpmd lib,tests text ./phpmd.xml.dist", "test-mysql": "phpunit --configuration phpunit.mysql.xml", "test-pgsql": "phpunit --configuration phpunit.pgsql.xml" }, diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php index 5c34b1eb..4f1eaae7 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php @@ -28,9 +28,7 @@ use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; -use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\ORMException; /** @@ -96,13 +94,11 @@ public function testSelectStEnvelope() * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ - public function testSTEnvelopeWhereParameter() + public function testStEnvelopeWhereParameter() { $holeyPolygon = $this->createHoleyPolygon(); $this->createSmallPolygon(); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php index 0d8ce75f..18ff1716 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php @@ -24,16 +24,20 @@ namespace CrEOF\Spatial\Tests\ORM\Query; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; +use CrEOF\Spatial\Exception\InvalidValueException; +use CrEOF\Spatial\Exception\UnsupportedPlatformException; use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\Tests\Fixtures\LineStringEntity; +use CrEOF\Spatial\Tests\Helper\LineStringHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; +use Doctrine\DBAL\DBALException; +use Doctrine\ORM\ORMException; use Doctrine\ORM\Query; /** * GeometryWalker tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -43,6 +47,15 @@ */ class GeometryWalkerTest extends OrmTestCase { + use LineStringHelperTrait; + + /** + * Setup the function type test. + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + */ protected function setUp(): void { $this->usesEntity(self::LINESTRING_ENTITY); @@ -50,29 +63,19 @@ protected function setUp(): void } /** + * Test the geometry walker binary. + * * @group geometry + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws InvalidValueException when geometries are not valid */ public function testGeometryWalkerBinary() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(2, 2), - new Point(5, 5), - ]); - $lineString2 = new LineString([ - new Point(3, 3), - new Point(4, 15), - new Point(5, 22), - ]); - $entity1 = new LineStringEntity(); - - $entity1->setLineString($lineString1); - $this->getEntityManager()->persist($entity1); - - $entity2 = new LineStringEntity(); - - $entity2->setLineString($lineString2); - $this->getEntityManager()->persist($entity2); + $this->createStraightLineString(); + $this->createAngularLineString(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); @@ -89,15 +92,26 @@ public function testGeometryWalkerBinary() break; } - $queryString = sprintf('SELECT %s(%s(l.lineString)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l', $asBinary, $startPoint); + $queryString = sprintf( + 'SELECT %s(%s(l.lineString)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l', + $asBinary, + $startPoint + ); $query = $this->getEntityManager()->createQuery($queryString); - $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'CrEOF\Spatial\ORM\Query\GeometryWalker'); + $query->setHint( + Query::HINT_CUSTOM_OUTPUT_WALKER, + 'CrEOF\Spatial\ORM\Query\GeometryWalker' + ); $result = $query->getResult(); $this->assertEquals(new Point(0, 0), $result[0][1]); $this->assertEquals(new Point(3, 3), $result[1][1]); - $queryString = sprintf('SELECT %s(%s(l.lineString)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l', $asBinary, $envelope); + $queryString = sprintf( + 'SELECT %s(%s(l.lineString)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l', + $asBinary, + $envelope + ); $query = $this->getEntityManager()->createQuery($queryString); $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'CrEOF\Spatial\ORM\Query\GeometryWalker'); @@ -107,29 +121,19 @@ public function testGeometryWalkerBinary() } /** + * Test the geometry walker. + * * @group geometry + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws InvalidValueException when geometries are not valid */ public function testGeometryWalkerText() { - $lineString1 = new LineString([ - new Point(0, 0), - new Point(2, 2), - new Point(5, 5), - ]); - $lineString2 = new LineString([ - new Point(3, 3), - new Point(4, 15), - new Point(5, 22), - ]); - $entity1 = new LineStringEntity(); - - $entity1->setLineString($lineString1); - $this->getEntityManager()->persist($entity1); - - $entity2 = new LineStringEntity(); - - $entity2->setLineString($lineString2); - $this->getEntityManager()->persist($entity2); + $this->createStraightLineString(); + $this->createAngularLineString(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); @@ -146,7 +150,11 @@ public function testGeometryWalkerText() break; } - $queryString = sprintf('SELECT %s(%s(l.lineString)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l', $asText, $startPoint); + $queryString = sprintf( + 'SELECT %s(%s(l.lineString)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l', + $asText, + $startPoint + ); $query = $this->getEntityManager()->createQuery($queryString); $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'CrEOF\Spatial\ORM\Query\GeometryWalker'); @@ -154,7 +162,11 @@ public function testGeometryWalkerText() $this->assertEquals(new Point(0, 0), $result[0][1]); $this->assertEquals(new Point(3, 3), $result[1][1]); - $queryString = sprintf('SELECT %s(%s(l.lineString)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l', $asText, $envelope); + $queryString = sprintf( + 'SELECT %s(%s(l.lineString)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l', + $asText, + $envelope + ); $query = $this->getEntityManager()->createQuery($queryString); $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'CrEOF\Spatial\ORM\Query\GeometryWalker'); diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php index a03b9474..e9593372 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php @@ -26,23 +26,20 @@ use CrEOF\Spatial\Exception\InvalidValueException; use CrEOF\Spatial\Exception\UnsupportedPlatformException; -use CrEOF\Spatial\PHP\Types\Geometry\LineString; use CrEOF\Spatial\PHP\Types\Geometry\Point; -use CrEOF\Spatial\PHP\Types\Geometry\Polygon; use CrEOF\Spatial\Tests\Fixtures\GeometryEntity; -use CrEOF\Spatial\Tests\Fixtures\PolygonEntity; +use CrEOF\Spatial\Tests\Helper\PolygonHelperTrait; use CrEOF\Spatial\Tests\OrmTestCase; -use Doctrine\Common\Persistence\Mapping\MappingException; use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Types\Type; -use Doctrine\ORM\OptimisticLockException; +use Doctrine\DBAL\Version; use Doctrine\ORM\ORMException; -use Doctrine\ORM\Version; /** * DQL type wrapping tests. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT * * @group dql @@ -52,6 +49,8 @@ */ class WrappingTest extends OrmTestCase { + use PolygonHelperTrait; + /** * Setup the function type test. * @@ -61,36 +60,27 @@ class WrappingTest extends OrmTestCase */ protected function setUp(): void { + $this->usesEntity(self::POLYGON_ENTITY); $this->usesEntity(self::GEOMETRY_ENTITY); $this->usesType('point'); parent::setUp(); } + //phpcs:disable Squiz.Commenting.FunctionCommentThrowTag.WrongNumber + /** * Test a DQL containing function to test in the predicate. * * @throws DBALException when connection failed * @throws ORMException when cache is not set * @throws UnsupportedPlatformException when platform is unsupported - * @throws MappingException when mapping - * @throws OptimisticLockException when clear fails * @throws InvalidValueException when geometries are not valid * * @group geometry */ public function testTypeWrappingSelect() { - $lineString = new LineString([ - new Point(0, 0), - new Point(10, 0), - new Point(10, 10), - new Point(0, 10), - new Point(0, 0), - ]); - $entity = new PolygonEntity(); - - $entity->setPolygon(new Polygon([$lineString])); - $this->getEntityManager()->persist($entity); + $this->createBigPolygon(); $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); @@ -104,7 +94,6 @@ public function testTypeWrappingSelect() $function = 'Contains'; break; default: - //TODO create a static function to throw exception. throw new UnsupportedPlatformException(sprintf( 'DBAL platform "%s" is not currently supported.', $this->getPlatform()->getName() @@ -114,7 +103,6 @@ public function testTypeWrappingSelect() $dql = sprintf($dql, $function); $query = $this->getEntityManager()->createQuery($dql); - $query->setParameter('geometry', new Point(2, 2), 'point'); $query->processParameterValue('geometry'); @@ -130,9 +118,16 @@ public function testTypeWrappingSelect() $this->assertRegExp($regex, $result); } + // phpcs:enable + /** * @group geometry - */ + * + * @throws DBALException when connection failed + * @throws ORMException when cache is not set + * @throws UnsupportedPlatformException when platform is unsupported + * @throws InvalidValueException when geometries are not valid + * */ public function testTypeWrappingWhere() { $entity = new GeometryEntity(); @@ -142,7 +137,9 @@ public function testTypeWrappingWhere() $this->getEntityManager()->flush(); $this->getEntityManager()->clear(); - $query = $this->getEntityManager()->createQuery('SELECT g FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g WHERE g.geometry = :geometry'); + $query = $this->getEntityManager()->createQuery( + 'SELECT g FROM CrEOF\Spatial\Tests\Fixtures\GeometryEntity g WHERE g.geometry = :geometry' + ); $query->setParameter('geometry', new Point(5, 5), 'point'); $query->processParameterValue('geometry'); From 63cfe5af6f8dcb360f43035c99afbad7c21036b7 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Tue, 25 Feb 2020 21:47:48 +0100 Subject: [PATCH 34/44] Upgrade of tests finished preparing php mess detector --- composer.json | 11 +++++--- .../Spatial/DBAL/Platform/PostgreSql.php | 3 ++- .../Spatial/PHP/Types/AbstractGeometry.php | 3 ++- phpmd.lib.xml | 24 +++++++++++++++++ phpmd.test.xml | 26 +++++++++++++++++++ .../Tests/PHP/Types/Geography/PointTest.php | 22 ++++++++++++++++ 6 files changed, 84 insertions(+), 5 deletions(-) create mode 100644 phpmd.lib.xml create mode 100644 phpmd.test.xml diff --git a/composer.json b/composer.json index 6bd14b6c..ac97f3db 100644 --- a/composer.json +++ b/composer.json @@ -32,14 +32,19 @@ "squizlabs/php_codesniffer": "3.*" }, "scripts": { + "tt": "php-cs-fixer fix --help", "quality": [ - "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", + "php-cs-fixer fix --dry-run --config=.php_cs.dist --allow-risky=yes -vvv", "phpcs --standard=phpcs.xml.dist -s", - "phpmd lib,tests text ./phpmd.xml.dist" + "phpmd lib text ./phpmd.lib.xml", + "phpmd tests xml ./phpmd.test.xml --exclude OrmTestCase.php" ], "phpcs": "phpcs --standard=phpcs.xml.dist -s", "phpcsfixer": "php-cs-fixer --config=.php_cs.dist fix --allow-risky=yes -vvv", - "phpmd": "phpmd lib,tests text ./phpmd.xml.dist", + "phpmd": [ + "phpmd lib text ./phpmd.lib.xml", + "phpmd tests xml ./phpmd.test.xml --exclude OrmTestCase.php" + ], "test-mysql": "phpunit --configuration phpunit.mysql.xml", "test-pgsql": "phpunit --configuration phpunit.pgsql.xml" }, diff --git a/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php b/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php index ee00ef56..aa4b8d64 100644 --- a/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php +++ b/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php @@ -73,7 +73,8 @@ public function convertToDatabaseValue(AbstractSpatialType $type, GeometryInterf $value->setSrid(self::DEFAULT_SRID); } - if (null !== ($srid = $value->getSrid()) || $type instanceof GeographyType) { + $srid = $value->getSrid(); + if (null !== $srid || $type instanceof GeographyType) { $sridSQL = sprintf('SRID=%d;', $srid); } diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php b/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php index 7d420bec..e7f04828 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php @@ -82,6 +82,7 @@ abstract public function toArray(); */ public function toJson() { + $json = []; $json['type'] = $this->getType(); $json['coordinates'] = $this->toArray(); @@ -308,7 +309,7 @@ private function toStringMultiPoint(array $multiPoint) /** * Convert multipolygon to a string. * - * TODO: unused private method. Verify which transformation is missing. + * THIS IS NOT A NON USED PRIVATE METHOD. * * @param array[] $multiPolygon multipolygon already converted into an array of polygon * diff --git a/phpmd.lib.xml b/phpmd.lib.xml new file mode 100644 index 00000000..e4f2c08b --- /dev/null +++ b/phpmd.lib.xml @@ -0,0 +1,24 @@ + + + Alexandre Tranchant rule set. + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/phpmd.test.xml b/phpmd.test.xml new file mode 100644 index 00000000..5c6ad0ca --- /dev/null +++ b/phpmd.test.xml @@ -0,0 +1,26 @@ + + + Alexandre Tranchant rule set. + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geography/PointTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geography/PointTest.php index 915ccfcd..6d51691f 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geography/PointTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geography/PointTest.php @@ -132,6 +132,8 @@ public function testBadLongitudeSeconds() /** * Test bad numeric parameters - latitude greater than 90. + * + * @throws InvalidValueException it should happen */ public function testBadNumericGreaterThanLatitude() { @@ -143,6 +145,8 @@ public function testBadNumericGreaterThanLatitude() /** * Test bad numeric parameters - longitude greater than 180. + * + * @throws InvalidValueException it should happen */ public function testBadNumericGreaterThanLongitude() { @@ -154,6 +158,8 @@ public function testBadNumericGreaterThanLongitude() /** * Test bad numeric parameters - latitude less than -90. + * + * @throws InvalidValueException it should happen */ public function testBadNumericLessThanLatitude() { @@ -165,6 +171,8 @@ public function testBadNumericLessThanLatitude() /** * Test bad numeric parameters - longitude less than -180. + * + * @throws InvalidValueException it should happen */ public function testBadNumericLessThanLongitude() { @@ -176,6 +184,8 @@ public function testBadNumericLessThanLongitude() /** * Test getType method. + * + * @throws InvalidValueException it should NOT happen */ public function testGetType() { @@ -187,6 +197,8 @@ public function testGetType() /** * Test a valid numeric point. + * + * @throws InvalidValueException it should NOT happen */ public function testGoodNumericPoint() { @@ -239,6 +251,8 @@ public function testGoodStringPoints() /** * Test a point created with an array and converts to string. + * + * @throws InvalidValueException it should NOT happen */ public function testPointFromArrayToString() { @@ -250,6 +264,8 @@ public function testPointFromArrayToString() /** * Test error when point created with too many arguments. + * + * @throws InvalidValueException it should happen */ public function testPointTooManyArguments() { @@ -263,6 +279,8 @@ public function testPointTooManyArguments() /** * Test a point with SRID. + * + * @throws InvalidValueException it should not happen */ public function testPointWithSrid() { @@ -280,6 +298,8 @@ public function testPointWithSrid() /** * Test error when point is created with wrong arguments. + * + * @throws InvalidValueException it should happen */ public function testPointWrongArgumentTypes() { @@ -293,6 +313,8 @@ public function testPointWrongArgumentTypes() /** * Test to convert point to array. + * + * @throws InvalidValueException it should happen */ public function testToArray() { From 96bc21cba00f50cbac6279697f58287ee6ff2303 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Tue, 25 Feb 2020 21:52:26 +0100 Subject: [PATCH 35/44] Updating travis to test doctrine 3 only with php 7.4 --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index e71f513a..221760ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,6 +37,8 @@ before_script: script: - ./vendor/bin/phpunit -v -c ./tests/travis/travis.pgsql.xml --coverage-php ./build/coverage/coverage-pgsql-$TRAVIS_PHP_VERSION-$ORM.cov - ./vendor/bin/phpunit -v -c ./tests/travis/travis.mysql.xml --coverage-php ./build/coverage/coverage-mysql-$TRAVIS_PHP_VERSION-$ORM.cov + # Code should respect rules + - composer quality after_script: - ./vendor/bin/phpcov merge --clover ./build/logs/clover.xml ./build/coverage @@ -48,6 +50,11 @@ notifications: webhooks: https://coveralls.io/webhook?repo_token=$COVERALLS_WEBHOOK matrix: + exclude: + - php: 7.2 + env: ORM=3.0 + - php: 7.3 + env: ORM=3.0 allow_failures: # Upcoming releases can fail - env: ORM=2.8 From 6d5b56127d7a830618b94dd117f7aa59e9c967a2 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Tue, 25 Feb 2020 21:58:21 +0100 Subject: [PATCH 36/44] Adding return types --- .../Tests/Helper/LineStringHelperTrait.php | 39 +++++-------------- .../Tests/Helper/PolygonHelperTrait.php | 28 ++++--------- 2 files changed, 16 insertions(+), 51 deletions(-) diff --git a/tests/CrEOF/Spatial/Tests/Helper/LineStringHelperTrait.php b/tests/CrEOF/Spatial/Tests/Helper/LineStringHelperTrait.php index 2294d0ce..eccb4269 100644 --- a/tests/CrEOF/Spatial/Tests/Helper/LineStringHelperTrait.php +++ b/tests/CrEOF/Spatial/Tests/Helper/LineStringHelperTrait.php @@ -33,8 +33,6 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\ORMException; -//TODO Add the return type! - /** * LineStringHelperTrait Trait. * @@ -42,7 +40,6 @@ * All of these polygonal geometries are defined in test documentation. * * Methods beginning with create will store a geo* entity in database. - * Methods beginning with get will only return a geo object. * * @see /doc/test.md * @@ -61,10 +58,8 @@ trait LineStringHelperTrait * @throws UnsupportedPlatformException when platform is not supported * @throws DBALException when credentials fail * @throws ORMException when cache is not created - * - * @return LineStringEntity */ - protected function createAngularLineString() + protected function createAngularLineString(): LineStringEntity { return $this->createLineString([ new Point(3, 3), @@ -81,10 +76,8 @@ protected function createAngularLineString() * @throws UnsupportedPlatformException when platform is not supported * @throws DBALException when credentials fail * @throws ORMException when cache is not created - * - * @return LineStringEntity */ - protected function createLineStringA() + protected function createLineStringA(): LineStringEntity { return $this->createLineString([ new Point(0, 0), @@ -101,10 +94,8 @@ protected function createLineStringA() * @throws UnsupportedPlatformException when platform is not supported * @throws DBALException when credentials fail * @throws ORMException when cache is not created - * - * @return LineStringEntity */ - protected function createLineStringB() + protected function createLineStringB(): LineStringEntity { return $this->createLineString([ new Point(0, 10), @@ -122,10 +113,8 @@ protected function createLineStringB() * @throws UnsupportedPlatformException when platform is not supported * @throws DBALException when credentials fail * @throws ORMException when cache is not created - * - * @return LineStringEntity */ - protected function createLineStringC() + protected function createLineStringC(): LineStringEntity { return $this->createLineString([ new Point(2, 0), @@ -140,10 +129,8 @@ protected function createLineStringC() * @throws UnsupportedPlatformException when platform is not supported * @throws DBALException when credentials fail * @throws ORMException when cache is not created - * - * @return LineStringEntity */ - protected function createLineStringX() + protected function createLineStringX(): LineStringEntity { return $this->createLineString([ new Point(8, 15), @@ -158,10 +145,8 @@ protected function createLineStringX() * @throws UnsupportedPlatformException when platform is not supported * @throws DBALException when credentials fail * @throws ORMException when cache is not created - * - * @return LineStringEntity */ - protected function createLineStringY() + protected function createLineStringY(): LineStringEntity { return $this->createLineString([ new Point(12, 14), @@ -176,10 +161,8 @@ protected function createLineStringY() * @throws UnsupportedPlatformException when platform is not supported * @throws DBALException when credentials fail * @throws ORMException when cache is not created - * - * @return LineStringEntity */ - protected function createLineStringZ() + protected function createLineStringZ(): LineStringEntity { return $this->createLineString([ new Point(2, 5), @@ -198,10 +181,8 @@ protected function createLineStringZ() * @throws UnsupportedPlatformException when platform is not supported * @throws DBALException when credentials fail * @throws ORMException when cache is not created - * - * @return LineStringEntity */ - protected function createStraightLineString() + protected function createStraightLineString(): LineStringEntity { return $this->createLineString([ new Point(0, 0), @@ -219,10 +200,8 @@ protected function createStraightLineString() * @throws UnsupportedPlatformException when platform is not supported * @throws DBALException when credentials fail * @throws ORMException when cache is not created - * - * @return LineStringEntity */ - private function createLineString(array $points) + private function createLineString(array $points): LineStringEntity { $lineStringEntity = new LineStringEntity(); $lineStringEntity->setLineString(new LineString($points)); diff --git a/tests/CrEOF/Spatial/Tests/Helper/PolygonHelperTrait.php b/tests/CrEOF/Spatial/Tests/Helper/PolygonHelperTrait.php index b67fc18c..835c79a1 100644 --- a/tests/CrEOF/Spatial/Tests/Helper/PolygonHelperTrait.php +++ b/tests/CrEOF/Spatial/Tests/Helper/PolygonHelperTrait.php @@ -59,10 +59,8 @@ trait PolygonHelperTrait * @throws DBALException when credentials fail * @throws ORMException when cache is not created * @throws InvalidValueException when geometries are not valid - * - * @return PolygonEntity */ - protected function createBigPolygon() + protected function createBigPolygon(): PolygonEntity { return $this->createPolygon([ new LineString([ @@ -83,10 +81,8 @@ protected function createBigPolygon() * @throws DBALException when credentials fail * @throws ORMException when cache is not created * @throws InvalidValueException when geometries are not valid - * - * @return PolygonEntity */ - protected function createEccentricPolygon() + protected function createEccentricPolygon(): PolygonEntity { return $this->createPolygon([new LineString([ new Point(6, 6), @@ -105,10 +101,8 @@ protected function createEccentricPolygon() * @throws DBALException when credentials fail * @throws ORMException when cache is not created * @throws InvalidValueException when geometries are not valid - * - * @return PolygonEntity */ - protected function createHoleyPolygon() + protected function createHoleyPolygon(): PolygonEntity { return $this->createPolygon([ new LineString([ @@ -136,10 +130,8 @@ protected function createHoleyPolygon() * @throws DBALException when credentials fail * @throws ORMException when cache is not created * @throws InvalidValueException when geometries are not valid - * - * @return PolygonEntity */ - protected function createOuterPolygon() + protected function createOuterPolygon(): PolygonEntity { return $this->createPolygon([ new LineString([ @@ -161,10 +153,8 @@ protected function createOuterPolygon() * @throws DBALException when credentials fail * @throws ORMException when cache is not created * @throws InvalidValueException when geometries are not valid - * - * @return PolygonEntity */ - protected function createPolygon(array $lineStrings) + protected function createPolygon(array $lineStrings): PolygonEntity { $polygon = new PolygonEntity(); $polygon->setPolygon(new Polygon($lineStrings)); @@ -180,10 +170,8 @@ protected function createPolygon(array $lineStrings) * @throws DBALException when credentials fail * @throws ORMException when cache is not created * @throws InvalidValueException when geometries are not valid - * - * @return PolygonEntity */ - protected function createPolygonW() + protected function createPolygonW(): PolygonEntity { return $this->createPolygon([ new LineString([ @@ -205,10 +193,8 @@ protected function createPolygonW() * @throws DBALException when credentials fail * @throws ORMException when cache is not created * @throws InvalidValueException when geometries are not valid - * - * @return PolygonEntity */ - protected function createSmallPolygon() + protected function createSmallPolygon(): PolygonEntity { return $this->createPolygon([ new LineString([ From e1d1f1628259a7554a03163b8171076d607b724a Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Tue, 25 Feb 2020 21:58:54 +0100 Subject: [PATCH 37/44] Quality should respect quality code rules to be merged --- .travis.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 221760ee..c1a0e65e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,11 +50,6 @@ notifications: webhooks: https://coveralls.io/webhook?repo_token=$COVERALLS_WEBHOOK matrix: - exclude: - - php: 7.2 - env: ORM=3.0 - - php: 7.3 - env: ORM=3.0 allow_failures: # Upcoming releases can fail - env: ORM=2.8 From e48f049306e3accb84b422600c59b1badadd4df2 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Wed, 26 Feb 2020 10:02:49 +0100 Subject: [PATCH 38/44] Clodeclimate updated to avoid similar code process because it is not revelent with structure of this library --- .codeclimate.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.codeclimate.yml b/.codeclimate.yml index 405c3c69..67a96869 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -9,3 +9,13 @@ ratings: paths: - "**.php" exclude_paths: [] +plugins: + duplication: + enabled: true + config: + languages: + php: + mass_threshold: 42 + checks: + Similar code: + enabled: false From c5c7c20fb0e3d5e71eef4161e72e168a9fa79a2f Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Wed, 26 Feb 2020 14:23:19 +0100 Subject: [PATCH 39/44] Abstract Geometry and all its children updated with methods insteadof properties. Method help test coverage to detect non-tested function (and there are a lot!) --- .../Functions/AbstractSpatialDQLFunction.php | 118 +++++++++++++----- .../ORM/Query/AST/Functions/MySql/Area.php | 43 +++++-- .../Query/AST/Functions/MySql/AsBinary.php | 37 +++--- .../ORM/Query/AST/Functions/MySql/AsText.php | 37 +++--- .../ORM/Query/AST/Functions/MySql/Buffer.php | 43 +++++-- .../Query/AST/Functions/MySql/Centroid.php | 43 +++++-- .../Query/AST/Functions/MySql/Contains.php | 43 +++++-- .../ORM/Query/AST/Functions/MySql/Crosses.php | 43 +++++-- .../Query/AST/Functions/MySql/Dimension.php | 43 +++++-- .../Query/AST/Functions/MySql/Disjoint.php | 43 +++++-- .../Query/AST/Functions/MySql/Distance.php | 43 +++++-- .../Functions/MySql/DistanceFromMultyLine.php | 46 +++++-- .../Query/AST/Functions/MySql/EndPoint.php | 43 +++++-- .../Query/AST/Functions/MySql/Envelope.php | 43 +++++-- .../ORM/Query/AST/Functions/MySql/Equals.php | 43 +++++-- .../AST/Functions/MySql/ExteriorRing.php | 43 +++++-- .../ORM/Query/AST/Functions/MySql/GLength.php | 43 +++++-- .../Query/AST/Functions/MySql/GeodistPt.php | 46 +++++-- .../AST/Functions/MySql/GeomFromText.php | 43 +++++-- .../AST/Functions/MySql/GeometryType.php | 43 +++++-- .../AST/Functions/MySql/InteriorRingN.php | 43 +++++-- .../Query/AST/Functions/MySql/Intersects.php | 43 +++++-- .../Query/AST/Functions/MySql/IsClosed.php | 43 +++++-- .../ORM/Query/AST/Functions/MySql/IsEmpty.php | 43 +++++-- .../Query/AST/Functions/MySql/IsSimple.php | 43 +++++-- .../Query/AST/Functions/MySql/LineString.php | 43 +++++-- .../AST/Functions/MySql/LineStringFromWKB.php | 46 ++++--- .../Query/AST/Functions/MySql/MBRContains.php | 45 +++++-- .../Query/AST/Functions/MySql/MBRDisjoint.php | 47 ++++++- .../Query/AST/Functions/MySql/MBREqual.php | 43 +++++-- .../AST/Functions/MySql/MBRIntersects.php | 43 +++++-- .../Query/AST/Functions/MySql/MBROverlaps.php | 43 +++++-- .../Query/AST/Functions/MySql/MBRTouches.php | 43 +++++-- .../Query/AST/Functions/MySql/MBRWithin.php | 43 +++++-- .../AST/Functions/MySql/NumInteriorRings.php | 43 +++++-- .../Query/AST/Functions/MySql/NumPoints.php | 43 +++++-- .../Query/AST/Functions/MySql/Overlaps.php | 43 +++++-- .../ORM/Query/AST/Functions/MySql/Point.php | 46 ++++--- .../AST/Functions/MySql/PointFromWKB.php | 46 ++++--- .../ORM/Query/AST/Functions/MySql/PointN.php | 43 +++++-- .../ORM/Query/AST/Functions/MySql/SRID.php | 43 +++++-- .../Query/AST/Functions/MySql/STBuffer.php | 44 +++++-- .../Query/AST/Functions/MySql/STContains.php | 43 +++++-- .../Query/AST/Functions/MySql/STCrosses.php | 43 +++++-- .../Query/AST/Functions/MySql/STDisjoint.php | 43 +++++-- .../Query/AST/Functions/MySql/STDistance.php | 43 +++++-- .../Query/AST/Functions/MySql/STEquals.php | 43 +++++-- .../AST/Functions/MySql/STIntersects.php | 46 +++++-- .../Query/AST/Functions/MySql/STOverlaps.php | 43 +++++-- .../Query/AST/Functions/MySql/STTouches.php | 43 +++++-- .../Query/AST/Functions/MySql/STWithin.php | 43 +++++-- .../Query/AST/Functions/MySql/StartPoint.php | 43 +++++-- .../ORM/Query/AST/Functions/MySql/Touches.php | 43 +++++-- .../ORM/Query/AST/Functions/MySql/Within.php | 43 +++++-- .../ORM/Query/AST/Functions/MySql/X.php | 43 +++++-- .../ORM/Query/AST/Functions/MySql/Y.php | 43 +++++-- .../AST/Functions/PostgreSql/Geometry.php | 43 +++++-- .../Query/AST/Functions/PostgreSql/STArea.php | 43 +++++-- .../AST/Functions/PostgreSql/STAsBinary.php | 43 +++++-- .../AST/Functions/PostgreSql/STAsGeoJson.php | 43 +++++-- .../AST/Functions/PostgreSql/STAsText.php | 43 +++++-- .../AST/Functions/PostgreSql/STAzimuth.php | 45 +++++-- .../AST/Functions/PostgreSql/STBoundary.php | 45 +++++-- .../AST/Functions/PostgreSql/STBuffer.php | 45 +++++-- .../AST/Functions/PostgreSql/STCentroid.php | 43 +++++-- .../Functions/PostgreSql/STClosestPoint.php | 43 +++++-- .../AST/Functions/PostgreSql/STCollect.php | 43 +++++-- .../AST/Functions/PostgreSql/STContains.php | 43 +++++-- .../PostgreSql/STContainsProperly.php | 43 +++++-- .../AST/Functions/PostgreSql/STCoveredBy.php | 45 +++++-- .../AST/Functions/PostgreSql/STCovers.php | 45 +++++-- .../AST/Functions/PostgreSql/STCrosses.php | 45 +++++-- .../AST/Functions/PostgreSql/STDWithin.php | 43 +++++-- .../AST/Functions/PostgreSql/STDifference.php | 45 +++++-- .../AST/Functions/PostgreSql/STDisjoint.php | 43 +++++-- .../AST/Functions/PostgreSql/STDistance.php | 43 +++++-- .../Functions/PostgreSql/STDistanceSphere.php | 43 +++++-- .../AST/Functions/PostgreSql/STEndPoint.php | 43 +++++-- .../AST/Functions/PostgreSql/STEnvelope.php | 45 +++++-- .../AST/Functions/PostgreSql/STExpand.php | 45 +++++-- .../AST/Functions/PostgreSql/STExtent.php | 43 +++++-- .../PostgreSql/STGeographyFromText.php | 43 +++++-- .../Functions/PostgreSql/STGeomFromEWKT.php | 45 +++++-- .../Functions/PostgreSql/STGeomFromText.php | 43 +++++-- .../AST/Functions/PostgreSql/STGeometryN.php | 43 +++++-- .../Functions/PostgreSql/STIntersection.php | 45 +++++-- .../AST/Functions/PostgreSql/STIntersects.php | 43 +++++-- .../AST/Functions/PostgreSql/STLength.php | 43 +++++-- .../PostgreSql/STLineCrossingDirection.php | 43 +++++-- .../PostgreSql/STLineInterpolatePoint.php | 45 +++++-- .../PostgreSql/STLineLocatePoint.php | 43 +++++-- .../Functions/PostgreSql/STLineSubstring.php | 45 +++++-- .../AST/Functions/PostgreSql/STMakeBox2D.php | 45 +++++-- .../Functions/PostgreSql/STMakeEnvelope.php | 45 ++++--- .../AST/Functions/PostgreSql/STMakeLine.php | 45 +++++-- .../AST/Functions/PostgreSql/STMakePoint.php | 45 +++++-- .../AST/Functions/PostgreSql/STOverlaps.php | 45 +++++-- .../AST/Functions/PostgreSql/STPerimeter.php | 45 +++++-- .../AST/Functions/PostgreSql/STPoint.php | 45 +++++-- .../AST/Functions/PostgreSql/STScale.php | 45 +++++-- .../AST/Functions/PostgreSql/STSetSRID.php | 45 +++++-- .../AST/Functions/PostgreSql/STSimplify.php | 45 +++++-- .../AST/Functions/PostgreSql/STSnapToGrid.php | 91 ++++++++------ .../AST/Functions/PostgreSql/STSplit.php | 45 +++++-- .../AST/Functions/PostgreSql/STStartPoint.php | 43 +++++-- .../AST/Functions/PostgreSql/STSummary.php | 43 +++++-- .../AST/Functions/PostgreSql/STTouches.php | 43 +++++-- .../AST/Functions/PostgreSql/STTransform.php | 47 +++++-- .../AST/Functions/PostgreSql/STTranslate.php | 45 +++++-- .../AST/Functions/PostgreSql/STUnion.php | 45 +++++-- .../AST/Functions/PostgreSql/STWithin.php | 45 +++++-- .../Query/AST/Functions/PostgreSql/STX.php | 45 +++++-- .../Query/AST/Functions/PostgreSql/STY.php | 45 +++++-- 113 files changed, 3619 insertions(+), 1438 deletions(-) diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php index 298a67f5..d8379291 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php @@ -37,33 +37,29 @@ /** * Abstract spatial DQL function. + * + * @author Derek J. Lambert + * @author Alexandre Tranchant + * @license http://dlambert.mit-license.org MIT + * + * This spatial class is updated to avoid non-covered code. A lot of PostgreSQL was not tested, but that tha was not + * displayed by coverage rapport. Some MySQL methods generates bug since MySQL 8.0 because their name was updated. + * + * It is not possible to evaluate which function is tested or not with a children containing only protected methods. + * The new pattern consists to create an abstract method for each removed property. + * Then, if function is not tested, the code coverage tools will report this information. + * + * Thus if we analyse platform version, we can implements the getFunctionName method to return geomfromtext for + * MySQL Version 5.7 and return st_geomfromtext for version 8.0 + * + * @see https://stackoverflow.com/questions/60377271/why-some-spatial-functions-does-not-exists-on-my-mysql-server */ abstract class AbstractSpatialDQLFunction extends FunctionNode { - /** - * @var string - */ - protected $functionName; - /** * @var Node[] */ - protected $geomExpr = []; - - /** - * @var int - */ - protected $maxGeomExpr; - - /** - * @var int - */ - protected $minGeomExpr; - - /** - * @var array - */ - protected $platforms = []; + private $geometryExpression = []; /** * Get the SQL. @@ -73,19 +69,17 @@ abstract class AbstractSpatialDQLFunction extends FunctionNode * @throws UnsupportedPlatformException when platform is unsupported * @throws DBALException when an invalid platform was specified for this connection * @throws ASTException when node cannot dispatch SqlWalker - * - * @return string */ - public function getSql(SqlWalker $sqlWalker) + public function getSql(SqlWalker $sqlWalker): string { $this->validatePlatform($sqlWalker->getConnection()->getDatabasePlatform()); $arguments = []; - foreach ($this->geomExpr as $expression) { + foreach ($this->getGeometryExpressions() as $expression) { $arguments[] = $expression->dispatch($sqlWalker); } - return sprintf('%s(%s)', $this->functionName, implode(', ', $arguments)); + return sprintf('%s(%s)', $this->getFunctionName(), implode(', ', $arguments)); } /** @@ -102,20 +96,80 @@ public function parse(Parser $parser) $parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_OPEN_PARENTHESIS); - $this->geomExpr[] = $parser->ArithmeticPrimary(); + $this->addGeometryExpression($parser->ArithmeticPrimary()); - while (count($this->geomExpr) < $this->minGeomExpr - || ((null === $this->maxGeomExpr || count($this->geomExpr) < $this->maxGeomExpr) + while (count($this->geometryExpression) < $this->getMinParameter() + || ((count($this->geometryExpression) < $this->getMaxParameter()) && Lexer::T_CLOSE_PARENTHESIS != $lexer->lookahead['type']) ) { $parser->match(Lexer::T_COMMA); - $this->geomExpr[] = $parser->ArithmeticPrimary(); + $this->addGeometryExpression($parser->ArithmeticPrimary()); } $parser->match(Lexer::T_CLOSE_PARENTHESIS); } + /** + * Geometry expressions fluent adder. + * + * @param Node $expression the node expression to add to the array of geometry expression + * + * @since 2.0 This function replace the protected property geomExpr which is now private. + */ + final protected function addGeometryExpression(Node $expression): self + { + $this->geometryExpression[] = $expression; + + return $this; + } + + /** + * Function SQL name getter. + * + * @since 2.0 This function replace the protected property functionName. + */ + abstract protected function getFunctionName(): string; + + /** + * Geometry expressions getter. + * + * @since 2.0 This function replace the protected property geomExpr which is now private. + * + * @return Node[] + */ + final protected function getGeometryExpressions(): array + { + return $this->geometryExpression; + } + + /** + * Maximum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter + */ + abstract protected function getMaxParameter(): int; + + /** + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter + */ + abstract protected function getMinParameter(): int; + + /** + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. + * + * @return string[] a non-empty array of accepted platforms + */ + abstract protected function getPlatforms(): array; + /** * Test that the platform supports spatial type. * @@ -123,11 +177,11 @@ public function parse(Parser $parser) * * @throws UnsupportedPlatformException when platform is unsupported */ - protected function validatePlatform(AbstractPlatform $platform) + protected function validatePlatform(AbstractPlatform $platform): void { $platformName = $platform->getName(); - if (isset($this->platforms) && !in_array($platformName, $this->platforms)) { + if (!in_array($platformName, $this->getPlatforms())) { throw new UnsupportedPlatformException( sprintf('DBAL platform "%s" is not currently supported.', $platformName) ); diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Area.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Area.php index e6cb1ac7..143ca87c 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Area.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Area.php @@ -30,35 +30,54 @@ * Area DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class Area extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'Area'; + protected function getFunctionName(): string + { + return 'Area'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php index 028b6cf5..bc530b81 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php @@ -31,35 +31,40 @@ * AsBinary DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class AsBinary extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { /** - * SQL Function name. - * - * @var string + * {@inheritdoc} */ - protected $functionName = 'AsBinary'; + protected function getFunctionName(): string + { + return 'AsBinary'; + } /** - * Maximum number of parameters accepted by SQL function. - * - * @var int + * {@inheritdoc} */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Miimum number of parameters accepted by SQL function. - * - * @var int + * {@inheritdoc} */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. - * - * @var array + * {@inheritdoc} */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsText.php index 74ce15f4..2927c1fc 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsText.php @@ -31,35 +31,40 @@ * AsText DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class AsText extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { /** - * SQL Function name. - * - * @var string + * {@inheritdoc} */ - protected $functionName = 'AsText'; + protected function getFunctionName(): string + { + return 'AsText'; + } /** - * Maximum number of parameters accepted by SQL function. - * - * @var int + * {@inheritdoc} */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. - * - * @var int + * {@inheritdoc} */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. - * - * @var array + * {@inheritdoc} */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Buffer.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Buffer.php index f11342b2..ba34d5db 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Buffer.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Buffer.php @@ -30,35 +30,54 @@ * Buffer DQL function. * * @author luca capra + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class Buffer extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'Buffer'; + protected function getFunctionName(): string + { + return 'Buffer'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Centroid.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Centroid.php index b8fe50ea..ba0fd1a0 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Centroid.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Centroid.php @@ -30,35 +30,54 @@ * Centroid DQL function. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class Centroid extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'Centroid'; + protected function getFunctionName(): string + { + return 'Centroid'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Contains.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Contains.php index 72a0bca4..b103db3d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Contains.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Contains.php @@ -30,35 +30,54 @@ * Contains DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class Contains extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'Contains'; + protected function getFunctionName(): string + { + return 'Contains'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Crosses.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Crosses.php index 6031ebc5..2f363a7d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Crosses.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Crosses.php @@ -30,35 +30,54 @@ * Crosses DQL function. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class Crosses extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'Crosses'; + protected function getFunctionName(): string + { + return 'Crosses'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Dimension.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Dimension.php index d531ff0a..59bbb79d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Dimension.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Dimension.php @@ -30,35 +30,54 @@ * Dimension DQL function. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class Dimension extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'Dimension'; + protected function getFunctionName(): string + { + return 'Dimension'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Disjoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Disjoint.php index c0d34ff5..c5c5d0ac 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Disjoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Disjoint.php @@ -30,35 +30,54 @@ * Disjoint DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class Disjoint extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'Disjoint'; + protected function getFunctionName(): string + { + return 'Disjoint'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Distance.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Distance.php index a40a4665..03008d9e 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Distance.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Distance.php @@ -30,35 +30,54 @@ * Distance DQL function. * * @author luca capra + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class Distance extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'Distance'; + protected function getFunctionName(): string + { + return 'Distance'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/DistanceFromMultyLine.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/DistanceFromMultyLine.php index 19fbd0e2..7db7254c 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/DistanceFromMultyLine.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/DistanceFromMultyLine.php @@ -29,35 +29,55 @@ /** * Description of STContains. * - * @author Maximilian + * @author Maximilian + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class DistanceFromMultyLine extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'distance_from_multyline'; + protected function getFunctionName(): string + { + return 'distance_from_multyline'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/EndPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/EndPoint.php index 0f4c9ce2..87d909a1 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/EndPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/EndPoint.php @@ -30,35 +30,54 @@ * EndPoint DQL function. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class EndPoint extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'EndPoint'; + protected function getFunctionName(): string + { + return 'EndPoint'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Envelope.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Envelope.php index 801be638..e57c2c9f 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Envelope.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Envelope.php @@ -30,35 +30,54 @@ * Envelope DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class Envelope extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'Envelope'; + protected function getFunctionName(): string + { + return 'Envelope'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Equals.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Equals.php index f188d0b2..f79b7c4e 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Equals.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Equals.php @@ -30,35 +30,54 @@ * Equals DQL function. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class Equals extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'Equals'; + protected function getFunctionName(): string + { + return 'Equals'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/ExteriorRing.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/ExteriorRing.php index a54a2d93..dea01c53 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/ExteriorRing.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/ExteriorRing.php @@ -30,35 +30,54 @@ * ExteriorRing DQL function. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class ExteriorRing extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ExteriorRing'; + protected function getFunctionName(): string + { + return 'ExteriorRing'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GLength.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GLength.php index 5860d84f..86ebfd33 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GLength.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GLength.php @@ -30,35 +30,54 @@ * GLength DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class GLength extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'GLength'; + protected function getFunctionName(): string + { + return 'GLength'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeodistPt.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeodistPt.php index 5f727546..d49b546d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeodistPt.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeodistPt.php @@ -27,37 +27,57 @@ use CrEOF\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; /** - * Description of STContains. + * Description of GeodistPt. * * @author Maximilian + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class GeodistPt extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'geodist_pt'; + protected function getFunctionName(): string + { + return 'geodist_pt'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeomFromText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeomFromText.php index e376c4df..bc250594 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeomFromText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeomFromText.php @@ -30,35 +30,54 @@ * GeomFromText DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class GeomFromText extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'GeomFromText'; + protected function getFunctionName(): string + { + return 'GeomFromText'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeometryType.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeometryType.php index a1ae9b24..41c0ca65 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeometryType.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeometryType.php @@ -30,35 +30,54 @@ * GeometryType DQL function. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class GeometryType extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'GeometryType'; + protected function getFunctionName(): string + { + return 'GeometryType'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/InteriorRingN.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/InteriorRingN.php index 4849739b..0647ba5d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/InteriorRingN.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/InteriorRingN.php @@ -30,35 +30,54 @@ * InteriorRingN DQL function. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class InteriorRingN extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'InteriorRingN'; + protected function getFunctionName(): string + { + return 'InteriorRingN'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Intersects.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Intersects.php index b229fd0d..b6604c24 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Intersects.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Intersects.php @@ -31,35 +31,54 @@ * Whether MBRs of two geometries intersect. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class Intersects extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'Intersects'; + protected function getFunctionName(): string + { + return 'Intersects'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsClosed.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsClosed.php index 8cadb5ff..50fa99e5 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsClosed.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsClosed.php @@ -30,35 +30,54 @@ * IsClosed DQL function. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class IsClosed extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'IsClosed'; + protected function getFunctionName(): string + { + return 'IsClosed'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsEmpty.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsEmpty.php index e092c1dd..952c1b4e 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsEmpty.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsEmpty.php @@ -30,35 +30,54 @@ * IsEmpty DQL function. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class IsEmpty extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'IsEmpty'; + protected function getFunctionName(): string + { + return 'IsEmpty'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsSimple.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsSimple.php index e141b8f8..35b216c4 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsSimple.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsSimple.php @@ -30,35 +30,54 @@ * IsSimple DQL function. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class IsSimple extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'IsSimple'; + protected function getFunctionName(): string + { + return 'IsSimple'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineString.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineString.php index 17616783..ef3f59f4 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineString.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineString.php @@ -30,35 +30,54 @@ * GLength DQL function. * * @author Damiano Ciarla + * @author Alexandre Tranchant * @license http://opensource.org/licenses/MIT MIT */ class LineString extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'LineString'; + protected function getFunctionName(): string + { + return 'LineString'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineStringFromWKB.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineStringFromWKB.php index 3c021318..9532da8f 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineStringFromWKB.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineStringFromWKB.php @@ -29,36 +29,54 @@ /** * LineStringFromWKB function. * - * @author - * @license + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class LineStringFromWKB extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'LineStringFromWKB'; + protected function getFunctionName(): string + { + return 'LineStringFromWKB'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRContains.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRContains.php index 460b0c5c..93215990 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRContains.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRContains.php @@ -28,34 +28,55 @@ /** * MBRContains DQL function. + * + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class MBRContains extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'MBRContains'; + protected function getFunctionName(): string + { + return 'MBRContains'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property maxGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property minGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRDisjoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRDisjoint.php index 7d70a536..175735b3 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRDisjoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRDisjoint.php @@ -28,20 +28,55 @@ /** * MBRDisjoint DQL function. + * + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class MBRDisjoint extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. + * + * @since 2.0 This function replace the protected property functionName. + */ + protected function getFunctionName(): string + { + return 'MBRDisjoint'; + } + + /** + * Maximum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter + */ + protected function getMaxParameter(): int + { + return 2; + } + + /** + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var string + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $functionName = 'MBRDisjoint'; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBREqual.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBREqual.php index 07a5914a..b6e48e8c 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBREqual.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBREqual.php @@ -30,35 +30,54 @@ * MBREqual DQL function. * * @author luca capra + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class MBREqual extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'MBREqual'; + protected function getFunctionName(): string + { + return 'MBREqual'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRIntersects.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRIntersects.php index 0196d7ff..387bfe49 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRIntersects.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRIntersects.php @@ -31,35 +31,54 @@ * Whether MBRs of two geometries intersect. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class MBRIntersects extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'MBRIntersects'; + protected function getFunctionName(): string + { + return 'MBRIntersects'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBROverlaps.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBROverlaps.php index 122b2099..c4ebaad7 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBROverlaps.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBROverlaps.php @@ -31,35 +31,54 @@ * Whether MBRs of two geometries overlap. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class MBROverlaps extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'MBROverlaps'; + protected function getFunctionName(): string + { + return 'MBROverlaps'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRTouches.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRTouches.php index 557f631b..b041b4b0 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRTouches.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRTouches.php @@ -31,35 +31,54 @@ * Whether MBRs of two geometries touch. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class MBRTouches extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'MBRTouches'; + protected function getFunctionName(): string + { + return 'MBRTouches'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRWithin.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRWithin.php index 0bbd6912..34483e5b 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRWithin.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRWithin.php @@ -31,35 +31,54 @@ * Whether MBR of one geometry is within MBR of another. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class MBRWithin extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'MBRWithin'; + protected function getFunctionName(): string + { + return 'MBRWithin'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumInteriorRings.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumInteriorRings.php index efc87eaf..1e007a15 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumInteriorRings.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumInteriorRings.php @@ -31,35 +31,54 @@ * Return number of interior rings in Polygon. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class NumInteriorRings extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'NumInteriorRings'; + protected function getFunctionName(): string + { + return 'NumInteriorRings'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumPoints.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumPoints.php index 23c51b24..438ba262 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumPoints.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumPoints.php @@ -31,35 +31,54 @@ * Return number of points in LineString. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class NumPoints extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'NumPoints'; + protected function getFunctionName(): string + { + return 'NumPoints'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Overlaps.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Overlaps.php index e3c4a1c8..73412f5d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Overlaps.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Overlaps.php @@ -31,35 +31,54 @@ * Whether MBRs of two geometries overlap. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class Overlaps extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'Overlaps'; + protected function getFunctionName(): string + { + return 'Overlaps'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Point.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Point.php index d26369b3..48439b94 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Point.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Point.php @@ -29,36 +29,54 @@ /** * Point function. * - * @author - * @license + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class Point extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'Point'; + protected function getFunctionName(): string + { + return 'Point'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointFromWKB.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointFromWKB.php index 65e18392..cfafd717 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointFromWKB.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointFromWKB.php @@ -29,36 +29,54 @@ /** * PointFromWKB function. * - * @author - * @license + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class PointFromWKB extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'PointFromWKB'; + protected function getFunctionName(): string + { + return 'PointFromWKB'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointN.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointN.php index 82d2ef58..e1cea536 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointN.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointN.php @@ -31,35 +31,54 @@ * Return N-th point from LineString. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class PointN extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'PointN'; + protected function getFunctionName(): string + { + return 'PointN'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/SRID.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/SRID.php index c4978065..cee72acd 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/SRID.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/SRID.php @@ -30,35 +30,54 @@ * SRID DQL function. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class SRID extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'SRID'; + protected function getFunctionName(): string + { + return 'SRID'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STBuffer.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STBuffer.php index a8e81afd..377c7174 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STBuffer.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STBuffer.php @@ -30,34 +30,54 @@ * Description of STIntersects. * * @author Maximilian + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STBuffer extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Buffer'; + protected function getFunctionName(): string + { + return 'ST_Buffer'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STContains.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STContains.php index 917946a9..6116721f 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STContains.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STContains.php @@ -30,35 +30,54 @@ * STContains DQL function. * * @author luca capra + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STContains extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Contains'; + protected function getFunctionName(): string + { + return 'ST_Contains'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STCrosses.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STCrosses.php index 37b1675d..ecf87a01 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STCrosses.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STCrosses.php @@ -30,35 +30,54 @@ * STCrosses DQL function. * * @author luca capra + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STCrosses extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Crosses'; + protected function getFunctionName(): string + { + return 'ST_Crosses'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDisjoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDisjoint.php index b45f43ce..9860e507 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDisjoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDisjoint.php @@ -30,35 +30,54 @@ * STDisjoint DQL function. * * @author luca capra + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STDisjoint extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Disjoint'; + protected function getFunctionName(): string + { + return 'ST_Disjoint'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistance.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistance.php index c12e6683..a6273e1e 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistance.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistance.php @@ -30,35 +30,54 @@ * STDistance DQL function. * * @author luca capra + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STDistance extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Distance'; + protected function getFunctionName(): string + { + return 'ST_Distance'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STEquals.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STEquals.php index 23fb0bb4..0462678c 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STEquals.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STEquals.php @@ -30,35 +30,54 @@ * STEquals DQL function. * * @author luca capra + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STEquals extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Equals'; + protected function getFunctionName(): string + { + return 'ST_Equals'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STIntersects.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STIntersects.php index 29914137..660629bb 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STIntersects.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STIntersects.php @@ -29,35 +29,55 @@ /** * Description of STIntersects. * - * @author Maximilian + * @author Maximilian + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STIntersects extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Intersects'; + protected function getFunctionName(): string + { + return 'ST_Intersects'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STOverlaps.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STOverlaps.php index 7383896b..a7bac459 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STOverlaps.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STOverlaps.php @@ -30,35 +30,54 @@ * STOverlaps DQL function. * * @author luca capra + * @author Alexandre Tranchant * @license http://mit-license.org MIT */ class STOverlaps extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Overlaps'; + protected function getFunctionName(): string + { + return 'ST_Overlaps'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STTouches.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STTouches.php index 3bae5f24..a65ec76b 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STTouches.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STTouches.php @@ -30,35 +30,54 @@ * STTouches DQL function. * * @author Tom Vogt + * @author Alexandre Tranchant * @license http://mit-license.org MIT */ class STTouches extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Touches'; + protected function getFunctionName(): string + { + return 'ST_Touches'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STWithin.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STWithin.php index 03cc820a..87cf55b8 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STWithin.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STWithin.php @@ -30,35 +30,54 @@ * STWithin DQL function. * * @author luca capra + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STWithin extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Within'; + protected function getFunctionName(): string + { + return 'ST_Within'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/StartPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/StartPoint.php index 4e30982e..502766b7 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/StartPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/StartPoint.php @@ -30,35 +30,54 @@ * StartPoint DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class StartPoint extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'StartPoint'; + protected function getFunctionName(): string + { + return 'StartPoint'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Touches.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Touches.php index 7de28d12..30e7db1b 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Touches.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Touches.php @@ -32,35 +32,54 @@ * @deprecated since MySQL 5.7.6 * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class Touches extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'Touches'; + protected function getFunctionName(): string + { + return 'Touches'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Within.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Within.php index ed64a00b..848e01fb 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Within.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Within.php @@ -31,35 +31,54 @@ * Whether MBR of one geometry is within MBR of another. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class Within extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'Within'; + protected function getFunctionName(): string + { + return 'Within'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/X.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/X.php index 63d44db0..ec4da47d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/X.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/X.php @@ -31,35 +31,54 @@ * Return X coordinate of Point. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class X extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'X'; + protected function getFunctionName(): string + { + return 'X'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Y.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Y.php index dfb07812..ccf33e5a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Y.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Y.php @@ -31,35 +31,54 @@ * Return Y coordinate of Point. * * @author Mohammad Heydari + * @author Alexandre Tranchant * @license http://mdhheydari.mit-license.org MIT */ class Y extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'Y'; + protected function getFunctionName(): string + { + return 'Y'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['mysql']; + protected function getPlatforms(): array + { + return ['mysql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php index f48e9629..f951c0eb 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php @@ -30,35 +30,54 @@ * Geometry DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class Geometry extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'geometry'; + protected function getFunctionName(): string + { + return 'geometry'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STArea.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STArea.php index 8d9f3e64..9e0654d1 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STArea.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STArea.php @@ -30,35 +30,54 @@ * ST_Area DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STArea extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Area'; + protected function getFunctionName(): string + { + return 'ST_Area'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsBinary.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsBinary.php index 174aea76..54406a65 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsBinary.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsBinary.php @@ -31,35 +31,54 @@ * ST_AsBinary DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STAsBinary extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_AsBinary'; + protected function getFunctionName(): string + { + return 'ST_AsBinary'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsGeoJson.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsGeoJson.php index 005ee2da..06c20240 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsGeoJson.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsGeoJson.php @@ -31,35 +31,54 @@ * ST_AsGeoJSON DQL function. * * @author Tom Vogt + * @author Alexandre Tranchant * @license http://mit-license.org MIT */ class STAsGeoJson extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_AsGeoJson'; + protected function getFunctionName(): string + { + return 'ST_AsGeoJson'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsText.php index 41f62cc9..0707c35e 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsText.php @@ -31,35 +31,54 @@ * ST_AsText DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STAsText extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_AsText'; + protected function getFunctionName(): string + { + return 'ST_AsText'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAzimuth.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAzimuth.php index cbd35b9f..0639b83a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAzimuth.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAzimuth.php @@ -30,35 +30,54 @@ * ST_Azimuth DQL function. * * @author Tom Vogt - * @license http:// mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STAzimuth extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Azimuth'; + protected function getFunctionName(): string + { + return 'ST_Azimuth'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBoundary.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBoundary.php index f0353a54..5ab70464 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBoundary.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBoundary.php @@ -31,35 +31,54 @@ * ST_Boundary DQL function. * * @author Tom Vogt - * @license http://mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STBoundary extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Boundary'; + protected function getFunctionName(): string + { + return 'ST_Boundary'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBuffer.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBuffer.php index 6fd7edae..40f9369f 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBuffer.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STBuffer.php @@ -28,34 +28,55 @@ /** * ST_Buffer DQL function. + * + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STBuffer extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Buffer'; + protected function getFunctionName(): string + { + return 'ST_Buffer'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property maxGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 3; + protected function getMaxParameter(): int + { + return 3; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property minGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCentroid.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCentroid.php index 6c61f960..a4a01895 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCentroid.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCentroid.php @@ -30,35 +30,54 @@ * ST_Centroid DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STCentroid extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Centroid'; + protected function getFunctionName(): string + { + return 'ST_Centroid'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STClosestPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STClosestPoint.php index 0bee4074..aee73a1c 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STClosestPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STClosestPoint.php @@ -30,35 +30,54 @@ * ST_ClosestPoint DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STClosestPoint extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_ClosestPoint'; + protected function getFunctionName(): string + { + return 'ST_ClosestPoint'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php index 67c8a9b8..65d6bb74 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php @@ -30,35 +30,54 @@ * ST_Collect DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STCollect extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Collect'; + protected function getFunctionName(): string + { + return 'ST_Collect'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContains.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContains.php index 1c203739..987954ec 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContains.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContains.php @@ -30,35 +30,54 @@ * ST_Contains DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STContains extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Contains'; + protected function getFunctionName(): string + { + return 'ST_Contains'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContainsProperly.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContainsProperly.php index e027da58..94e5684a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContainsProperly.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContainsProperly.php @@ -30,35 +30,54 @@ * ST_ContainsProperly DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STContainsProperly extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_ContainsProperly'; + protected function getFunctionName(): string + { + return 'ST_ContainsProperly'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCoveredBy.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCoveredBy.php index dd7fd552..625526e7 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCoveredBy.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCoveredBy.php @@ -30,35 +30,54 @@ * ST_CoveredBy DQL function. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STCoveredBy extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_CoveredBy'; + protected function getFunctionName(): string + { + return 'ST_CoveredBy'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCovers.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCovers.php index acc56a6c..3dd93f64 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCovers.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCovers.php @@ -30,35 +30,54 @@ * ST_Covers DQL function. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STCovers extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Covers'; + protected function getFunctionName(): string + { + return 'ST_Covers'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCrosses.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCrosses.php index 08e9eef4..f4cbab29 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCrosses.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCrosses.php @@ -30,35 +30,54 @@ * ST_Crosses DQL function. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STCrosses extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Crosses'; + protected function getFunctionName(): string + { + return 'ST_Crosses'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDWithin.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDWithin.php index bcee6551..fa5475e7 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDWithin.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDWithin.php @@ -30,35 +30,54 @@ * ST_DWithin DQL function. * * @author David Pacheco + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STDWithin extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_DWithin'; + protected function getFunctionName(): string + { + return 'ST_DWithin'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 3; + protected function getMaxParameter(): int + { + return 3; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDifference.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDifference.php index 3da57f78..c13f7aa1 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDifference.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDifference.php @@ -31,35 +31,54 @@ * ST_Difference DQL function. * * @author Tom Vogt - * @license http:// mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STDifference extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Difference'; + protected function getFunctionName(): string + { + return 'ST_Difference'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDisjoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDisjoint.php index 2e5991d4..a9768fc2 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDisjoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDisjoint.php @@ -30,35 +30,54 @@ * ST_Disjoint DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STDisjoint extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Disjoint'; + protected function getFunctionName(): string + { + return 'ST_Disjoint'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistance.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistance.php index f17ef3c2..9e681fe9 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistance.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistance.php @@ -30,35 +30,54 @@ * ST_Contains DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STDistance extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Distance'; + protected function getFunctionName(): string + { + return 'ST_Distance'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 3; + protected function getMaxParameter(): int + { + return 3; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistanceSphere.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistanceSphere.php index 65a2c2c9..a1ba4c8c 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistanceSphere.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistanceSphere.php @@ -30,35 +30,54 @@ * ST_Distance_Sphere DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STDistanceSphere extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Distance_Sphere'; + protected function getFunctionName(): string + { + return 'ST_Distance_Sphere'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEndPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEndPoint.php index 68ed81be..cb852049 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEndPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEndPoint.php @@ -30,35 +30,54 @@ * ST_EndPoint DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STEndPoint extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_EndPoint'; + protected function getFunctionName(): string + { + return 'ST_EndPoint'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEnvelope.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEnvelope.php index 578d95a7..4748c232 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEnvelope.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEnvelope.php @@ -30,35 +30,54 @@ * ST_Envelope DQL function. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STEnvelope extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Envelope'; + protected function getFunctionName(): string + { + return 'ST_Envelope'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExpand.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExpand.php index 4c8c8ef3..38bd46da 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExpand.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExpand.php @@ -28,34 +28,55 @@ /** * ST_Buffer DQL function. + * + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STExpand extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Expand'; + protected function getFunctionName(): string + { + return 'ST_Expand'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property maxGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property minGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExtent.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExtent.php index 5195ae46..0f9a4524 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExtent.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExtent.php @@ -30,35 +30,54 @@ * ST_Extent DQL function. * * @author Tom Vogt + * @author Alexandre Tranchant * @license http://mit-license.org MIT */ class STExtent extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Extent'; + protected function getFunctionName(): string + { + return 'ST_Extent'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeographyFromText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeographyFromText.php index f1a65511..f66cb16b 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeographyFromText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeographyFromText.php @@ -30,35 +30,54 @@ * ST_GeographyFromText DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STGeographyFromText extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_GeographyFromText'; + protected function getFunctionName(): string + { + return 'ST_GeographyFromText'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromEWKT.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromEWKT.php index 5e3d6596..839452f0 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromEWKT.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromEWKT.php @@ -30,35 +30,54 @@ * ST_GeomFromEWKT DQL function. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STGeomFromEWKT extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_GeomFromEWKT'; + protected function getFunctionName(): string + { + return 'ST_GeomFromEWKT'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromText.php index 38d32ee2..18322d8f 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromText.php @@ -30,35 +30,54 @@ * ST_GeomFromText DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STGeomFromText extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_GeomFromText'; + protected function getFunctionName(): string + { + return 'ST_GeomFromText'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeometryN.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeometryN.php index aea9fbac..d4d3f9c6 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeometryN.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeometryN.php @@ -31,35 +31,54 @@ * ST_GeometryN DQL function. * * @author Tom Vogt + * @author Alexandre Tranchant * @license http:// mit-license.org MIT */ class STGeometryN extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_GeometryN'; + protected function getFunctionName(): string + { + return 'ST_GeometryN'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersection.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersection.php index e38a5e34..0505a35e 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersection.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersection.php @@ -30,35 +30,54 @@ * ST_Intersection DQL function. * * @author Tom Vogt - * @license http://mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STIntersection extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Intersection'; + protected function getFunctionName(): string + { + return 'ST_Intersection'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersects.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersects.php index 42284fb1..194e4972 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersects.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersects.php @@ -30,35 +30,54 @@ * ST_Intersects DQL function. * * @author Tom Vogt + * @author Alexandre Tranchant * @license http://mit-license.org MIT */ class STIntersects extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Intersects'; + protected function getFunctionName(): string + { + return 'ST_Intersects'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLength.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLength.php index 3aa7407b..835cc9ac 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLength.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLength.php @@ -30,35 +30,54 @@ * GLength DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STLength extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Length'; + protected function getFunctionName(): string + { + return 'ST_Length'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirection.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirection.php index 57695a57..74b7d715 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirection.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirection.php @@ -30,35 +30,54 @@ * ST_LineCrossingDirection DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STLineCrossingDirection extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_LineCrossingDirection'; + protected function getFunctionName(): string + { + return 'ST_LineCrossingDirection'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineInterpolatePoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineInterpolatePoint.php index c565eaf4..fe00a9d6 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineInterpolatePoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineInterpolatePoint.php @@ -30,35 +30,54 @@ * ST_Line_Interpolate_Point DQL function. * * @author Tom Vogt - * @license http://mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STLineInterpolatePoint extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Line_Interpolate_Point'; + protected function getFunctionName(): string + { + return 'ST_Line_Interpolate_Point'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineLocatePoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineLocatePoint.php index 2d533dde..80f3a894 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineLocatePoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineLocatePoint.php @@ -30,35 +30,54 @@ * ST_Line_Locate_Point DQL function. * * @author Tom Vogt + * @author Alexandre Tranchant * @license http://mit-license.org MIT */ class STLineLocatePoint extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Line_Locate_Point'; + protected function getFunctionName(): string + { + return 'ST_Line_Locate_Point'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineSubstring.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineSubstring.php index 6780af33..8e86d650 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineSubstring.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineSubstring.php @@ -31,35 +31,54 @@ * ST_Line_Substring DQL function. * * @author Tom Vogt - * @license http://mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STLineSubstring extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Line_Substring'; + protected function getFunctionName(): string + { + return 'ST_Line_Substring'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 3; + protected function getMaxParameter(): int + { + return 3; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 3; + protected function getMinParameter(): int + { + return 3; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeBox2D.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeBox2D.php index ba74eff5..76cab2a9 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeBox2D.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeBox2D.php @@ -30,35 +30,54 @@ * ST_MakeBox2D DQL function. * * @author Tom Vogt - * @license http://mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STMakeBox2D extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_MakeBox2D'; + protected function getFunctionName(): string + { + return 'ST_MakeBox2D'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelope.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelope.php index 2bfe4a81..eacef346 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelope.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelope.php @@ -30,37 +30,54 @@ * ST_MakeEnvelope DQL function. * * @author Dragos Protung - * @license http://dlambert.mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STMakeEnvelope extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_MakeEnvelope'; + protected function getFunctionName(): string + { + return 'ST_MakeEnvelope'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 5; + protected function getMaxParameter(): int + { + return 5; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. * - * From Postgis 2.0, the 5th parameter (SRID) is not required. + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 4; + protected function getMinParameter(): int + { + return 4; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeLine.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeLine.php index 45c94feb..14f75482 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeLine.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeLine.php @@ -32,35 +32,54 @@ * ST_MakeLine also supports sets and arrays of geometry. * * @author Tom Vogt - * @license http://mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STMakeLine extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_MakeLine'; + protected function getFunctionName(): string + { + return 'ST_MakeLine'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakePoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakePoint.php index d488b285..76eca733 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakePoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakePoint.php @@ -30,35 +30,54 @@ * ST_MakePoint DQL function. * * @author David Pacheco - * @license http://dlambert.mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STMakePoint extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_MakePoint'; + protected function getFunctionName(): string + { + return 'ST_MakePoint'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 3; + protected function getMaxParameter(): int + { + return 3; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STOverlaps.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STOverlaps.php index 519e82d7..2d0d9f4d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STOverlaps.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STOverlaps.php @@ -30,35 +30,54 @@ * ST_Overlaps DQL function. * * @author Dragos Protung - * @license http://mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STOverlaps extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Overlaps'; + protected function getFunctionName(): string + { + return 'ST_Overlaps'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STPerimeter.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STPerimeter.php index d48fe35d..384bdaec 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STPerimeter.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STPerimeter.php @@ -30,35 +30,54 @@ * ST_Perimeter DQL function. * * @author Tiago Brito - * @license http://dlambert.mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STPerimeter extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Perimeter'; + protected function getFunctionName(): string + { + return 'ST_Perimeter'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STPoint.php index a1771292..9a0c1719 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STPoint.php @@ -30,35 +30,54 @@ * ST_Point DQL function. * * @author Tom Vogt - * @license http://mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STPoint extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Point'; + protected function getFunctionName(): string + { + return 'ST_Point'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STScale.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STScale.php index 819895db..19b3f26c 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STScale.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STScale.php @@ -30,35 +30,54 @@ * ST_Scale DQL function. * * @author Tom Vogt - * @license http://mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STScale extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Scale'; + protected function getFunctionName(): string + { + return 'ST_Scale'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 3; + protected function getMaxParameter(): int + { + return 3; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 3; + protected function getMinParameter(): int + { + return 3; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSetSRID.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSetSRID.php index 9896c452..4e4e6c44 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSetSRID.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSetSRID.php @@ -30,35 +30,54 @@ * ST_SetSRID DQL function. * * @author Tom Vogt - * @license http://mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STSetSRID extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_SetSRID'; + protected function getFunctionName(): string + { + return 'ST_SetSRID'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSimplify.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSimplify.php index e2d3aec5..f7707dd3 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSimplify.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSimplify.php @@ -28,34 +28,55 @@ /** * ST_Buffer DQL function. + * + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STSimplify extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Simplify'; + protected function getFunctionName(): string + { + return 'ST_Simplify'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property maxGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property minGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSnapToGrid.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSnapToGrid.php index abbe5bac..eab37cf9 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSnapToGrid.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSnapToGrid.php @@ -40,38 +40,11 @@ * geometry ST_SnapToGrid(geometry geomA, geometry pointOrigin, float sizeX, float sizeY, float sizeZ, float sizeM); * * @author Dragos Protung - * @license http://mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STSnapToGrid extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { - /** - * SQL Function name. - * - * @var string - */ - protected $functionName = 'ST_SnapToGrid'; - - /** - * Maximum number of parameters accepted by SQL function. - * - * @var int - */ - protected $maxGeomExpr = 6; - - /** - * Minimum number of parameters accepted by SQL function. - * - * @var int - */ - protected $minGeomExpr = 2; - - /** - * Platform accepting this function. - * - * @var array - */ - protected $platforms = ['postgresql']; - /** * Parse SQL. * @@ -87,32 +60,80 @@ public function parse(Parser $parser) $parser->match(Lexer::T_OPEN_PARENTHESIS); // 1st signature - $this->geomExpr[] = $parser->ArithmeticFactor(); + $this->addGeometryExpression($parser->ArithmeticFactor()); $parser->match(Lexer::T_COMMA); - $this->geomExpr[] = $parser->ArithmeticFactor(); + $this->addGeometryExpression($parser->ArithmeticFactor()); // 2nd signature if (Lexer::T_COMMA === $lexer->lookahead['type']) { $parser->match(Lexer::T_COMMA); - $this->geomExpr[] = $parser->ArithmeticFactor(); + $this->addGeometryExpression($parser->ArithmeticFactor()); } // 3rd signature if (Lexer::T_COMMA === $lexer->lookahead['type']) { $parser->match(Lexer::T_COMMA); - $this->geomExpr[] = $parser->ArithmeticFactor(); + $this->addGeometryExpression($parser->ArithmeticFactor()); $parser->match(Lexer::T_COMMA); - $this->geomExpr[] = $parser->ArithmeticFactor(); + $this->addGeometryExpression($parser->ArithmeticFactor()); // 4th signature if (Lexer::T_COMMA === $lexer->lookahead['type']) { // sizeM $parser->match(Lexer::T_COMMA); - $this->geomExpr[] = $parser->ArithmeticFactor(); + $this->addGeometryExpression($parser->ArithmeticFactor()); } } $parser->match(Lexer::T_CLOSE_PARENTHESIS); } + + /** + * Function SQL name getter. + * + * @since 2.0 This function replace the protected property functionName. + * + * @return string + */ + protected function getFunctionName(): string + { + return 'ST_SnapToGrid'; + } + + /** + * Maximum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int The inherited methods shall NOT return null, but 0 when function has no parameter. + */ + protected function getMaxParameter(): int + { + return 6; + } + + /** + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. + * + * @return int The inherited methods shall NOT return null, but 0 when function has no parameter. + */ + protected function getMinParameter(): int + { + return 2; + } + + /** + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. + * + * @return string[] a non-empty array of accepted platforms. + */ + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSplit.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSplit.php index 95db7b22..4526ca6d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSplit.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSplit.php @@ -31,35 +31,54 @@ * ST_Split DQL function. * * @author Tom Vogt - * @license http:// mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STSplit extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Split'; + protected function getFunctionName(): string + { + return 'ST_Split'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STStartPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STStartPoint.php index 5cb349f2..28ffcc43 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STStartPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STStartPoint.php @@ -30,35 +30,54 @@ * ST_StartPoint DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STStartPoint extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_StartPoint'; + protected function getFunctionName(): string + { + return 'ST_StartPoint'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSummary.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSummary.php index b8939813..e76f64a3 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSummary.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSummary.php @@ -30,35 +30,54 @@ * ST_Summary DQL function. * * @author Derek J. Lambert + * @author Alexandre Tranchant * @license http://dlambert.mit-license.org MIT */ class STSummary extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Summary'; + protected function getFunctionName(): string + { + return 'ST_Summary'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTouches.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTouches.php index 61cf372c..6ae8be19 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTouches.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTouches.php @@ -30,35 +30,54 @@ * ST_Touches DQL function. * * @author Tom Vogt + * @author Alexandre Tranchant * @license http://mit-license.org MIT */ class STTouches extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Touches'; + protected function getFunctionName(): string + { + return 'ST_Touches'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTransform.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTransform.php index c8fe2b84..7bec3918 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTransform.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTransform.php @@ -27,35 +27,56 @@ use CrEOF\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; /** - * ST_Buffer DQL function. + * ST_Transform DQL function. + * + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STTransform extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Transform'; + protected function getFunctionName(): string + { + return 'ST_Transform'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property maxGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property minGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTranslate.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTranslate.php index 24aca440..1637d614 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTranslate.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTranslate.php @@ -31,35 +31,54 @@ * ST_Translate DQL function. * * @author Tom Vogt - * @license http:// mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STTranslate extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Translate'; + protected function getFunctionName(): string + { + return 'ST_Translate'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 4; + protected function getMaxParameter(): int + { + return 4; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 3; + protected function getMinParameter(): int + { + return 3; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STUnion.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STUnion.php index 19a95363..46248c8d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STUnion.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STUnion.php @@ -31,35 +31,54 @@ * ST_Union DQL function. * * @author Tom Vogt - * @license http://mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STUnion extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Union'; + protected function getFunctionName(): string + { + return 'ST_Union'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STWithin.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STWithin.php index 417f7ffa..149d5d68 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STWithin.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STWithin.php @@ -30,35 +30,54 @@ * ST_Within DQL function. * * @author Tom Vogt - * @license http://mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STWithin extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Within'; + protected function getFunctionName(): string + { + return 'ST_Within'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 2; + protected function getMaxParameter(): int + { + return 2; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 2; + protected function getMinParameter(): int + { + return 2; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STX.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STX.php index ac13dad5..f814ec9d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STX.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STX.php @@ -30,35 +30,54 @@ * ST_X DQL function. * * @author Tom Vogt - * @license http:// mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STX extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_X'; + protected function getFunctionName(): string + { + return 'ST_X'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STY.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STY.php index 4fc6518a..16ec0d57 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STY.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STY.php @@ -30,35 +30,54 @@ * ST_Y DQL function. * * @author Tom Vogt - * @license http:// mit-license.org MIT + * @author Alexandre Tranchant + * @license https://alexandre-tranchant.mit-license.org */ class STY extends AbstractSpatialDQLFunction { /** - * SQL Function name. + * Function SQL name getter. * - * @var string + * @since 2.0 This function replace the protected property functionName. */ - protected $functionName = 'ST_Y'; + protected function getFunctionName(): string + { + return 'ST_Y'; + } /** - * Maximum number of parameters accepted by SQL function. + * Maximum number of parameter for the spatial function. * - * @var int + * @since 2.0 This function replace the protected property maxGeomExpr. + * + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $maxGeomExpr = 1; + protected function getMaxParameter(): int + { + return 1; + } /** - * Minimum number of parameters accepted by SQL function. + * Minimum number of parameter for the spatial function. + * + * @since 2.0 This function replace the protected property minGeomExpr. * - * @var int + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ - protected $minGeomExpr = 1; + protected function getMinParameter(): int + { + return 1; + } /** - * Platform accepting this function. + * Get the platforms accepted. + * + * @since 2.0 This function replace the protected property platforms. * - * @var array + * @return string[] a non-empty array of accepted platforms */ - protected $platforms = ['postgresql']; + protected function getPlatforms(): array + { + return ['postgresql']; + } } From 71b4bb86c375f59d23f63154b0e30d347dfb1709 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Wed, 26 Feb 2020 15:45:01 +0100 Subject: [PATCH 40/44] Composer quality wont break a pull request --- .travis.yml | 4 ++-- CONTRIBUTING.md | 2 +- composer.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index c1a0e65e..d49d7cc2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,10 +37,10 @@ before_script: script: - ./vendor/bin/phpunit -v -c ./tests/travis/travis.pgsql.xml --coverage-php ./build/coverage/coverage-pgsql-$TRAVIS_PHP_VERSION-$ORM.cov - ./vendor/bin/phpunit -v -c ./tests/travis/travis.mysql.xml --coverage-php ./build/coverage/coverage-mysql-$TRAVIS_PHP_VERSION-$ORM.cov - # Code should respect rules - - composer quality after_script: + # Code should respect rules + - composer check-quality-code - ./vendor/bin/phpcov merge --clover ./build/logs/clover.xml ./build/coverage - ./vendor/bin/coveralls -v --exclude-no-stmt #Push code climate coverage diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e729592d..defc2bd0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,7 +7,7 @@ Quality of code is auto-verified by php-cs-fixer, php code sniffer and php mess Before a commit, launch the quality script: ```bash -composer quality +composer check-quality-code ``` You can launch PHPCS-FIXER only with: diff --git a/composer.json b/composer.json index ac97f3db..d8b92fc6 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ }, "scripts": { "tt": "php-cs-fixer fix --help", - "quality": [ + "check-quality-code": [ "php-cs-fixer fix --dry-run --config=.php_cs.dist --allow-risky=yes -vvv", "phpcs --standard=phpcs.xml.dist -s", "phpmd lib text ./phpmd.lib.xml", From b0ed403a66f6cce00c6d3c3a265404e81560c787 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Wed, 26 Feb 2020 16:07:39 +0100 Subject: [PATCH 41/44] license with http link replaced by https link. --- .travis.yml | 4 ++-- lib/CrEOF/Spatial/DBAL/Types/Geography/LineStringType.php | 2 +- lib/CrEOF/Spatial/DBAL/Types/Geography/PointType.php | 2 +- lib/CrEOF/Spatial/DBAL/Types/Geography/PolygonType.php | 2 +- lib/CrEOF/Spatial/DBAL/Types/GeographyType.php | 2 +- lib/CrEOF/Spatial/DBAL/Types/Geometry/LineStringType.php | 2 +- lib/CrEOF/Spatial/DBAL/Types/Geometry/MultiPolygonType.php | 2 +- lib/CrEOF/Spatial/DBAL/Types/Geometry/PointType.php | 2 +- lib/CrEOF/Spatial/DBAL/Types/Geometry/PolygonType.php | 2 +- lib/CrEOF/Spatial/DBAL/Types/GeometryType.php | 2 +- lib/CrEOF/Spatial/Exception/InvalidValueException.php | 2 +- lib/CrEOF/Spatial/Exception/UnsupportedPlatformException.php | 2 +- .../ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Area.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsText.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Buffer.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Centroid.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Contains.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Crosses.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Dimension.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Disjoint.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Distance.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/EndPoint.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Envelope.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Equals.php | 2 +- .../Spatial/ORM/Query/AST/Functions/MySql/ExteriorRing.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GLength.php | 2 +- .../Spatial/ORM/Query/AST/Functions/MySql/GeomFromText.php | 2 +- .../Spatial/ORM/Query/AST/Functions/MySql/GeometryType.php | 2 +- .../Spatial/ORM/Query/AST/Functions/MySql/InteriorRingN.php | 2 +- .../Spatial/ORM/Query/AST/Functions/MySql/Intersects.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsClosed.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsEmpty.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsSimple.php | 2 +- .../Spatial/ORM/Query/AST/Functions/MySql/LineString.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBREqual.php | 2 +- .../Spatial/ORM/Query/AST/Functions/MySql/MBRIntersects.php | 2 +- .../Spatial/ORM/Query/AST/Functions/MySql/MBROverlaps.php | 2 +- .../Spatial/ORM/Query/AST/Functions/MySql/MBRTouches.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRWithin.php | 2 +- .../ORM/Query/AST/Functions/MySql/NumInteriorRings.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumPoints.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Overlaps.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointN.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/SRID.php | 2 +- .../Spatial/ORM/Query/AST/Functions/MySql/STContains.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STCrosses.php | 2 +- .../Spatial/ORM/Query/AST/Functions/MySql/STDisjoint.php | 2 +- .../Spatial/ORM/Query/AST/Functions/MySql/STDistance.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STEquals.php | 2 +- .../Spatial/ORM/Query/AST/Functions/MySql/STOverlaps.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STTouches.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STWithin.php | 2 +- .../Spatial/ORM/Query/AST/Functions/MySql/StartPoint.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Touches.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Within.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/X.php | 2 +- lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Y.php | 2 +- .../Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php | 2 +- .../Spatial/ORM/Query/AST/Functions/PostgreSql/STArea.php | 2 +- .../Spatial/ORM/Query/AST/Functions/PostgreSql/STAsBinary.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STAsGeoJson.php | 2 +- .../Spatial/ORM/Query/AST/Functions/PostgreSql/STAsText.php | 2 +- .../Spatial/ORM/Query/AST/Functions/PostgreSql/STCentroid.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STClosestPoint.php | 2 +- .../Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php | 2 +- .../Spatial/ORM/Query/AST/Functions/PostgreSql/STContains.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STContainsProperly.php | 2 +- .../Spatial/ORM/Query/AST/Functions/PostgreSql/STDWithin.php | 2 +- .../Spatial/ORM/Query/AST/Functions/PostgreSql/STDisjoint.php | 2 +- .../Spatial/ORM/Query/AST/Functions/PostgreSql/STDistance.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STDistanceSphere.php | 2 +- .../Spatial/ORM/Query/AST/Functions/PostgreSql/STEndPoint.php | 2 +- .../Spatial/ORM/Query/AST/Functions/PostgreSql/STExtent.php | 2 +- .../Query/AST/Functions/PostgreSql/STGeographyFromText.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STGeomFromText.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STGeometryN.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STIntersects.php | 2 +- .../Spatial/ORM/Query/AST/Functions/PostgreSql/STLength.php | 2 +- .../AST/Functions/PostgreSql/STLineCrossingDirection.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STLineLocatePoint.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STSnapToGrid.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STStartPoint.php | 2 +- .../Spatial/ORM/Query/AST/Functions/PostgreSql/STSummary.php | 2 +- .../Spatial/ORM/Query/AST/Functions/PostgreSql/STTouches.php | 2 +- .../ORM/Query/AST/Functions/ReturnsGeometryInterface.php | 2 +- lib/CrEOF/Spatial/ORM/Query/GeometryWalker.php | 2 +- lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php | 2 +- lib/CrEOF/Spatial/PHP/Types/AbstractLineString.php | 2 +- lib/CrEOF/Spatial/PHP/Types/AbstractMultiLineString.php | 2 +- lib/CrEOF/Spatial/PHP/Types/AbstractMultiPoint.php | 2 +- lib/CrEOF/Spatial/PHP/Types/AbstractMultiPolygon.php | 2 +- lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php | 2 +- lib/CrEOF/Spatial/PHP/Types/AbstractPolygon.php | 2 +- lib/CrEOF/Spatial/PHP/Types/Geography/GeographyInterface.php | 2 +- lib/CrEOF/Spatial/PHP/Types/Geography/LineString.php | 2 +- lib/CrEOF/Spatial/PHP/Types/Geography/Point.php | 2 +- lib/CrEOF/Spatial/PHP/Types/Geography/Polygon.php | 2 +- lib/CrEOF/Spatial/PHP/Types/Geometry/GeometryInterface.php | 2 +- lib/CrEOF/Spatial/PHP/Types/Geometry/LineString.php | 2 +- lib/CrEOF/Spatial/PHP/Types/Geometry/MultiLineString.php | 2 +- lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPoint.php | 2 +- lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPolygon.php | 2 +- lib/CrEOF/Spatial/PHP/Types/Geometry/Point.php | 2 +- lib/CrEOF/Spatial/PHP/Types/Geometry/Polygon.php | 2 +- tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php | 2 +- .../Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php | 2 +- .../Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php | 2 +- .../Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php | 2 +- .../Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php | 2 +- .../CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php | 2 +- .../Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php | 2 +- tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php | 2 +- tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php | 2 +- tests/CrEOF/Spatial/Tests/Fixtures/GeoLineStringEntity.php | 2 +- tests/CrEOF/Spatial/Tests/Fixtures/GeoPointSridEntity.php | 2 +- tests/CrEOF/Spatial/Tests/Fixtures/GeoPolygonEntity.php | 2 +- tests/CrEOF/Spatial/Tests/Fixtures/GeographyEntity.php | 2 +- tests/CrEOF/Spatial/Tests/Fixtures/GeometryEntity.php | 2 +- tests/CrEOF/Spatial/Tests/Fixtures/LineStringEntity.php | 2 +- tests/CrEOF/Spatial/Tests/Fixtures/MultiPolygonEntity.php | 2 +- tests/CrEOF/Spatial/Tests/Fixtures/NoHintGeometryEntity.php | 2 +- tests/CrEOF/Spatial/Tests/Fixtures/PointEntity.php | 2 +- tests/CrEOF/Spatial/Tests/Fixtures/PolygonEntity.php | 2 +- tests/CrEOF/Spatial/Tests/Helper/LineStringHelperTrait.php | 2 +- tests/CrEOF/Spatial/Tests/Helper/PointHelperTrait.php | 2 +- tests/CrEOF/Spatial/Tests/Helper/PolygonHelperTrait.php | 2 +- .../Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STCollectTest.php | 2 +- .../Query/AST/Functions/PostgreSql/STContainsProperlyTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STContainsTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php | 2 +- .../Query/AST/Functions/PostgreSql/STDistanceSphereTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php | 2 +- .../Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php | 2 +- .../AST/Functions/PostgreSql/STLineCrossingDirectionTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php | 2 +- .../ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php | 2 +- tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php | 2 +- tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php | 2 +- 165 files changed, 166 insertions(+), 166 deletions(-) diff --git a/.travis.yml b/.travis.yml index d49d7cc2..07f982ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,12 +39,12 @@ script: - ./vendor/bin/phpunit -v -c ./tests/travis/travis.mysql.xml --coverage-php ./build/coverage/coverage-mysql-$TRAVIS_PHP_VERSION-$ORM.cov after_script: - # Code should respect rules - - composer check-quality-code - ./vendor/bin/phpcov merge --clover ./build/logs/clover.xml ./build/coverage - ./vendor/bin/coveralls -v --exclude-no-stmt #Push code climate coverage - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT + # Code should respect rules + - composer check-quality-code notifications: webhooks: https://coveralls.io/webhook?repo_token=$COVERALLS_WEBHOOK diff --git a/lib/CrEOF/Spatial/DBAL/Types/Geography/LineStringType.php b/lib/CrEOF/Spatial/DBAL/Types/Geography/LineStringType.php index 3bef9965..0f2be350 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/Geography/LineStringType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/Geography/LineStringType.php @@ -30,7 +30,7 @@ * Doctrine LINESTRING type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class LineStringType extends GeographyType { diff --git a/lib/CrEOF/Spatial/DBAL/Types/Geography/PointType.php b/lib/CrEOF/Spatial/DBAL/Types/Geography/PointType.php index dfd6bfe3..333651d1 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/Geography/PointType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/Geography/PointType.php @@ -30,7 +30,7 @@ * Doctrine POINT type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class PointType extends GeographyType { diff --git a/lib/CrEOF/Spatial/DBAL/Types/Geography/PolygonType.php b/lib/CrEOF/Spatial/DBAL/Types/Geography/PolygonType.php index 0a12b747..2305b99d 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/Geography/PolygonType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/Geography/PolygonType.php @@ -30,7 +30,7 @@ * Doctrine POLYGON type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class PolygonType extends GeographyType { diff --git a/lib/CrEOF/Spatial/DBAL/Types/GeographyType.php b/lib/CrEOF/Spatial/DBAL/Types/GeographyType.php index 1992ea47..048757ff 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/GeographyType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/GeographyType.php @@ -28,7 +28,7 @@ * Doctrine GEOGRAPHY type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class GeographyType extends AbstractSpatialType { diff --git a/lib/CrEOF/Spatial/DBAL/Types/Geometry/LineStringType.php b/lib/CrEOF/Spatial/DBAL/Types/Geometry/LineStringType.php index d3c43bf5..f64e8e15 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/Geometry/LineStringType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/Geometry/LineStringType.php @@ -30,7 +30,7 @@ * Doctrine LINESTRING type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class LineStringType extends GeometryType { diff --git a/lib/CrEOF/Spatial/DBAL/Types/Geometry/MultiPolygonType.php b/lib/CrEOF/Spatial/DBAL/Types/Geometry/MultiPolygonType.php index 6655f1c9..9d821c05 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/Geometry/MultiPolygonType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/Geometry/MultiPolygonType.php @@ -30,7 +30,7 @@ * Doctrine MULTIPOLYGON type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class MultiPolygonType extends GeometryType { diff --git a/lib/CrEOF/Spatial/DBAL/Types/Geometry/PointType.php b/lib/CrEOF/Spatial/DBAL/Types/Geometry/PointType.php index af0df088..6b767435 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/Geometry/PointType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/Geometry/PointType.php @@ -30,7 +30,7 @@ * Doctrine POINT type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class PointType extends GeometryType { diff --git a/lib/CrEOF/Spatial/DBAL/Types/Geometry/PolygonType.php b/lib/CrEOF/Spatial/DBAL/Types/Geometry/PolygonType.php index 72fb86fd..fc01be08 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/Geometry/PolygonType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/Geometry/PolygonType.php @@ -30,7 +30,7 @@ * Doctrine POLYGON type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class PolygonType extends GeometryType { diff --git a/lib/CrEOF/Spatial/DBAL/Types/GeometryType.php b/lib/CrEOF/Spatial/DBAL/Types/GeometryType.php index 7183fe4e..d39a9231 100644 --- a/lib/CrEOF/Spatial/DBAL/Types/GeometryType.php +++ b/lib/CrEOF/Spatial/DBAL/Types/GeometryType.php @@ -28,7 +28,7 @@ * Doctrine GEOMETRY type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class GeometryType extends AbstractSpatialType { diff --git a/lib/CrEOF/Spatial/Exception/InvalidValueException.php b/lib/CrEOF/Spatial/Exception/InvalidValueException.php index 825cc0c6..753ec097 100644 --- a/lib/CrEOF/Spatial/Exception/InvalidValueException.php +++ b/lib/CrEOF/Spatial/Exception/InvalidValueException.php @@ -30,7 +30,7 @@ * InvalidValueException class. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class InvalidValueException extends Exception { diff --git a/lib/CrEOF/Spatial/Exception/UnsupportedPlatformException.php b/lib/CrEOF/Spatial/Exception/UnsupportedPlatformException.php index d9fdcff7..7a7506f4 100644 --- a/lib/CrEOF/Spatial/Exception/UnsupportedPlatformException.php +++ b/lib/CrEOF/Spatial/Exception/UnsupportedPlatformException.php @@ -30,7 +30,7 @@ * UnsupportedPlatformException class. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class UnsupportedPlatformException extends Exception { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php index d8379291..f22ed363 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php @@ -40,7 +40,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * This spatial class is updated to avoid non-covered code. A lot of PostgreSQL was not tested, but that tha was not * displayed by coverage rapport. Some MySQL methods generates bug since MySQL 8.0 because their name was updated. diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Area.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Area.php index 143ca87c..fd7077c3 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Area.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Area.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class Area extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php index bc530b81..9bd4b2ee 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsBinary.php @@ -32,7 +32,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class AsBinary extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsText.php index 2927c1fc..1f017afd 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/AsText.php @@ -32,7 +32,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class AsText extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Buffer.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Buffer.php index ba34d5db..529678da 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Buffer.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Buffer.php @@ -31,7 +31,7 @@ * * @author luca capra * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class Buffer extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Centroid.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Centroid.php index ba0fd1a0..d3819c82 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Centroid.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Centroid.php @@ -31,7 +31,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class Centroid extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Contains.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Contains.php index b103db3d..af89a9a3 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Contains.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Contains.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class Contains extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Crosses.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Crosses.php index 2f363a7d..01753c26 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Crosses.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Crosses.php @@ -31,7 +31,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class Crosses extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Dimension.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Dimension.php index 59bbb79d..3e479002 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Dimension.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Dimension.php @@ -31,7 +31,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class Dimension extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Disjoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Disjoint.php index c5c5d0ac..6aa276a5 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Disjoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Disjoint.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class Disjoint extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Distance.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Distance.php index 03008d9e..8bb41306 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Distance.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Distance.php @@ -31,7 +31,7 @@ * * @author luca capra * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class Distance extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/EndPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/EndPoint.php index 87d909a1..09feb6eb 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/EndPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/EndPoint.php @@ -31,7 +31,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class EndPoint extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Envelope.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Envelope.php index e57c2c9f..0d449222 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Envelope.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Envelope.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class Envelope extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Equals.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Equals.php index f79b7c4e..d12e94e5 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Equals.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Equals.php @@ -31,7 +31,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class Equals extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/ExteriorRing.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/ExteriorRing.php index dea01c53..eebf26e6 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/ExteriorRing.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/ExteriorRing.php @@ -31,7 +31,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class ExteriorRing extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GLength.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GLength.php index 86ebfd33..44dd2652 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GLength.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GLength.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class GLength extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeomFromText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeomFromText.php index bc250594..76f631e2 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeomFromText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeomFromText.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class GeomFromText extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeometryType.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeometryType.php index 41c0ca65..7ac086df 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeometryType.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/GeometryType.php @@ -31,7 +31,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class GeometryType extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/InteriorRingN.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/InteriorRingN.php index 0647ba5d..f109af38 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/InteriorRingN.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/InteriorRingN.php @@ -31,7 +31,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class InteriorRingN extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Intersects.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Intersects.php index b6604c24..7bf8f5b1 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Intersects.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Intersects.php @@ -32,7 +32,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class Intersects extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsClosed.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsClosed.php index 50fa99e5..607bbcd0 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsClosed.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsClosed.php @@ -31,7 +31,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class IsClosed extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsEmpty.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsEmpty.php index 952c1b4e..78f9f716 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsEmpty.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsEmpty.php @@ -31,7 +31,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class IsEmpty extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsSimple.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsSimple.php index 35b216c4..0a1257a1 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsSimple.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/IsSimple.php @@ -31,7 +31,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class IsSimple extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineString.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineString.php index ef3f59f4..f1c76833 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineString.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/LineString.php @@ -31,7 +31,7 @@ * * @author Damiano Ciarla * @author Alexandre Tranchant - * @license http://opensource.org/licenses/MIT MIT + * @license https://opensource.org/licenses/MIT MIT */ class LineString extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBREqual.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBREqual.php index b6e48e8c..bbbedcd6 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBREqual.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBREqual.php @@ -31,7 +31,7 @@ * * @author luca capra * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class MBREqual extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRIntersects.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRIntersects.php index 387bfe49..89dfc75e 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRIntersects.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRIntersects.php @@ -32,7 +32,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class MBRIntersects extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBROverlaps.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBROverlaps.php index c4ebaad7..86c4509d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBROverlaps.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBROverlaps.php @@ -32,7 +32,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class MBROverlaps extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRTouches.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRTouches.php index b041b4b0..10d15441 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRTouches.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRTouches.php @@ -32,7 +32,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class MBRTouches extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRWithin.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRWithin.php index 34483e5b..e931af57 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRWithin.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/MBRWithin.php @@ -32,7 +32,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class MBRWithin extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumInteriorRings.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumInteriorRings.php index 1e007a15..17fe3dd0 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumInteriorRings.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumInteriorRings.php @@ -32,7 +32,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class NumInteriorRings extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumPoints.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumPoints.php index 438ba262..d3e595df 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumPoints.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/NumPoints.php @@ -32,7 +32,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class NumPoints extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Overlaps.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Overlaps.php index 73412f5d..2f38aa83 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Overlaps.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Overlaps.php @@ -32,7 +32,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class Overlaps extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointN.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointN.php index e1cea536..de96b79d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointN.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/PointN.php @@ -32,7 +32,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class PointN extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/SRID.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/SRID.php index cee72acd..2557d34a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/SRID.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/SRID.php @@ -31,7 +31,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class SRID extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STContains.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STContains.php index 6116721f..a46561e2 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STContains.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STContains.php @@ -31,7 +31,7 @@ * * @author luca capra * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STContains extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STCrosses.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STCrosses.php index ecf87a01..b7f964a9 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STCrosses.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STCrosses.php @@ -31,7 +31,7 @@ * * @author luca capra * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STCrosses extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDisjoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDisjoint.php index 9860e507..f76c63be 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDisjoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDisjoint.php @@ -31,7 +31,7 @@ * * @author luca capra * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STDisjoint extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistance.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistance.php index a6273e1e..03c25e7d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistance.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STDistance.php @@ -31,7 +31,7 @@ * * @author luca capra * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STDistance extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STEquals.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STEquals.php index 0462678c..492cfc34 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STEquals.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STEquals.php @@ -31,7 +31,7 @@ * * @author luca capra * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STEquals extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STOverlaps.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STOverlaps.php index a7bac459..5409b478 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STOverlaps.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STOverlaps.php @@ -31,7 +31,7 @@ * * @author luca capra * @author Alexandre Tranchant - * @license http://mit-license.org MIT + * @license https://mit-license.org MIT */ class STOverlaps extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STTouches.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STTouches.php index a65ec76b..89ea49c1 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STTouches.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STTouches.php @@ -31,7 +31,7 @@ * * @author Tom Vogt * @author Alexandre Tranchant - * @license http://mit-license.org MIT + * @license https://mit-license.org MIT */ class STTouches extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STWithin.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STWithin.php index 87cf55b8..0f7bbb2a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STWithin.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/STWithin.php @@ -31,7 +31,7 @@ * * @author luca capra * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STWithin extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/StartPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/StartPoint.php index 502766b7..1246b07b 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/StartPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/StartPoint.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class StartPoint extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Touches.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Touches.php index 30e7db1b..5a4b1724 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Touches.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Touches.php @@ -33,7 +33,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class Touches extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Within.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Within.php index 848e01fb..dd6c09c9 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Within.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Within.php @@ -32,7 +32,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class Within extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/X.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/X.php index ec4da47d..af759c5a 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/X.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/X.php @@ -32,7 +32,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class X extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Y.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Y.php index ccf33e5a..cdb97e8e 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Y.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/MySql/Y.php @@ -32,7 +32,7 @@ * * @author Mohammad Heydari * @author Alexandre Tranchant - * @license http://mdhheydari.mit-license.org MIT + * @license https://mdhheydari.mit-license.org MIT */ class Y extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php index f951c0eb..6a37ee18 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/Geometry.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class Geometry extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STArea.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STArea.php index 9e0654d1..8e4a1027 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STArea.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STArea.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STArea extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsBinary.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsBinary.php index 54406a65..3dc8370d 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsBinary.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsBinary.php @@ -32,7 +32,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STAsBinary extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsGeoJson.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsGeoJson.php index 06c20240..54514544 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsGeoJson.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsGeoJson.php @@ -32,7 +32,7 @@ * * @author Tom Vogt * @author Alexandre Tranchant - * @license http://mit-license.org MIT + * @license https://mit-license.org MIT */ class STAsGeoJson extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsText.php index 0707c35e..a7baf4b0 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STAsText.php @@ -32,7 +32,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STAsText extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCentroid.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCentroid.php index a4a01895..978e55ab 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCentroid.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCentroid.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STCentroid extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STClosestPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STClosestPoint.php index aee73a1c..e75c73bb 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STClosestPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STClosestPoint.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STClosestPoint extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php index 65d6bb74..3b9e14ba 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STCollect.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STCollect extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContains.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContains.php index 987954ec..1015ca8f 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContains.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContains.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STContains extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContainsProperly.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContainsProperly.php index 94e5684a..b06ee70c 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContainsProperly.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STContainsProperly.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STContainsProperly extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDWithin.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDWithin.php index fa5475e7..45d65c26 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDWithin.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDWithin.php @@ -31,7 +31,7 @@ * * @author David Pacheco * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STDWithin extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDisjoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDisjoint.php index a9768fc2..62aa4a79 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDisjoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDisjoint.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STDisjoint extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistance.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistance.php index 9e681fe9..f8380b27 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistance.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistance.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STDistance extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistanceSphere.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistanceSphere.php index a1ba4c8c..2b57f9cb 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistanceSphere.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STDistanceSphere.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STDistanceSphere extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEndPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEndPoint.php index cb852049..3ef8cd1b 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEndPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STEndPoint.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STEndPoint extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExtent.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExtent.php index 0f9a4524..81d5fde9 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExtent.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STExtent.php @@ -31,7 +31,7 @@ * * @author Tom Vogt * @author Alexandre Tranchant - * @license http://mit-license.org MIT + * @license https://mit-license.org MIT */ class STExtent extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeographyFromText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeographyFromText.php index f66cb16b..96b2c112 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeographyFromText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeographyFromText.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STGeographyFromText extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromText.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromText.php index 18322d8f..0d6b81ff 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromText.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeomFromText.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STGeomFromText extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeometryN.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeometryN.php index d4d3f9c6..6b5ca40b 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeometryN.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STGeometryN.php @@ -32,7 +32,7 @@ * * @author Tom Vogt * @author Alexandre Tranchant - * @license http:// mit-license.org MIT + * @license https:// mit-license.org MIT */ class STGeometryN extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersects.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersects.php index 194e4972..11660fc3 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersects.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STIntersects.php @@ -31,7 +31,7 @@ * * @author Tom Vogt * @author Alexandre Tranchant - * @license http://mit-license.org MIT + * @license https://mit-license.org MIT */ class STIntersects extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLength.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLength.php index 835cc9ac..5d130ea7 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLength.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLength.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STLength extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirection.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirection.php index 74b7d715..df686548 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirection.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirection.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STLineCrossingDirection extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineLocatePoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineLocatePoint.php index 80f3a894..b2072ad6 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineLocatePoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STLineLocatePoint.php @@ -31,7 +31,7 @@ * * @author Tom Vogt * @author Alexandre Tranchant - * @license http://mit-license.org MIT + * @license https://mit-license.org MIT */ class STLineLocatePoint extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSnapToGrid.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSnapToGrid.php index eab37cf9..c9201151 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSnapToGrid.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSnapToGrid.php @@ -33,7 +33,7 @@ /** * ST_SnapToGrid DQL function. * - * Possible signatures: + * Possible signatures with 2, 3, 5 or 6 parameters: * geometry ST_SnapToGrid(geometry geomA, float size); * geometry ST_SnapToGrid(geometry geomA, float sizeX, float sizeY); * geometry ST_SnapToGrid(geometry geomA, float originX, float originY, float sizeX, float sizeY); diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STStartPoint.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STStartPoint.php index 28ffcc43..2dce85c0 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STStartPoint.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STStartPoint.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STStartPoint extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSummary.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSummary.php index e76f64a3..f5414eb6 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSummary.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSummary.php @@ -31,7 +31,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class STSummary extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTouches.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTouches.php index 6ae8be19..678166db 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTouches.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STTouches.php @@ -31,7 +31,7 @@ * * @author Tom Vogt * @author Alexandre Tranchant - * @license http://mit-license.org MIT + * @license https://mit-license.org MIT */ class STTouches extends AbstractSpatialDQLFunction { diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/ReturnsGeometryInterface.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/ReturnsGeometryInterface.php index d377d48a..c46382c9 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/ReturnsGeometryInterface.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/ReturnsGeometryInterface.php @@ -28,7 +28,7 @@ * Interface to indicate function returns a geometry value. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ interface ReturnsGeometryInterface { diff --git a/lib/CrEOF/Spatial/ORM/Query/GeometryWalker.php b/lib/CrEOF/Spatial/ORM/Query/GeometryWalker.php index 332a3cf0..653c9aef 100644 --- a/lib/CrEOF/Spatial/ORM/Query/GeometryWalker.php +++ b/lib/CrEOF/Spatial/ORM/Query/GeometryWalker.php @@ -38,7 +38,7 @@ * Custom DQL AST walker to return geometry objects from queries instead of strings. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class GeometryWalker extends SqlWalker { diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php b/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php index e7f04828..8acf3bd6 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php @@ -31,7 +31,7 @@ * Abstract geometry object for spatial types. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ abstract class AbstractGeometry implements GeometryInterface { diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractLineString.php b/lib/CrEOF/Spatial/PHP/Types/AbstractLineString.php index 6ed379ce..23d43398 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractLineString.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractLineString.php @@ -28,7 +28,7 @@ * Abstract LineString object for LINESTRING spatial types. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ abstract class AbstractLineString extends AbstractMultiPoint { diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiLineString.php b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiLineString.php index 191fc5c3..8773db8f 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiLineString.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiLineString.php @@ -30,7 +30,7 @@ * Abstract MultiLineString object for MULTILINESTRING spatial types. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ abstract class AbstractMultiLineString extends AbstractGeometry { diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPoint.php b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPoint.php index bc4f284a..66178890 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPoint.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPoint.php @@ -30,7 +30,7 @@ * Abstract MultiPoint object for MULTIPOINT spatial types. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ abstract class AbstractMultiPoint extends AbstractGeometry { diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPolygon.php b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPolygon.php index 12e72275..d489bb1f 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPolygon.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPolygon.php @@ -30,7 +30,7 @@ * Abstract Polygon object for POLYGON spatial types. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ abstract class AbstractMultiPolygon extends AbstractGeometry { diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php b/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php index 13386afd..6efb474d 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php @@ -36,7 +36,7 @@ * http://docs.geotools.org/latest/userguide/library/referencing/order.html * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ abstract class AbstractPoint extends AbstractGeometry { diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractPolygon.php b/lib/CrEOF/Spatial/PHP/Types/AbstractPolygon.php index 14011d38..2a060c91 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractPolygon.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractPolygon.php @@ -30,7 +30,7 @@ * Abstract Polygon object for POLYGON spatial types. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ abstract class AbstractPolygon extends AbstractGeometry { diff --git a/lib/CrEOF/Spatial/PHP/Types/Geography/GeographyInterface.php b/lib/CrEOF/Spatial/PHP/Types/Geography/GeographyInterface.php index 661df77a..dc197daf 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geography/GeographyInterface.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geography/GeographyInterface.php @@ -28,7 +28,7 @@ * Geography interface for Geography objects. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ interface GeographyInterface { diff --git a/lib/CrEOF/Spatial/PHP/Types/Geography/LineString.php b/lib/CrEOF/Spatial/PHP/Types/Geography/LineString.php index 511d8ebf..653d4e28 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geography/LineString.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geography/LineString.php @@ -30,7 +30,7 @@ * LineString object for LINESTRING geography type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class LineString extends AbstractLineString implements GeographyInterface { diff --git a/lib/CrEOF/Spatial/PHP/Types/Geography/Point.php b/lib/CrEOF/Spatial/PHP/Types/Geography/Point.php index 302e45c8..6d5bd469 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geography/Point.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geography/Point.php @@ -34,7 +34,7 @@ * Point object for POINT geography type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class Point extends AbstractPoint implements GeographyInterface { diff --git a/lib/CrEOF/Spatial/PHP/Types/Geography/Polygon.php b/lib/CrEOF/Spatial/PHP/Types/Geography/Polygon.php index ed2eb8d4..52f96f36 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geography/Polygon.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geography/Polygon.php @@ -30,7 +30,7 @@ * Polygon object for POLYGON geography type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class Polygon extends AbstractPolygon implements GeographyInterface { diff --git a/lib/CrEOF/Spatial/PHP/Types/Geometry/GeometryInterface.php b/lib/CrEOF/Spatial/PHP/Types/Geometry/GeometryInterface.php index b22ca120..857f3bb8 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geometry/GeometryInterface.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geometry/GeometryInterface.php @@ -28,7 +28,7 @@ * Geometry interface for Geometry objects. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ interface GeometryInterface { diff --git a/lib/CrEOF/Spatial/PHP/Types/Geometry/LineString.php b/lib/CrEOF/Spatial/PHP/Types/Geometry/LineString.php index ba9c4fd4..abfb6b5b 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geometry/LineString.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geometry/LineString.php @@ -30,7 +30,7 @@ * LineString object for LINESTRING geometry type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class LineString extends AbstractLineString { diff --git a/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiLineString.php b/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiLineString.php index 5eb7b604..03c00496 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiLineString.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiLineString.php @@ -30,7 +30,7 @@ * MultiLineString object for MULTILINESTRING geometry type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class MultiLineString extends AbstractMultiLineString { diff --git a/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPoint.php b/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPoint.php index 7d99b1b3..346b7f50 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPoint.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPoint.php @@ -30,7 +30,7 @@ * MultiPoint object for MULTIPOINT geometry type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class MultiPoint extends AbstractMultiPoint { diff --git a/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPolygon.php b/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPolygon.php index 9394285f..7968b312 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPolygon.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geometry/MultiPolygon.php @@ -30,7 +30,7 @@ * MultiPolygon object for MULTIPOLYGON geometry type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class MultiPolygon extends AbstractMultiPolygon { diff --git a/lib/CrEOF/Spatial/PHP/Types/Geometry/Point.php b/lib/CrEOF/Spatial/PHP/Types/Geometry/Point.php index 137626cc..a1b1c914 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geometry/Point.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geometry/Point.php @@ -30,7 +30,7 @@ * Point object for POINT geometry type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class Point extends AbstractPoint { diff --git a/lib/CrEOF/Spatial/PHP/Types/Geometry/Polygon.php b/lib/CrEOF/Spatial/PHP/Types/Geometry/Polygon.php index d3ccc522..e3799a3c 100644 --- a/lib/CrEOF/Spatial/PHP/Types/Geometry/Polygon.php +++ b/lib/CrEOF/Spatial/PHP/Types/Geometry/Polygon.php @@ -30,7 +30,7 @@ * Polygon object for POLYGON geometry type. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT */ class Polygon extends AbstractPolygon { diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php index 9993ca73..0b5a7391 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Platform/PlatformTest.php @@ -36,7 +36,7 @@ * Spatial platform tests. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group geometry * diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php index 7a2de9b9..fe5eaba9 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php @@ -38,7 +38,7 @@ * Doctrine GeographyType tests. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group srid * diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php index b4425450..48f386e0 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php @@ -40,7 +40,7 @@ * PolygonType tests. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group geography * diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php index ec3e855d..a648b4b7 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php @@ -39,7 +39,7 @@ * Doctrine LineStringType tests. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group geometry * diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php index bd800872..169c2bfb 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php @@ -41,7 +41,7 @@ * MultiPolygonType tests. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group geometry * diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php index 09df3f42..d87f1fdb 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php @@ -38,7 +38,7 @@ * Doctrine PointType tests. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group geometry * diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php index c10689e4..5b508ba1 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php @@ -40,7 +40,7 @@ * PolygonType tests. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group geometry * diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php index e869ff5e..063bf3eb 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php @@ -41,7 +41,7 @@ * Doctrine GeometryType tests. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group geometry * diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php index b6e3baab..aed57189 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php @@ -35,7 +35,7 @@ * Doctrine schema related tests. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @internal * @coversDefaultClass diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/GeoLineStringEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/GeoLineStringEntity.php index 78bd8402..29c3d2cf 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/GeoLineStringEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/GeoLineStringEntity.php @@ -35,7 +35,7 @@ * LineString entity. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @Entity * @Table diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/GeoPointSridEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/GeoPointSridEntity.php index d3671f6e..b5d98ca4 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/GeoPointSridEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/GeoPointSridEntity.php @@ -34,7 +34,7 @@ * Geography point entity specifying SRID. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @Entity */ diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/GeoPolygonEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/GeoPolygonEntity.php index 986cda83..b2c5e5a6 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/GeoPolygonEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/GeoPolygonEntity.php @@ -35,7 +35,7 @@ * Polygon entity. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @Entity * @Table diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/GeographyEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/GeographyEntity.php index c44506a6..27665c43 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/GeographyEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/GeographyEntity.php @@ -34,7 +34,7 @@ * Geography entity. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @Entity */ diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/GeometryEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/GeometryEntity.php index 8af2938d..d3f163d9 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/GeometryEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/GeometryEntity.php @@ -35,7 +35,7 @@ * Geometry entity. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @Entity * @Table diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/LineStringEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/LineStringEntity.php index ac0094d4..c6f29d62 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/LineStringEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/LineStringEntity.php @@ -35,7 +35,7 @@ * LineString entity. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @Entity * @Table diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/MultiPolygonEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/MultiPolygonEntity.php index 81551f73..55060d9c 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/MultiPolygonEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/MultiPolygonEntity.php @@ -35,7 +35,7 @@ * Polygon entity. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @Entity * @Table diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/NoHintGeometryEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/NoHintGeometryEntity.php index 7b49b757..66c4a80a 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/NoHintGeometryEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/NoHintGeometryEntity.php @@ -34,7 +34,7 @@ * Geometry entity without type hint. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @Entity * @Table diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/PointEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/PointEntity.php index a593131d..87fd94c3 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/PointEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/PointEntity.php @@ -35,7 +35,7 @@ * Point entity. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @Entity * @Table diff --git a/tests/CrEOF/Spatial/Tests/Fixtures/PolygonEntity.php b/tests/CrEOF/Spatial/Tests/Fixtures/PolygonEntity.php index 86d2c51e..d631f657 100644 --- a/tests/CrEOF/Spatial/Tests/Fixtures/PolygonEntity.php +++ b/tests/CrEOF/Spatial/Tests/Fixtures/PolygonEntity.php @@ -35,7 +35,7 @@ * Polygon entity. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @Entity * @Table diff --git a/tests/CrEOF/Spatial/Tests/Helper/LineStringHelperTrait.php b/tests/CrEOF/Spatial/Tests/Helper/LineStringHelperTrait.php index eccb4269..6c5aeef8 100644 --- a/tests/CrEOF/Spatial/Tests/Helper/LineStringHelperTrait.php +++ b/tests/CrEOF/Spatial/Tests/Helper/LineStringHelperTrait.php @@ -44,7 +44,7 @@ * @see /doc/test.md * * @author Alexandre Tranchant - * @license http://alexandre-tranchant.mit-license.org MIT + * @license https://alexandre-tranchant.mit-license.org MIT * * @method EntityManagerInterface getEntityManager Return the entity interface */ diff --git a/tests/CrEOF/Spatial/Tests/Helper/PointHelperTrait.php b/tests/CrEOF/Spatial/Tests/Helper/PointHelperTrait.php index 73d54c3d..d53c7610 100644 --- a/tests/CrEOF/Spatial/Tests/Helper/PointHelperTrait.php +++ b/tests/CrEOF/Spatial/Tests/Helper/PointHelperTrait.php @@ -45,7 +45,7 @@ * @see /doc/test.md * * @author Alexandre Tranchant - * @license http://alexandre-tranchant.mit-license.org MIT + * @license https://alexandre-tranchant.mit-license.org MIT * * @method EntityManagerInterface getEntityManager Return the entity interface */ diff --git a/tests/CrEOF/Spatial/Tests/Helper/PolygonHelperTrait.php b/tests/CrEOF/Spatial/Tests/Helper/PolygonHelperTrait.php index 835c79a1..3456dc2e 100644 --- a/tests/CrEOF/Spatial/Tests/Helper/PolygonHelperTrait.php +++ b/tests/CrEOF/Spatial/Tests/Helper/PolygonHelperTrait.php @@ -45,7 +45,7 @@ * @see /doc/test.md * * @author Alexandre Tranchant - * @license http://alexandre-tranchant.mit-license.org MIT + * @license https://alexandre-tranchant.mit-license.org MIT * * @method EntityManagerInterface getEntityManager Return the entity interface */ diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php index f57c6339..9ea247e0 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php index f720b910..8f9d43fa 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php index 442ab9e6..ec80da4a 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php index 7280546b..f7f8a417 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php index 5cb63709..e67f0ba8 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php index 5c2202b5..415dc90f 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php index ba1954e1..c3764b4c 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MITIT + * @license https://dlambert.mit-license.org MITIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php index 9f1b6474..1f86911f 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php @@ -37,7 +37,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php index a7a55c5b..b79bd2de 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php index b0db183d..b365e9b4 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php index cc648467..b89f1fc0 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php index 8923ab6c..86a51fc8 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php index 7e7080ee..833dd971 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php index 738815bc..c6f22a29 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php index 5f8fe888..dcad265b 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php index cc8447e0..99101ff8 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php @@ -35,7 +35,7 @@ * ST_CoveredBy DQL function tests. * * @author Derek J. Lambert - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php index d2fddae3..95f5d8c1 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php index b46b6692..806421d8 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php @@ -39,7 +39,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php index a437ae2d..ce73124c 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php index a5d05696..112c3ac7 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php index 7ed35b3d..d9883707 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php index 40012c12..0e546469 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php index af330029..5f30e9b9 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php index 80f129af..0bf95e4c 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php index 326fa979..e62b0995 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php index 2671275e..d0d9b773 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php @@ -37,7 +37,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php index 4f1eaae7..00978f4b 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php index 58560395..9bdd8c9b 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php @@ -37,7 +37,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php index 2b759ea6..07651421 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php @@ -37,7 +37,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php index 82f7a2cd..01415d45 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php index c97bae56..c8064a8f 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php index 8fea6f95..3e51a1ff 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php index de290dec..8c58ecb2 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php @@ -38,7 +38,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php index 085e6fd2..7428f135 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php @@ -36,7 +36,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php index bee1cab9..4f0632de 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php @@ -45,7 +45,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php index 18ff1716..912da068 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php @@ -38,7 +38,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php index e9593372..c3fda68c 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php @@ -40,7 +40,7 @@ * * @author Derek J. Lambert * @author Alexandre Tranchant - * @license http://dlambert.mit-license.org MIT + * @license https://dlambert.mit-license.org MIT * * @group dql * From 0630456bc8552bf131a04fbfd2277166636bd122 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Wed, 26 Feb 2020 16:25:45 +0100 Subject: [PATCH 42/44] http link replaced by https link. --- lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php b/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php index 6efb474d..9bdc5a5a 100644 --- a/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php +++ b/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php @@ -32,8 +32,8 @@ /** * Abstract point object for POINT spatial types. * - * http://stackoverflow.com/questions/7309121/preferred-order-of-writing-latitude-longitude-tuples - * http://docs.geotools.org/latest/userguide/library/referencing/order.html + * https://stackoverflow.com/questions/7309121/preferred-order-of-writing-latitude-longitude-tuples + * https://docs.geotools.org/latest/userguide/library/referencing/order.html * * @author Derek J. Lambert * @license https://dlambert.mit-license.org MIT From 60fa6a1467ce2b136666f6210aca75e00fef0455 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Wed, 26 Feb 2020 16:26:02 +0100 Subject: [PATCH 43/44] Updated --- CHANGELOG.md | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04f4028c..33fdb0b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,28 @@ # Change Log -All notable changes to this project will be documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles. -This project adheres to [Semantic Versioning](http://semver.org/). +All notable changes to this project will be documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles. +This project adheres to [Semantic Versioning](https://semver.org/). ## [Unreleased] +### Work in progress +- New file to help contributors to pull request a new spatial function and test it +- Limit backward incompatibility +- Not-Camel-Case Classes tagged must be as deprecated and declared as children of new Camel case classes +- All class shall be in camel case format. + +*Process:* +- `MbrContains` class shall be created (a copy/paste of `MBRContains`) +- `MBRContains` class shall inherit MbrContains and core of function shall be removed. +- `MBRContains` class shall be tagged as deprecated + +- All method shall be in camel case format (if possible cf limitations of doctrine interfaces). + ### Added -- Needed PHP extension added in composer.json -- Project fork from creof/doctrine-spatial2 +- Needed PHP extension added in composer.json +- AST Functions updated to avoid misconfiguration (some properties was missing) +- AST Functions updated to avoid code coverage to detect which function was not tested - Adding support of PHP7.2, PHP7.3, PHP7.4 - Removing deprecations of doctrine2 +- Project forked from creof/doctrine-spatial2 ### Removed - Removing support of PHP5.*, PHP7.0, PHP7.1 From ffa6fc3f33877c079598a30e3537a5d52017c9c0 Mon Sep 17 00:00:00 2001 From: Alexandre-T Date: Wed, 26 Feb 2020 21:04:53 +0100 Subject: [PATCH 44/44] PHPUnit method replaced by PHPUnit static method --- .php_cs.dist | 3 +- README.md | 29 +++++++++++- .../AST/Functions/PostgreSql/STSnapToGrid.php | 8 ++-- .../DBAL/Types/Geography/GeoPointSridTest.php | 6 +-- .../Types/Geography/GeoPolygonTypeTest.php | 8 ++-- .../Tests/DBAL/Types/GeographyTypeTest.php | 2 +- .../Types/Geometry/LineStringTypeTest.php | 6 +-- .../Types/Geometry/MultiPolygonTypeTest.php | 6 +-- .../DBAL/Types/Geometry/PointTypeTest.php | 6 +-- .../DBAL/Types/Geometry/PolygonTypeTest.php | 8 ++-- .../Tests/DBAL/Types/GeometryTypeTest.php | 12 ++--- .../Spatial/Tests/DBAL/Types/SchemaTest.php | 4 +- .../Query/AST/Functions/MySql/AreaTest.php | 12 ++--- .../AST/Functions/MySql/AsBinaryTest.php | 4 +- .../Query/AST/Functions/MySql/AsTextTest.php | 4 +- .../AST/Functions/MySql/ContainsTest.php | 34 +++++++------- .../AST/Functions/MySql/DisjointTest.php | 24 +++++----- .../AST/Functions/MySql/EnvelopeTest.php | 8 ++-- .../Query/AST/Functions/MySql/GLengthTest.php | 10 ++-- .../AST/Functions/MySql/GeomFromTextTest.php | 8 ++-- .../AST/Functions/MySql/MBRContainsTest.php | 22 ++++----- .../AST/Functions/MySql/MBRDisjointTest.php | 24 +++++----- .../AST/Functions/MySql/StartPointTest.php | 10 ++-- .../AST/Functions/PostgreSql/GeometryTest.php | 2 +- .../AST/Functions/PostgreSql/STAreaTest.php | 4 +- .../Functions/PostgreSql/STAsBinaryTest.php | 4 +- .../AST/Functions/PostgreSql/STAsTextTest.php | 4 +- .../Functions/PostgreSql/STCentroidTest.php | 10 ++-- .../PostgreSql/STClosestPointTest.php | 10 ++-- .../Functions/PostgreSql/STCollectTest.php | 2 +- .../PostgreSql/STContainsProperlyTest.php | 14 +++--- .../Functions/PostgreSql/STContainsTest.php | 20 ++++---- .../Functions/PostgreSql/STCoveredByTest.php | 18 ++++---- .../AST/Functions/PostgreSql/STCoversTest.php | 14 +++--- .../Functions/PostgreSql/STCrossesTest.php | 22 ++++----- .../Functions/PostgreSql/STDisjointTest.php | 24 +++++----- .../PostgreSql/STDistanceSphereTest.php | 14 +++--- .../Functions/PostgreSql/STDistanceTest.php | 42 ++++++++--------- .../Functions/PostgreSql/STEnvelopeTest.php | 8 ++-- .../PostgreSql/STGeomFromTextTest.php | 8 ++-- .../AST/Functions/PostgreSql/STLengthTest.php | 10 ++-- .../STLineCrossingDirectionTest.php | 18 ++++---- .../PostgreSql/STMakeEnvelopeTest.php | 2 +- .../Functions/PostgreSql/STOverlapsTest.php | 10 ++-- .../Functions/PostgreSql/STSnapToGridTest.php | 8 ++-- .../Functions/PostgreSql/STStartPointTest.php | 10 ++-- .../Functions/PostgreSql/STSummaryTest.php | 28 +++++------ .../Tests/ORM/Query/GeometryWalkerTest.php | 16 +++---- .../Spatial/Tests/ORM/Query/WrappingTest.php | 4 +- tests/CrEOF/Spatial/Tests/OrmTestCase.php | 2 +- .../Tests/PHP/Types/Geography/PointTest.php | 42 ++++++++--------- .../PHP/Types/Geometry/LineStringTest.php | 22 ++++----- .../Types/Geometry/MultiLineStringTest.php | 16 +++---- .../PHP/Types/Geometry/MultiPointTest.php | 22 ++++----- .../PHP/Types/Geometry/MultiPolygonTest.php | 16 +++---- .../Tests/PHP/Types/Geometry/PointTest.php | 46 +++++++++---------- .../Tests/PHP/Types/Geometry/PolygonTest.php | 18 ++++---- 57 files changed, 396 insertions(+), 372 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index fe86157a..c84197af 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -35,7 +35,7 @@ return PhpCsFixer\Config::create() '@DoctrineAnnotation' => true, '@PhpCsFixer' => true, '@Symfony' => true, - '@PHPUnit60Migration:risky' => true, + '@PHPUnit75Migration:risky' => true, '@PHP70Migration' => true, '@PHP71Migration' => true, '@PHP73Migration' => true, @@ -73,6 +73,7 @@ return PhpCsFixer\Config::create() ], 'sortAlgorithm' => 'alpha' ], + 'php_unit_test_case_static_method_calls' => true, 'single_line_throw' => false ]) ->setFinder($finder) diff --git a/README.md b/README.md index 6021092b..af6cd5f6 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,32 @@ Update your composer.json to add this package: } ``` -You will also have to change the version requirement of doctrine to at least 2.3: +You will also have to change the version requirement of doctrine to the stable version 2.7: ```yaml - "doctrine/orm": ">=2.3", + "doctrine/orm": ">=2.7", ``` + +Compatibility +------------- + +**Doctrine dev version** + +Continuous integration tests libraries with 2.8.x-dev version. We try to be compatible with this version. +Continuous integration tests libraries with 2.8.x-dev version. We **DO NOT* try to be compatible with this version, +currently. There is too much difference between interface declarations. + +**MySQL 5.7 and 8.0** + +A lot of functions change their names between this two versions. Currently, tests works with MySQL5.7 and +failed with MySQL8.0, [because function names have +changed](https://stackoverflow.com/questions/60377271/why-some-spatial-functions-does-not-exists-on-my-mysql-server). + +**MariaDB 10** + +This version is not compatible with MariaDB version. Some spatial functions seems to work but their results are +different from MySQL version (Contains function is a good example) + +**PostgreSQL** + + + \ No newline at end of file diff --git a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSnapToGrid.php b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSnapToGrid.php index c9201151..6f7abc6f 100644 --- a/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSnapToGrid.php +++ b/lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STSnapToGrid.php @@ -93,8 +93,6 @@ public function parse(Parser $parser) * Function SQL name getter. * * @since 2.0 This function replace the protected property functionName. - * - * @return string */ protected function getFunctionName(): string { @@ -106,7 +104,7 @@ protected function getFunctionName(): string * * @since 2.0 This function replace the protected property maxGeomExpr. * - * @return int The inherited methods shall NOT return null, but 0 when function has no parameter. + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ protected function getMaxParameter(): int { @@ -118,7 +116,7 @@ protected function getMaxParameter(): int * * @since 2.0 This function replace the protected property minGeomExpr. * - * @return int The inherited methods shall NOT return null, but 0 when function has no parameter. + * @return int the inherited methods shall NOT return null, but 0 when function has no parameter */ protected function getMinParameter(): int { @@ -130,7 +128,7 @@ protected function getMinParameter(): int * * @since 2.0 This function replace the protected property platforms. * - * @return string[] a non-empty array of accepted platforms. + * @return string[] a non-empty array of accepted platforms */ protected function getPlatforms(): array { diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php index fe5eaba9..f09cf9fa 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPointSridTest.php @@ -82,7 +82,7 @@ public function testNullGeography() $queryEntity = $this->getEntityManager()->getRepository(self::GEO_POINT_SRID_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } /** @@ -109,8 +109,8 @@ public function testPointGeography() $queryEntity = $this->getEntityManager()->getRepository(self::GEO_POINT_SRID_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); - $this->assertEquals(4326, $queryEntity->getPoint()->getSrid()); + static::assertEquals($entity, $queryEntity); + static::assertEquals(4326, $queryEntity->getPoint()->getSrid()); } //TODO test to find all null GeoPointSridEntity diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php index 48f386e0..86d45d8c 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geography/GeoPolygonTypeTest.php @@ -95,7 +95,7 @@ public function testFindByPolygon() ->findByPolygon(new Polygon($rings)) ; - $this->assertEquals($entity, $result[0]); + static::assertEquals($entity, $result[0]); } /** @@ -120,7 +120,7 @@ public function testNullPolygon() $queryEntity = $this->getEntityManager()->getRepository(self::GEO_POLYGON_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } /** @@ -163,7 +163,7 @@ public function testPolygonRing() $queryEntity = $this->getEntityManager()->getRepository(self::GEO_POLYGON_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } /** @@ -199,6 +199,6 @@ public function testSolidPolygon() $queryEntity = $this->getEntityManager()->getRepository(self::GEO_POLYGON_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } } diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php index b363ed9c..7b412efd 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeographyTypeTest.php @@ -165,6 +165,6 @@ private function storeAndRetrieve(GeographyEntity $entity) $queryEntity = $this->getEntityManager()->getRepository(self::GEOGRAPHY_ENTITY)->find($id); - self::assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } } diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php index a648b4b7..06eb57b7 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/LineStringTypeTest.php @@ -91,7 +91,7 @@ public function testFindByLineString() ->findByLineString($lineString) ; - $this->assertEquals($entity, $result[0]); + static::assertEquals($entity, $result[0]); } /** @@ -125,7 +125,7 @@ public function testLineString() $queryEntity = $this->getEntityManager()->getRepository(self::LINESTRING_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } /** @@ -150,7 +150,7 @@ public function testNullLineStringType() $queryEntity = $this->getEntityManager()->getRepository(self::LINESTRING_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } //TODO test to find all null linestring diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php index 169c2bfb..0b1c3330 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/MultiPolygonTypeTest.php @@ -115,7 +115,7 @@ public function testFindByMultiPolygon() ->findByMultiPolygon(new MultiPolygon($polygons)) ; - $this->assertEquals($entity, $result[0]); + static::assertEquals($entity, $result[0]); } /** @@ -170,7 +170,7 @@ public function testMultiPolygon() $queryEntity = $this->getEntityManager()->getRepository(self::MULTIPOLYGON_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } /** @@ -195,7 +195,7 @@ public function testNullMultiPolygon() $queryEntity = $this->getEntityManager()->getRepository(self::MULTIPOLYGON_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } //TODO Try to find a null multiploygon diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php index d87f1fdb..9f6cc0bb 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PointTypeTest.php @@ -83,7 +83,7 @@ public function testFindByPoint() $result = $this->getEntityManager()->getRepository(self::POINT_ENTITY)->findByPoint($point); - $this->assertEquals($entity, $result[0]); + static::assertEquals($entity, $result[0]); } /** @@ -108,7 +108,7 @@ public function testNullPoint() $queryEntity = $this->getEntityManager()->getRepository(self::POINT_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } /** @@ -136,7 +136,7 @@ public function testPoint() $queryEntity = $this->getEntityManager()->getRepository(self::POINT_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } //TODO test to find a null geometry diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php index 5b508ba1..4e99f175 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/Geometry/PolygonTypeTest.php @@ -92,7 +92,7 @@ public function testFindByPolygon() $result = $this->getEntityManager()->getRepository(self::POLYGON_ENTITY)->findByPolygon(new Polygon($rings)); - $this->assertEquals($entity, $result[0]); + static::assertEquals($entity, $result[0]); } /** @@ -117,7 +117,7 @@ public function testNullPolygon() $queryEntity = $this->getEntityManager()->getRepository(self::POLYGON_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } /** @@ -160,7 +160,7 @@ public function testPolygonRing() $queryEntity = $this->getEntityManager()->getRepository(self::POLYGON_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } /** @@ -196,6 +196,6 @@ public function testSolidPolygon() $queryEntity = $this->getEntityManager()->getRepository(self::POLYGON_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } } diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php index 063bf3eb..3ff95841 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/GeometryTypeTest.php @@ -111,7 +111,7 @@ public function testLineStringGeometry() $queryEntity = $this->getEntityManager()->getRepository(self::GEOMETRY_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } /** @@ -136,7 +136,7 @@ public function testNullGeometry() $queryEntity = $this->getEntityManager()->getRepository(self::GEOMETRY_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } /** @@ -163,7 +163,7 @@ public function testPointGeometry() $queryEntity = $this->getEntityManager()->getRepository(self::GEOMETRY_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } /** @@ -194,7 +194,7 @@ public function testPointGeometryWithSrid() $queryEntity = $this->getEntityManager()->getRepository(self::GEOMETRY_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } /** @@ -225,7 +225,7 @@ public function testPointGeometryWithZeroSrid() $queryEntity = $this->getEntityManager()->getRepository(self::GEOMETRY_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } /** @@ -262,6 +262,6 @@ public function testPolygonGeometry() $queryEntity = $this->getEntityManager()->getRepository(self::GEOMETRY_ENTITY)->find($id); - $this->assertEquals($entity, $queryEntity); + static::assertEquals($entity, $queryEntity); } } diff --git a/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php b/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php index aed57189..945f9a44 100644 --- a/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php +++ b/tests/CrEOF/Spatial/Tests/DBAL/Types/SchemaTest.php @@ -87,7 +87,7 @@ public function testDoctrineTypeMapping() foreach ($databaseTypes as $databaseType) { $typeMapping = $this->getPlatform()->getDoctrineTypeMapping($databaseType); - $this->assertEquals($doctrineType, $typeMapping); + static::assertEquals($doctrineType, $typeMapping); } } } @@ -104,7 +104,7 @@ public function testSchemaReverseMapping() { $result = $this->getSchemaTool()->getUpdateSchemaSql($this->getAllClassMetadata(), true); - $this->assertCount(0, $result); + static::assertCount(0, $result); } /** diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php index 9ea247e0..d161d9d1 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AreaTest.php @@ -86,8 +86,8 @@ public function testAreaWhere() ); $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($expected, $result[0]); + static::assertCount(1, $result); + static::assertEquals($expected, $result[0]); } /** @@ -114,9 +114,9 @@ public function testSelectArea() ); $result = $query->getResult(); - $this->assertEquals(100, $result[0][1]); - $this->assertEquals(96, $result[1][1]); - $this->assertEquals(100, $result[2][1]); - $this->assertEquals(4, $result[3][1]); + static::assertEquals(100, $result[0][1]); + static::assertEquals(96, $result[1][1]); + static::assertEquals(100, $result[2][1]); + static::assertEquals(4, $result[3][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php index 8f9d43fa..9b4c3312 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsBinaryTest.php @@ -88,7 +88,7 @@ public function testAsBinary() $binaryA = pack('H*', $stringA); $binaryB = pack('H*', $stringB); - $this->assertEquals($binaryA, $result[0][1]); - $this->assertEquals($binaryB, $result[1][1]); + static::assertEquals($binaryA, $result[0][1]); + static::assertEquals($binaryB, $result[1][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php index ec80da4a..7667383d 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/AsTextTest.php @@ -84,7 +84,7 @@ public function testAsText() ); $result = $query->getResult(); - $this->assertEquals('LINESTRING(0 0,2 2,5 5)', $result[0][1]); - $this->assertEquals('LINESTRING(3 3,4 15,5 22)', $result[1][1]); + static::assertEquals('LINESTRING(0 0,2 2,5 5)', $result[0][1]); + static::assertEquals('LINESTRING(3 3,4 15,5 22)', $result[1][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php index f7f8a417..c8b24c2a 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/ContainsTest.php @@ -88,10 +88,10 @@ public function testContainsWhereParameter() $query->setParameter('p', 'POINT(6 6)', 'string'); $result = $query->getResult(); - $this->assertCount(3, $result); - $this->assertEquals($bigPolygon, $result[0]); - $this->assertEquals($smallPolygon, $result[1]); - $this->assertEquals($holeyPolygon, $result[2]); + static::assertCount(3, $result); + static::assertEquals($bigPolygon, $result[0]); + static::assertEquals($smallPolygon, $result[1]); + static::assertEquals($holeyPolygon, $result[2]); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( @@ -100,9 +100,9 @@ public function testContainsWhereParameter() $query->setParameter('p', 'POINT(2 2)', 'string'); $result = $query->getResult(); - $this->assertCount(2, $result); - $this->assertEquals($bigPolygon, $result[0]); - $this->assertEquals($holeyPolygon, $result[1]); + static::assertCount(2, $result); + static::assertEquals($bigPolygon, $result[0]); + static::assertEquals($holeyPolygon, $result[1]); } /** @@ -134,15 +134,15 @@ public function testSelectContains() $result = $query->getResult(); - $this->assertCount(3, $result); - $this->assertEquals($bigPolygon, $result[0][0]); - $this->assertEquals(1, $result[0][1]); - $this->assertEquals(1, $result[0][2]); - $this->assertEquals($smallPolygon, $result[1][0]); - $this->assertEquals(0, $result[1][1]); - $this->assertEquals(1, $result[1][2]); - $this->assertEquals($holeyPolygon, $result[2][0]); - $this->assertEquals(1, $result[2][1]); - $this->assertEquals(1, $result[2][2]); + static::assertCount(3, $result); + static::assertEquals($bigPolygon, $result[0][0]); + static::assertEquals(1, $result[0][1]); + static::assertEquals(1, $result[0][2]); + static::assertEquals($smallPolygon, $result[1][0]); + static::assertEquals(0, $result[1][1]); + static::assertEquals(1, $result[1][2]); + static::assertEquals($holeyPolygon, $result[2][0]); + static::assertEquals(1, $result[2][1]); + static::assertEquals(1, $result[2][2]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php index e67f0ba8..6b3dd8e0 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/DisjointTest.php @@ -88,8 +88,8 @@ public function testDisjointWhereParameter() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($externalPolygon, $result[0]); + static::assertCount(1, $result); + static::assertEquals($externalPolygon, $result[0]); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( @@ -100,9 +100,9 @@ public function testDisjointWhereParameter() $result = $query->getResult(); - $this->assertCount(2, $result); - $this->assertEquals($bigPolygon, $result[0]); - $this->assertEquals($insidePolygon, $result[1]); + static::assertCount(2, $result); + static::assertEquals($bigPolygon, $result[0]); + static::assertEquals($insidePolygon, $result[1]); } /** @@ -131,12 +131,12 @@ public function testSelectDisjoint() $result = $query->getResult(); - $this->assertCount(3, $result); - $this->assertEquals($bigPolygon, $result[0][0]); - $this->assertEquals(0, $result[0][1]); - $this->assertEquals($insidePolygon, $result[1][0]); - $this->assertEquals(0, $result[1][1]); - $this->assertEquals($externalPolygon, $result[2][0]); - $this->assertEquals(1, $result[2][1]); + static::assertCount(3, $result); + static::assertEquals($bigPolygon, $result[0][0]); + static::assertEquals(0, $result[0][1]); + static::assertEquals($insidePolygon, $result[1][0]); + static::assertEquals(0, $result[1][1]); + static::assertEquals($externalPolygon, $result[2][0]); + static::assertEquals(1, $result[2][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php index 415dc90f..4ade236d 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/EnvelopeTest.php @@ -87,8 +87,8 @@ public function testEnvelopeWhereParameter() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($holeyPolygon, $result[0]); + static::assertCount(1, $result); + static::assertEquals($holeyPolygon, $result[0]); } /** @@ -113,7 +113,7 @@ public function testSelectEnvelope() ); $result = $query->getResult(); - $this->assertEquals('POLYGON((0 0,10 0,10 10,0 10,0 0))', $result[0][1]); - $this->assertEquals('POLYGON((0 0,10 0,10 10,0 10,0 0))', $result[1][1]); + static::assertEquals('POLYGON((0 0,10 0,10 10,0 10,0 0))', $result[0][1]); + static::assertEquals('POLYGON((0 0,10 0,10 10,0 10,0 0))', $result[1][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php index c3764b4c..5bb725bd 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GLengthTest.php @@ -88,8 +88,8 @@ public function testLengthWhereParameter() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($smallLineString, $result[0]); + static::assertCount(1, $result); + static::assertEquals($smallLineString, $result[0]); } /** @@ -113,8 +113,8 @@ public function testSelectLength() ); $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($smallLineString, $result[0][0]); - $this->assertEquals(7.0710678118654755, $result[0][1]); + static::assertCount(1, $result); + static::assertEquals($smallLineString, $result[0][0]); + static::assertEquals(7.0710678118654755, $result[0][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php index 1f86911f..20e3898a 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/GeomFromTextTest.php @@ -90,8 +90,8 @@ public function testLineString() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($linestring, $result[0]); + static::assertCount(1, $result); + static::assertEquals($linestring, $result[0]); } /** @@ -118,7 +118,7 @@ public function testPoint() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($point, $result[0]); + static::assertCount(1, $result); + static::assertEquals($point, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php index b79bd2de..29bc4d4d 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRContainsTest.php @@ -90,9 +90,9 @@ public function testMbrContainsWhereParameter() $result = $query->getResult(); - $this->assertCount(2, $result); - $this->assertEquals($bigPolygon, $result[0]); - $this->assertEquals($holeyPolygon, $result[1]); + static::assertCount(2, $result); + static::assertEquals($bigPolygon, $result[0]); + static::assertEquals($holeyPolygon, $result[1]); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( @@ -105,9 +105,9 @@ public function testMbrContainsWhereParameter() $result = $query->getResult(); - $this->assertCount(2, $result); - $this->assertEquals($bigPolygon, $result[0]); - $this->assertEquals($holeyPolygon, $result[1]); + static::assertCount(2, $result); + static::assertEquals($bigPolygon, $result[0]); + static::assertEquals($holeyPolygon, $result[1]); } /** @@ -135,10 +135,10 @@ public function testSelectMbrContains() $result = $query->getResult(); - $this->assertCount(2, $result); - $this->assertEquals($envelopingPolygon, $result[0][0]); - $this->assertEquals(1, $result[0][1]); - $this->assertEquals($internalPolygon, $result[1][0]); - $this->assertEquals(0, $result[1][1]); + static::assertCount(2, $result); + static::assertEquals($envelopingPolygon, $result[0][0]); + static::assertEquals(1, $result[0][1]); + static::assertEquals($internalPolygon, $result[1][0]); + static::assertEquals(0, $result[1][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php index b365e9b4..be8c117e 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/MBRDisjointTest.php @@ -90,8 +90,8 @@ public function testMbrDisjointWhereParameter() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($outerPolygon, $result[0]); + static::assertCount(1, $result); + static::assertEquals($outerPolygon, $result[0]); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( @@ -104,9 +104,9 @@ public function testMbrDisjointWhereParameter() $result = $query->getResult(); - $this->assertCount(2, $result); - $this->assertEquals($bigPolygon, $result[0]); - $this->assertEquals($smallPolygon, $result[1]); + static::assertCount(2, $result); + static::assertEquals($bigPolygon, $result[0]); + static::assertEquals($smallPolygon, $result[1]); } /** @@ -135,12 +135,12 @@ public function testSelectMbrDisjoint() $result = $query->getResult(); - $this->assertCount(3, $result); - $this->assertEquals($bigPolygon, $result[0][0]); - $this->assertEquals(0, $result[0][1]); - $this->assertEquals($smallPolygon, $result[1][0]); - $this->assertEquals(0, $result[1][1]); - $this->assertEquals($outerPolygon, $result[2][0]); - $this->assertEquals(1, $result[2][1]); + static::assertCount(3, $result); + static::assertEquals($bigPolygon, $result[0][0]); + static::assertEquals(0, $result[0][1]); + static::assertEquals($smallPolygon, $result[1][0]); + static::assertEquals(0, $result[1][1]); + static::assertEquals($outerPolygon, $result[2][0]); + static::assertEquals(1, $result[2][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php index b89f1fc0..07c480c2 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/MySql/StartPointTest.php @@ -85,7 +85,7 @@ public function testStartPointSelect() $result = $query->getResult(); - $this->assertEquals('POINT(0 0)', $result[0][1]); + static::assertEquals('POINT(0 0)', $result[0][1]); } /** @@ -115,8 +115,8 @@ public function testStartPointWhereCompareLineString() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($angular, $result[0]); + static::assertCount(1, $result); + static::assertEquals($angular, $result[0]); } /** @@ -146,7 +146,7 @@ public function testStartPointWhereComparePoint() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($straight, $result[0]); + static::assertCount(1, $result); + static::assertEquals($straight, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php index 86a51fc8..86a2ffad 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/GeometryTest.php @@ -89,6 +89,6 @@ public function testSelectGeometry() [1 => 'POINT(-2 3)'], ]; - $this->assertEquals($expected, $result); + static::assertEquals($expected, $result); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php index 833dd971..72f20393 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAreaTest.php @@ -86,7 +86,7 @@ public function testSelectStArea() ); $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($smallPolygon, $result[0]); + static::assertCount(1, $result); + static::assertEquals($smallPolygon, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php index c6f22a29..5b9695d0 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsBinaryTest.php @@ -85,8 +85,8 @@ public function testStAsBinary() $result = $query->getResult(); // phpcs:disable Generic.Files.LineLength.MaxExceeded - $this->assertEquals('010200000003000000000000000000000000000000000000000000000000000040000000000000004000000000000014400000000000001440', bin2hex(stream_get_contents($result[0][1]))); - $this->assertEquals('0102000000030000000000000000000840000000000000084000000000000010400000000000002e4000000000000014400000000000003640', bin2hex(stream_get_contents($result[1][1]))); + static::assertEquals('010200000003000000000000000000000000000000000000000000000000000040000000000000004000000000000014400000000000001440', bin2hex(stream_get_contents($result[0][1]))); + static::assertEquals('0102000000030000000000000000000840000000000000084000000000000010400000000000002e4000000000000014400000000000003640', bin2hex(stream_get_contents($result[1][1]))); // phpcs:enable } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php index dcad265b..90696b39 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STAsTextTest.php @@ -84,7 +84,7 @@ public function testStAsText() ); $result = $query->getResult(); - $this->assertEquals('LINESTRING(0 0,2 2,5 5)', $result[0][1]); - $this->assertEquals('LINESTRING(3 3,4 15,5 22)', $result[1][1]); + static::assertEquals('LINESTRING(0 0,2 2,5 5)', $result[0][1]); + static::assertEquals('LINESTRING(3 3,4 15,5 22)', $result[1][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php index 99101ff8..d9c9b0d8 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCentroidTest.php @@ -83,10 +83,10 @@ public function testSelectStCentroid() ); $result = $query->getResult(); - $this->assertCount(2, $result); - $this->assertEquals($bigPolygon, $result[0][0]); - $this->assertEquals('POINT(5 5)', $result[0][1]); - $this->assertEquals($smallPolygon, $result[1][0]); - $this->assertEquals('POINT(6 6)', $result[1][1]); + static::assertCount(2, $result); + static::assertEquals($bigPolygon, $result[0][0]); + static::assertEquals('POINT(5 5)', $result[0][1]); + static::assertEquals($smallPolygon, $result[1][0]); + static::assertEquals('POINT(6 6)', $result[1][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php index 95f5d8c1..d17511ee 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STClosestPointTest.php @@ -90,10 +90,10 @@ public function testSelectStClosestPoint() $result = $query->getResult(); - $this->assertCount(2, $result); - $this->assertEquals($bigPolygon, $result[0][0]); - $this->assertEquals('POINT(2 2)', $result[0][1]); - $this->assertEquals($smallPolygon, $result[1][0]); - $this->assertEquals('POINT(5 5)', $result[1][1]); + static::assertCount(2, $result); + static::assertEquals($bigPolygon, $result[0][0]); + static::assertEquals('POINT(2 2)', $result[0][1]); + static::assertEquals($smallPolygon, $result[1][0]); + static::assertEquals('POINT(5 5)', $result[1][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php index 806421d8..1f5ed7cf 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCollectTest.php @@ -95,6 +95,6 @@ public function testSelectStCollect() [1 => 'MULTIPOINT(1 2,-2 3)'], ]; - $this->assertEquals($expected, $result); + static::assertEquals($expected, $result); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php index ce73124c..7f4e63ef 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsProperlyTest.php @@ -89,11 +89,11 @@ public function testSelectStContainsProperly() $result = $query->getResult(); - $this->assertCount(2, $result); - $this->assertEquals($bigPolygon, $result[0][0]); - $this->assertTrue($result[0][1]); - $this->assertEquals($smallPolygon, $result[1][0]); - $this->assertFalse($result[1][1]); + static::assertCount(2, $result); + static::assertEquals($bigPolygon, $result[0][0]); + static::assertTrue($result[0][1]); + static::assertEquals($smallPolygon, $result[1][0]); + static::assertFalse($result[1][1]); } /** @@ -119,7 +119,7 @@ public function testStContainsProperlyWhereParameter() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($bigPolygon, $result[0]); + static::assertCount(1, $result); + static::assertEquals($bigPolygon, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php index 112c3ac7..1adb6c6c 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STContainsTest.php @@ -88,11 +88,11 @@ public function testSelectStContains() $result = $query->getResult(); - $this->assertCount(2, $result); - $this->assertEquals($bigPolygon, $result[0][0]); - $this->assertTrue($result[0][1]); - $this->assertEquals($smallPolygon, $result[1][0]); - $this->assertFalse($result[1][1]); + static::assertCount(2, $result); + static::assertEquals($bigPolygon, $result[0][0]); + static::assertTrue($result[0][1]); + static::assertEquals($smallPolygon, $result[1][0]); + static::assertFalse($result[1][1]); } /** @@ -122,8 +122,8 @@ public function testStContainsWhereParameter() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($bigPolygon, $result[0]); + static::assertCount(1, $result); + static::assertEquals($bigPolygon, $result[0]); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( @@ -136,8 +136,8 @@ public function testStContainsWhereParameter() $result = $query->getResult(); - $this->assertCount(2, $result); - $this->assertEquals($bigPolygon, $result[0]); - $this->assertEquals($holeyPolygon, $result[1]); + static::assertCount(2, $result); + static::assertEquals($bigPolygon, $result[0]); + static::assertEquals($holeyPolygon, $result[1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php index d9883707..62939367 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoveredByTest.php @@ -88,13 +88,13 @@ public function testSelectStCoveredBy() $result = $query->getResult(); - $this->assertCount(3, $result); - $this->assertEquals($bigPolygon, $result[0][0]); - $this->assertFalse($result[0][1]); - $this->assertEquals($eccentricPolygon, $result[1][0]); - $this->assertFalse($result[1][1]); - $this->assertEquals($smallPolygon, $result[2][0]); - $this->assertTrue($result[2][1]); + static::assertCount(3, $result); + static::assertEquals($bigPolygon, $result[0][0]); + static::assertFalse($result[0][1]); + static::assertEquals($eccentricPolygon, $result[1][0]); + static::assertFalse($result[1][1]); + static::assertEquals($smallPolygon, $result[2][0]); + static::assertTrue($result[2][1]); } /** @@ -125,7 +125,7 @@ public function testStCoveredByWhereParameter() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($smallPolygon, $result[0]); + static::assertCount(1, $result); + static::assertEquals($smallPolygon, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php index 0e546469..8f41f36c 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCoversTest.php @@ -87,11 +87,11 @@ public function testSelectStCovers() $result = $query->getResult(); - $this->assertCount(2, $result); - $this->assertEquals($eccentricPolygon, $result[0][0]); - $this->assertFalse($result[0][1]); - $this->assertEquals($smallPolygon, $result[1][0]); - $this->assertTrue($result[1][1]); + static::assertCount(2, $result); + static::assertEquals($eccentricPolygon, $result[0][0]); + static::assertFalse($result[0][1]); + static::assertEquals($smallPolygon, $result[1][0]); + static::assertTrue($result[1][1]); } /** @@ -121,7 +121,7 @@ public function testStCoversWhereParameter() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($smallPolygon, $result[0]); + static::assertCount(1, $result); + static::assertEquals($smallPolygon, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php index 5f30e9b9..8c84a8b9 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STCrossesTest.php @@ -90,13 +90,13 @@ public function testSelectStCrosses() $result = $query->getResult(); - $this->assertCount(3, $result); - $this->assertEquals($lineStringA, $result[0][0]); - $this->assertFalse($result[0][1]); - $this->assertEquals($lineStringB, $result[1][0]); - $this->assertTrue($result[1][1]); - $this->assertEquals($lineStringC, $result[2][0]); - $this->assertFalse($result[2][1]); + static::assertCount(3, $result); + static::assertEquals($lineStringA, $result[0][0]); + static::assertFalse($result[0][1]); + static::assertEquals($lineStringB, $result[1][0]); + static::assertTrue($result[1][1]); + static::assertEquals($lineStringC, $result[2][0]); + static::assertFalse($result[2][1]); } /** @@ -127,8 +127,8 @@ public function testStCrossesWhereParameter() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($lineStringB, $result[0]); + static::assertCount(1, $result); + static::assertEquals($lineStringB, $result[0]); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( @@ -141,7 +141,7 @@ public function testStCrossesWhereParameter() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($lineStringB, $result[0]); + static::assertCount(1, $result); + static::assertEquals($lineStringB, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php index 0bf95e4c..983abb4e 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDisjointTest.php @@ -88,13 +88,13 @@ public function testSelectStDisjoint() $result = $query->getResult(); - $this->assertCount(3, $result); - $this->assertEquals($bigPolygon, $result[0][0]); - $this->assertFalse($result[0][1]); - $this->assertEquals($smallPolygon, $result[1][0]); - $this->assertFalse($result[1][1]); - $this->assertEquals($outerPolygon, $result[2][0]); - $this->assertTrue($result[2][1]); + static::assertCount(3, $result); + static::assertEquals($bigPolygon, $result[0][0]); + static::assertFalse($result[0][1]); + static::assertEquals($smallPolygon, $result[1][0]); + static::assertFalse($result[1][1]); + static::assertEquals($outerPolygon, $result[2][0]); + static::assertTrue($result[2][1]); } /** @@ -126,8 +126,8 @@ public function testStDisjointWhereParameter() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($outerPolygon, $result[0]); + static::assertCount(1, $result); + static::assertEquals($outerPolygon, $result[0]); $this->getEntityManager()->clear(); $query = $this->getEntityManager()->createQuery( @@ -140,8 +140,8 @@ public function testStDisjointWhereParameter() $result = $query->getResult(); - $this->assertCount(2, $result); - $this->assertEquals($bigPolygon, $result[0]); - $this->assertEquals($smallPolygon, $result[1]); + static::assertCount(2, $result); + static::assertEquals($bigPolygon, $result[0]); + static::assertEquals($smallPolygon, $result[1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php index e62b0995..6b701a11 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceSphereTest.php @@ -88,12 +88,12 @@ public function testSelectStDistanceSphereGeometry() $result = $query->getResult(); - $this->assertCount(3, $result); - $this->assertEquals($newYork, $result[0][0]); - $this->assertEquals(1305895.94823465, $result[0][1]); - $this->assertEquals($losAngeles, $result[1][0]); - $this->assertEquals(2684082.08249337, $result[1][1]); - $this->assertEquals($dallas, $result[2][0]); - $this->assertEquals(1313754.60684762, $result[2][1]); + static::assertCount(3, $result); + static::assertEquals($newYork, $result[0][0]); + static::assertEquals(1305895.94823465, $result[0][1]); + static::assertEquals($losAngeles, $result[1][0]); + static::assertEquals(2684082.08249337, $result[1][1]); + static::assertEquals($dallas, $result[2][0]); + static::assertEquals(1313754.60684762, $result[2][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php index d0d9b773..59a07a4e 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STDistanceTest.php @@ -94,13 +94,13 @@ public function testSelectStDistanceGeographyCartesian() $result = $query->getResult(); - $this->assertCount(3, $result); - $this->assertEquals($newYork, $result[0][0]); - $this->assertEquals(1305895.94823465, $result[0][1]); - $this->assertEquals($losAngeles, $result[1][0]); - $this->assertEquals(2684082.08249337, $result[1][1]); - $this->assertEquals($dallas, $result[2][0]); - $this->assertEquals(1313754.60684762, $result[2][1]); + static::assertCount(3, $result); + static::assertEquals($newYork, $result[0][0]); + static::assertEquals(1305895.94823465, $result[0][1]); + static::assertEquals($losAngeles, $result[1][0]); + static::assertEquals(2684082.08249337, $result[1][1]); + static::assertEquals($dallas, $result[2][0]); + static::assertEquals(1313754.60684762, $result[2][1]); } /** @@ -131,13 +131,13 @@ public function testSelectStDistanceGeographySpheroid() $result = $query->getResult(); - $this->assertCount(3, $result); - $this->assertEquals($newYork, $result[0][0]); - $this->assertEquals(1309106.31458423, $result[0][1]); - $this->assertEquals($losAngeles, $result[1][0]); - $this->assertEquals(2689041.41288843, $result[1][1]); - $this->assertEquals($dallas, $result[2][0]); - $this->assertEquals(1312731.61417061, $result[2][1]); + static::assertCount(3, $result); + static::assertEquals($newYork, $result[0][0]); + static::assertEquals(1309106.31458423, $result[0][1]); + static::assertEquals($losAngeles, $result[1][0]); + static::assertEquals(2689041.41288843, $result[1][1]); + static::assertEquals($dallas, $result[2][0]); + static::assertEquals(1312731.61417061, $result[2][1]); } /** @@ -166,12 +166,12 @@ public function testSelectStDistanceGeometryCartesian() $result = $query->getResult(); - $this->assertCount(3, $result); - $this->assertEquals($newYork, $result[0][0]); - $this->assertEquals(15.646934398128, $result[0][1]); - $this->assertEquals($losAngeles, $result[1][0]); - $this->assertEquals(30.2188561049899, $result[1][1]); - $this->assertEquals($dallas, $result[2][0]); - $this->assertEquals(12.6718564262953, $result[2][1]); + static::assertCount(3, $result); + static::assertEquals($newYork, $result[0][0]); + static::assertEquals(15.646934398128, $result[0][1]); + static::assertEquals($losAngeles, $result[1][0]); + static::assertEquals(30.2188561049899, $result[1][1]); + static::assertEquals($dallas, $result[2][0]); + static::assertEquals(12.6718564262953, $result[2][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php index 00978f4b..248ea8e9 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STEnvelopeTest.php @@ -84,8 +84,8 @@ public function testSelectStEnvelope() ); $result = $query->getResult(); - $this->assertEquals('POLYGON((0 0,0 10,10 10,10 0,0 0))', $result[0][1]); - $this->assertEquals('POLYGON((0 0,0 10,10 10,10 0,0 0))', $result[1][1]); + static::assertEquals('POLYGON((0 0,0 10,10 10,10 0,0 0))', $result[0][1]); + static::assertEquals('POLYGON((0 0,0 10,10 10,10 0,0 0))', $result[1][1]); } /** @@ -115,7 +115,7 @@ public function testStEnvelopeWhereParameter() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($holeyPolygon, $result[0]); + static::assertCount(1, $result); + static::assertEquals($holeyPolygon, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php index 9bdd8c9b..c560d84a 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STGeomFromTextTest.php @@ -91,8 +91,8 @@ public function testLineString() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($lineString, $result[0]); + static::assertCount(1, $result); + static::assertEquals($lineString, $result[0]); } /** @@ -119,7 +119,7 @@ public function testPoint() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($pointA, $result[0]); + static::assertCount(1, $result); + static::assertEquals($pointA, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php index 07651421..ec04242d 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLengthTest.php @@ -85,9 +85,9 @@ public function testSelectStLength() ); $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($angularLineString, $result[0][0]); - $this->assertEquals(19.1126623906578, $result[0][1]); + static::assertCount(1, $result); + static::assertEquals($angularLineString, $result[0][0]); + static::assertEquals(19.1126623906578, $result[0][1]); } /** @@ -116,7 +116,7 @@ public function testStLengthWhereParameter() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($angularLineString, $result[0]); + static::assertCount(1, $result); + static::assertEquals($angularLineString, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php index 01415d45..336f0956 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STLineCrossingDirectionTest.php @@ -90,13 +90,13 @@ public function testSelectStLineCrossingDirection() $result = $query->getResult(); - $this->assertCount(3, $result); - $this->assertEquals($lineStringX, $result[0][0]); - $this->assertEquals(2, $result[0][1]); - $this->assertEquals($lineStringY, $result[1][0]); - $this->assertEquals(1, $result[1][1]); - $this->assertEquals($lineStringZ, $result[2][0]); - $this->assertEquals(-1, $result[2][1]); + static::assertCount(3, $result); + static::assertEquals($lineStringX, $result[0][0]); + static::assertEquals(2, $result[0][1]); + static::assertEquals($lineStringY, $result[1][0]); + static::assertEquals(1, $result[1][1]); + static::assertEquals($lineStringZ, $result[2][0]); + static::assertEquals(-1, $result[2][1]); } /** @@ -127,7 +127,7 @@ public function testStLineCrossingDirectionWhereParameter() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($lineStringY, $result[0]); + static::assertCount(1, $result); + static::assertEquals($lineStringY, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php index c8064a8f..0dc270c8 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelopeTest.php @@ -87,6 +87,6 @@ public function testSelectStMakeEnvelope() [1 => 'POLYGON((5 5,5 10,10 10,10 5,5 5))'], ]; - $this->assertEquals($expected, $result); + static::assertEquals($expected, $result); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php index 3e51a1ff..e0a48d21 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STOverlapsTest.php @@ -87,10 +87,10 @@ public function testSelectStMakeEnvelope() $query->setParameter('p1', 'POINT(4 4)', 'string'); $result = $query->getResult(); - $this->assertCount(2, $result); - $this->assertEquals($bigPolygon, $result[0]['point']); - $this->assertFalse($result[0]['overlap']); - $this->assertEquals($smallPolygon, $result[1]['point']); - $this->assertTrue($result[1]['overlap']); + static::assertCount(2, $result); + static::assertEquals($bigPolygon, $result[0]['point']); + static::assertFalse($result[0]['overlap']); + static::assertEquals($smallPolygon, $result[1]['point']); + static::assertTrue($result[1]['overlap']); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php index 8c58ecb2..e242d34a 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSnapToGridTest.php @@ -92,7 +92,7 @@ public function testSelectStSnapToGridSignature2Parameters() [1 => 'POINT(1 2.5)'], ]; - $this->assertEquals($expected, $result); + static::assertEquals($expected, $result); } /** @@ -123,7 +123,7 @@ public function testSelectStSnapToGridSignature3Parameters() [1 => 'POINT(1 3)'], ]; - $this->assertEquals($expected, $result); + static::assertEquals($expected, $result); } /** @@ -156,7 +156,7 @@ public function testSelectStSnapToGridSignature5Parameters() [1 => 'POINT(5.05 6.75)'], ]; - $this->assertEquals($expected, $result); + static::assertEquals($expected, $result); } /** @@ -189,6 +189,6 @@ public function testSelectStSnapToGridSignature6Parameters() [1 => 'POINT(5.25 6.55)'], ]; - $this->assertEquals($expected, $result); + static::assertEquals($expected, $result); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php index 7428f135..0060b011 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STStartPointTest.php @@ -84,7 +84,7 @@ public function testStStartPointSelect() $result = $query->getResult(); - $this->assertEquals('POINT(0 0)', $result[0][1]); + static::assertEquals('POINT(0 0)', $result[0][1]); } /** @@ -114,8 +114,8 @@ public function testStStartPointWhereCompareLineString() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($angularLineString, $result[0]); + static::assertCount(1, $result); + static::assertEquals($angularLineString, $result[0]); } /** @@ -146,7 +146,7 @@ public function testStStartPointWhereComparePoint() $result = $query->getResult(); - $this->assertCount(1, $result); - $this->assertEquals($straightLineString, $result[0]); + static::assertCount(1, $result); + static::assertEquals($straightLineString, $result[0]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php index 4f0632de..0343bbe2 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/AST/Functions/PostgreSql/STSummaryTest.php @@ -113,13 +113,13 @@ public function testSelectStSummaryGeography() ); $result = $query->getResult(); - $this->assertCount(3, $result); - $this->assertEquals($point, $result[0][0]); - $this->assertRegExp('/^Point\[.*G.*\]/', $result[0][1]); - $this->assertEquals($linestring, $result[1][0]); - $this->assertRegExp('/^LineString\[.*G.*\]/', $result[1][1]); - $this->assertEquals($polygon, $result[2][0]); - $this->assertRegExp('/^Polygon\[.*G.*\]/', $result[2][1]); + static::assertCount(3, $result); + static::assertEquals($point, $result[0][0]); + static::assertRegExp('/^Point\[.*G.*\]/', $result[0][1]); + static::assertEquals($linestring, $result[1][0]); + static::assertRegExp('/^LineString\[.*G.*\]/', $result[1][1]); + static::assertEquals($polygon, $result[2][0]); + static::assertRegExp('/^Polygon\[.*G.*\]/', $result[2][1]); } /** @@ -165,12 +165,12 @@ public function testSelectStSummaryGeometry() ); $result = $query->getResult(); - $this->assertCount(3, $result); - $this->assertEquals($point, $result[0][0]); - $this->assertRegExp('/^Point\[[^G]*\]/', $result[0][1]); - $this->assertEquals($linestring, $result[1][0]); - $this->assertRegExp('/^LineString\[[^G]*\]/', $result[1][1]); - $this->assertEquals($polygon, $result[2][0]); - $this->assertRegExp('/^Polygon\[[^G]*\]/', $result[2][1]); + static::assertCount(3, $result); + static::assertEquals($point, $result[0][0]); + static::assertRegExp('/^Point\[[^G]*\]/', $result[0][1]); + static::assertEquals($linestring, $result[1][0]); + static::assertRegExp('/^LineString\[[^G]*\]/', $result[1][1]); + static::assertEquals($polygon, $result[2][0]); + static::assertRegExp('/^Polygon\[[^G]*\]/', $result[2][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php index 912da068..c45325e8 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/GeometryWalkerTest.php @@ -104,8 +104,8 @@ public function testGeometryWalkerBinary() ); $result = $query->getResult(); - $this->assertEquals(new Point(0, 0), $result[0][1]); - $this->assertEquals(new Point(3, 3), $result[1][1]); + static::assertEquals(new Point(0, 0), $result[0][1]); + static::assertEquals(new Point(3, 3), $result[1][1]); $queryString = sprintf( 'SELECT %s(%s(l.lineString)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l', @@ -116,8 +116,8 @@ public function testGeometryWalkerBinary() $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'CrEOF\Spatial\ORM\Query\GeometryWalker'); $result = $query->getResult(); - $this->assertInstanceOf('CrEOF\Spatial\PHP\Types\Geometry\Polygon', $result[0][1]); - $this->assertInstanceOf('CrEOF\Spatial\PHP\Types\Geometry\Polygon', $result[1][1]); + static::assertInstanceOf('CrEOF\Spatial\PHP\Types\Geometry\Polygon', $result[0][1]); + static::assertInstanceOf('CrEOF\Spatial\PHP\Types\Geometry\Polygon', $result[1][1]); } /** @@ -159,8 +159,8 @@ public function testGeometryWalkerText() $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'CrEOF\Spatial\ORM\Query\GeometryWalker'); $result = $query->getResult(); - $this->assertEquals(new Point(0, 0), $result[0][1]); - $this->assertEquals(new Point(3, 3), $result[1][1]); + static::assertEquals(new Point(0, 0), $result[0][1]); + static::assertEquals(new Point(3, 3), $result[1][1]); $queryString = sprintf( 'SELECT %s(%s(l.lineString)) FROM CrEOF\Spatial\Tests\Fixtures\LineStringEntity l', @@ -171,7 +171,7 @@ public function testGeometryWalkerText() $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'CrEOF\Spatial\ORM\Query\GeometryWalker'); $result = $query->getResult(); - $this->assertInstanceOf('CrEOF\Spatial\PHP\Types\Geometry\Polygon', $result[0][1]); - $this->assertInstanceOf('CrEOF\Spatial\PHP\Types\Geometry\Polygon', $result[1][1]); + static::assertInstanceOf('CrEOF\Spatial\PHP\Types\Geometry\Polygon', $result[0][1]); + static::assertInstanceOf('CrEOF\Spatial\PHP\Types\Geometry\Polygon', $result[1][1]); } } diff --git a/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php b/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php index c3fda68c..9d7582fe 100644 --- a/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php +++ b/tests/CrEOF/Spatial/Tests/ORM/Query/WrappingTest.php @@ -115,7 +115,7 @@ public function testTypeWrappingSelect() $regex = preg_quote(sprintf('/.polygon, %s)/', $parameter)); - $this->assertRegExp($regex, $result); + static::assertRegExp($regex, $result); } // phpcs:enable @@ -153,6 +153,6 @@ public function testTypeWrappingWhere() $regex = preg_quote(sprintf('/geometry = %s/', $parameter)); - $this->assertRegExp($regex, $result); + static::assertRegExp($regex, $result); } } diff --git a/tests/CrEOF/Spatial/Tests/OrmTestCase.php b/tests/CrEOF/Spatial/Tests/OrmTestCase.php index e8e95562..6a16f523 100644 --- a/tests/CrEOF/Spatial/Tests/OrmTestCase.php +++ b/tests/CrEOF/Spatial/Tests/OrmTestCase.php @@ -187,7 +187,7 @@ public static function setUpBeforeClass(): void protected function setUp(): void { if (count($this->supportedPlatforms) && !isset($this->supportedPlatforms[$this->getPlatform()->getName()])) { - $this->markTestSkipped(sprintf( + static::markTestSkipped(sprintf( 'No support for platform %s in test class %s.', $this->getPlatform()->getName(), get_class($this) diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geography/PointTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geography/PointTest.php index 6d51691f..70a28292 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geography/PointTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geography/PointTest.php @@ -192,7 +192,7 @@ public function testGetType() $point = new Point(10, 10); $result = $point->getType(); - $this->assertEquals('Point', $result); + static::assertEquals('Point', $result); } /** @@ -204,8 +204,8 @@ public function testGoodNumericPoint() { $point = new Point(-73.7562317, 42.6525793); - $this->assertEquals(42.6525793, $point->getLatitude()); - $this->assertEquals(-73.7562317, $point->getLongitude()); + static::assertEquals(42.6525793, $point->getLatitude()); + static::assertEquals(-73.7562317, $point->getLongitude()); } /** @@ -215,38 +215,38 @@ public function testGoodStringPoints() { $point = new Point('79:56:55W', '40:26:46N'); - $this->assertEquals(40.446111111111, $point->getLatitude()); - $this->assertEquals(-79.948611111111, $point->getLongitude()); + static::assertEquals(40.446111111111, $point->getLatitude()); + static::assertEquals(-79.948611111111, $point->getLongitude()); $point = new Point('79°56\'55"W', '40°26\'46"N'); - $this->assertEquals(40.446111111111, $point->getLatitude()); - $this->assertEquals(-79.948611111111, $point->getLongitude()); + static::assertEquals(40.446111111111, $point->getLatitude()); + static::assertEquals(-79.948611111111, $point->getLongitude()); $point = new Point('79° 56\' 55" W', '40° 26\' 46" N'); - $this->assertEquals(40.446111111111, $point->getLatitude()); - $this->assertEquals(-79.948611111111, $point->getLongitude()); + static::assertEquals(40.446111111111, $point->getLatitude()); + static::assertEquals(-79.948611111111, $point->getLongitude()); $point = new Point('79°56′55″W', '40°26′46″N'); - $this->assertEquals(40.446111111111, $point->getLatitude()); - $this->assertEquals(-79.948611111111, $point->getLongitude()); + static::assertEquals(40.446111111111, $point->getLatitude()); + static::assertEquals(-79.948611111111, $point->getLongitude()); $point = new Point('79° 56′ 55″ W', '40° 26′ 46″ N'); - $this->assertEquals(40.446111111111, $point->getLatitude()); - $this->assertEquals(-79.948611111111, $point->getLongitude()); + static::assertEquals(40.446111111111, $point->getLatitude()); + static::assertEquals(-79.948611111111, $point->getLongitude()); $point = new Point('79:56:55.832W', '40:26:46.543N'); - $this->assertEquals(40.446261944444, $point->getLatitude()); - $this->assertEquals(-79.948842222222, $point->getLongitude()); + static::assertEquals(40.446261944444, $point->getLatitude()); + static::assertEquals(-79.948842222222, $point->getLongitude()); $point = new Point('112:4:0W', '33:27:0N'); - $this->assertEquals(33.45, $point->getLatitude()); - $this->assertEquals(-112.06666666667, $point->getLongitude()); + static::assertEquals(33.45, $point->getLatitude()); + static::assertEquals(-112.06666666667, $point->getLongitude()); } /** @@ -259,7 +259,7 @@ public function testPointFromArrayToString() $expected = '5 5'; $point = new Point([5, 5]); - $this->assertEquals($expected, (string) $point); + static::assertEquals($expected, (string) $point); } /** @@ -287,13 +287,13 @@ public function testPointWithSrid() $point = new Point(10, 10, 4326); $result = $point->getSrid(); - $this->assertEquals(4326, $result); + static::assertEquals(4326, $result); //Lambert $point = new Point(10, 10, 2154); $result = $point->getSrid(); - $this->assertEquals(2154, $result); + static::assertEquals(2154, $result); } /** @@ -322,6 +322,6 @@ public function testToArray() $point = new Point(10, 10); $result = $point->toArray(); - $this->assertEquals($expected, $result); + static::assertEquals($expected, $result); } } diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/LineStringTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/LineStringTest.php index 81943720..5a8595f7 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/LineStringTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/LineStringTest.php @@ -57,7 +57,7 @@ public function testEmptyLineString() { $lineString = new LineString([]); - $this->assertEmpty($lineString->getPoints()); + static::assertEmpty($lineString->getPoints()); } /** @@ -75,7 +75,7 @@ public function testJson() [0, 0], ] ); - $this->assertEquals($expected, $lineString->toJson()); + static::assertEquals($expected, $lineString->toJson()); } /** @@ -94,7 +94,7 @@ public function testLineStringFromArraysGetLastPoint() ); $actual = $lineString->getPoint(-1); - $this->assertEquals($expected, $actual); + static::assertEquals($expected, $actual); } /** @@ -118,8 +118,8 @@ public function testLineStringFromArraysGetPoints() ); $actual = $lineString->getPoints(); - $this->assertCount(4, $actual); - $this->assertEquals($expected, $actual); + static::assertCount(4, $actual); + static::assertEquals($expected, $actual); } /** @@ -138,7 +138,7 @@ public function testLineStringFromArraysGetSinglePoint() ); $actual = $lineString->getPoint(1); - $this->assertEquals($expected, $actual); + static::assertEquals($expected, $actual); } /** @@ -155,7 +155,7 @@ public function testLineStringFromArraysIsClosed() ] ); - $this->assertTrue($lineString->isClosed()); + static::assertTrue($lineString->isClosed()); } /** @@ -172,7 +172,7 @@ public function testLineStringFromArraysIsOpen() ] ); - $this->assertFalse($lineString->isClosed()); + static::assertFalse($lineString->isClosed()); } /** @@ -190,7 +190,7 @@ public function testLineStringFromArraysToString() ] ); - $this->assertEquals($expected, (string) $lineString); + static::assertEquals($expected, (string) $lineString); } /** @@ -211,7 +211,7 @@ public function testLineStringFromObjectsToArray() new Point(3, 3), ]); - $this->assertCount(4, $lineString->getPoints()); - $this->assertEquals($expected, $lineString->toArray()); + static::assertCount(4, $lineString->getPoints()); + static::assertEquals($expected, $lineString->toArray()); } } diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiLineStringTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiLineStringTest.php index 1dfca667..d6b34547 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiLineStringTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiLineStringTest.php @@ -46,7 +46,7 @@ public function testEmptyMultiLineString() { $multiLineString = new MultiLineString([]); - $this->assertEmpty($multiLineString->getLineStrings()); + static::assertEmpty($multiLineString->getLineStrings()); } /** @@ -75,7 +75,7 @@ public function testJson() ]; $multiLineString = new MultiLineString($lineStrings); - $this->assertEquals($expected, $multiLineString->toJson()); + static::assertEquals($expected, $multiLineString->toJson()); } /** @@ -103,7 +103,7 @@ public function testMultiLineStringFromArraysToString() $multiLineString = new MultiLineString($lineStrings); $result = (string) $multiLineString; - $this->assertEquals($expected, $result); + static::assertEquals($expected, $result); } /** @@ -131,7 +131,7 @@ public function testMultiLineStringFromObjectsGetLastLineString() ); $polygon = new MultiLineString([$firstLineString, $lastLineString]); - $this->assertEquals($lastLineString, $polygon->getLineString(-1)); + static::assertEquals($lastLineString, $polygon->getLineString(-1)); } /** @@ -159,7 +159,7 @@ public function testMultiLineStringFromObjectsGetSingleLineString() ); $multiLineString = new MultiLineString([$firstLineString, $lastLineString]); - $this->assertEquals($firstLineString, $multiLineString->getLineString(0)); + static::assertEquals($firstLineString, $multiLineString->getLineString(0)); } /** @@ -206,7 +206,7 @@ public function testMultiLineStringFromObjectsToArray() $multiLineString = new MultiLineString($lineStrings); - $this->assertEquals($expected, $multiLineString->toArray()); + static::assertEquals($expected, $multiLineString->toArray()); } /** @@ -256,7 +256,7 @@ public function testSolidMultiLineStringAddRings() ] ); - $this->assertEquals($expected, $multiLineString->getLineStrings()); + static::assertEquals($expected, $multiLineString->getLineStrings()); } /** @@ -303,6 +303,6 @@ public function testSolidMultiLineStringFromArraysGetRings() $multiLineString = new MultiLineString($rings); - $this->assertEquals($expected, $multiLineString->getLineStrings()); + static::assertEquals($expected, $multiLineString->getLineStrings()); } } diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPointTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPointTest.php index 0fe72c3c..36223e50 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPointTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPointTest.php @@ -57,7 +57,7 @@ public function testEmptyMultiPoint() { $multiPoint = new MultiPoint([]); - $this->assertEmpty($multiPoint->getPoints()); + static::assertEmpty($multiPoint->getPoints()); } /** @@ -75,7 +75,7 @@ public function testJson() ] ); - $this->assertEquals($expected, $multiPoint->toJson()); + static::assertEquals($expected, $multiPoint->toJson()); } /** @@ -105,8 +105,8 @@ public function testMultiPointAddPoints() $actual = $multiPoint->getPoints(); - $this->assertCount(4, $actual); - $this->assertEquals($expected, $actual); + static::assertCount(4, $actual); + static::assertEquals($expected, $actual); } /** @@ -125,7 +125,7 @@ public function testMultiPointFromArraysGetLastPoint() ); $actual = $multiPoint->getPoint(-1); - $this->assertEquals($expected, $actual); + static::assertEquals($expected, $actual); } /** @@ -149,8 +149,8 @@ public function testMultiPointFromArraysGetPoints() ); $actual = $multiPoint->getPoints(); - $this->assertCount(4, $actual); - $this->assertEquals($expected, $actual); + static::assertCount(4, $actual); + static::assertEquals($expected, $actual); } /** @@ -169,7 +169,7 @@ public function testMultiPointFromArraysGetSinglePoint() ); $actual = $multiPoint->getPoint(1); - $this->assertEquals($expected, $actual); + static::assertEquals($expected, $actual); } /** @@ -187,7 +187,7 @@ public function testMultiPointFromArraysToString() ] ); - $this->assertEquals($expected, (string) $multiPoint); + static::assertEquals($expected, (string) $multiPoint); } /** @@ -208,7 +208,7 @@ public function testMultiPointFromObjectsToArray() new Point(3, 3), ]); - $this->assertCount(4, $multiPoint->getPoints()); - $this->assertEquals($expected, $multiPoint->toArray()); + static::assertCount(4, $multiPoint->getPoints()); + static::assertEquals($expected, $multiPoint->toArray()); } } diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php index e2c60842..a6e1a07e 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/MultiPolygonTest.php @@ -47,7 +47,7 @@ public function testEmptyMultiPolygon() { $multiPolygon = new MultiPolygon([]); - $this->assertEmpty($multiPolygon->getPolygons()); + static::assertEmpty($multiPolygon->getPolygons()); } /** @@ -80,7 +80,7 @@ public function testJson() ]; $multiPolygon = new MultiPolygon($polygons); - $this->assertEquals($expected, $multiPolygon->toJson()); + static::assertEquals($expected, $multiPolygon->toJson()); } /** @@ -116,7 +116,7 @@ public function testMultiPolygonFromObjectsGetLastPolygon() ); $multiPolygon = new MultiPolygon([$firstPolygon, $lastPolygon]); - $this->assertEquals($lastPolygon, $multiPolygon->getPolygon(-1)); + static::assertEquals($lastPolygon, $multiPolygon->getPolygon(-1)); } /** @@ -152,7 +152,7 @@ public function testMultiPolygonFromObjectsGetSinglePolygon() ); $multiPolygon = new MultiPolygon([$firstPolygon, $lastPolygon]); - $this->assertEquals($firstPolygon, $multiPolygon->getPolygon(0)); + static::assertEquals($firstPolygon, $multiPolygon->getPolygon(0)); } /** @@ -217,7 +217,7 @@ public function testSolidMultiPolygonAddPolygon() ] ); - $this->assertEquals($expected, $multiPolygon->getPolygons()); + static::assertEquals($expected, $multiPolygon->getPolygons()); } /** @@ -277,7 +277,7 @@ public function testSolidMultiPolygonFromArraysGetPolygons() $multiPolygon = new MultiPolygon($polygons); - $this->assertEquals($expected, $multiPolygon->getPolygons()); + static::assertEquals($expected, $multiPolygon->getPolygons()); } /** @@ -309,7 +309,7 @@ public function testSolidMultiPolygonFromArraysToString() $multiPolygon = new MultiPolygon($polygons); $result = (string) $multiPolygon; - $this->assertEquals($expected, $result); + static::assertEquals($expected, $result); } /** @@ -369,6 +369,6 @@ public function testSolidMultiPolygonFromObjectsToArray() $multiPolygon = new MultiPolygon($polygons); - $this->assertEquals($expected, $multiPolygon->toArray()); + static::assertEquals($expected, $multiPolygon->toArray()); } } diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PointTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PointTest.php index 9d746758..1e99d227 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PointTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PointTest.php @@ -138,7 +138,7 @@ public function testGetType() $point = new Point(10, 10); $result = $point->getType(); - $this->assertEquals('Point', $result); + static::assertEquals('Point', $result); } /** @@ -148,16 +148,16 @@ public function testGoodNumericPoint() { $point = new Point(-73.7562317, 42.6525793); - $this->assertEquals(42.6525793, $point->getLatitude()); - $this->assertEquals(-73.7562317, $point->getLongitude()); + static::assertEquals(42.6525793, $point->getLatitude()); + static::assertEquals(-73.7562317, $point->getLongitude()); $point ->setLatitude(40.446111111111) ->setLongitude(-79.948611111111) ; - $this->assertEquals(40.446111111111, $point->getLatitude()); - $this->assertEquals(-79.948611111111, $point->getLongitude()); + static::assertEquals(40.446111111111, $point->getLatitude()); + static::assertEquals(-79.948611111111, $point->getLongitude()); } /** @@ -167,38 +167,38 @@ public function testGoodStringPoints() { $point = new Point('79:56:55W', '40:26:46N'); - $this->assertEquals(40.446111111111, $point->getLatitude()); - $this->assertEquals(-79.948611111111, $point->getLongitude()); + static::assertEquals(40.446111111111, $point->getLatitude()); + static::assertEquals(-79.948611111111, $point->getLongitude()); $point = new Point('79°56\'55"W', '40°26\'46"N'); - $this->assertEquals(40.446111111111, $point->getLatitude()); - $this->assertEquals(-79.948611111111, $point->getLongitude()); + static::assertEquals(40.446111111111, $point->getLatitude()); + static::assertEquals(-79.948611111111, $point->getLongitude()); $point = new Point('79° 56\' 55" W', '40° 26\' 46" N'); - $this->assertEquals(40.446111111111, $point->getLatitude()); - $this->assertEquals(-79.948611111111, $point->getLongitude()); + static::assertEquals(40.446111111111, $point->getLatitude()); + static::assertEquals(-79.948611111111, $point->getLongitude()); $point = new Point('79°56′55″W', '40°26′46″N'); - $this->assertEquals(40.446111111111, $point->getLatitude()); - $this->assertEquals(-79.948611111111, $point->getLongitude()); + static::assertEquals(40.446111111111, $point->getLatitude()); + static::assertEquals(-79.948611111111, $point->getLongitude()); $point = new Point('79° 56′ 55″ W', '40° 26′ 46″ N'); - $this->assertEquals(40.446111111111, $point->getLatitude()); - $this->assertEquals(-79.948611111111, $point->getLongitude()); + static::assertEquals(40.446111111111, $point->getLatitude()); + static::assertEquals(-79.948611111111, $point->getLongitude()); $point = new Point('79:56:55.832W', '40:26:46.543N'); - $this->assertEquals(40.446261944444, $point->getLatitude()); - $this->assertEquals(-79.948842222222, $point->getLongitude()); + static::assertEquals(40.446261944444, $point->getLatitude()); + static::assertEquals(-79.948842222222, $point->getLongitude()); $point = new Point('112:4:0W', '33:27:0N'); - $this->assertEquals(33.45, $point->getLatitude()); - $this->assertEquals(-112.06666666667, $point->getLongitude()); + static::assertEquals(33.45, $point->getLatitude()); + static::assertEquals(-112.06666666667, $point->getLongitude()); } /** @@ -209,7 +209,7 @@ public function testJson() $expected = '{"type":"Point","coordinates":[5,5]}'; $point = new Point([5, 5]); - $this->assertEquals($expected, $point->toJson()); + static::assertEquals($expected, $point->toJson()); } /** @@ -233,7 +233,7 @@ public function testPointFromArrayToString() $expected = '5 5'; $point = new Point([5, 5]); - $this->assertEquals($expected, (string) $point); + static::assertEquals($expected, (string) $point); } /** @@ -257,7 +257,7 @@ public function testPointWithSrid() $point = new Point(10, 10, 2154); $result = $point->getSrid(); - $this->assertEquals(2154, $result); + static::assertEquals(2154, $result); } /** @@ -282,7 +282,7 @@ public function testToArray() $point = new Point(10, 10); $result = $point->toArray(); - $this->assertEquals($expected, $result); + static::assertEquals($expected, $result); } /** diff --git a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PolygonTest.php b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PolygonTest.php index 49e079e6..4652b669 100644 --- a/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PolygonTest.php +++ b/tests/CrEOF/Spatial/Tests/PHP/Types/Geometry/PolygonTest.php @@ -47,7 +47,7 @@ public function testEmptyPolygon() { $polygon = new Polygon([]); - $this->assertEmpty($polygon->getRings()); + static::assertEmpty($polygon->getRings()); } /** @@ -76,7 +76,7 @@ public function testJson() ]; $polygon = new Polygon($rings); - $this->assertEquals($expected, $polygon->toJson()); + static::assertEquals($expected, $polygon->toJson()); } /** @@ -124,7 +124,7 @@ public function testRingPolygonFromObjectsGetLastRing() ); $polygon = new Polygon([$ringA, $ringB]); - $this->assertEquals($ringB, $polygon->getRing(-1)); + static::assertEquals($ringB, $polygon->getRing(-1)); } /** @@ -152,7 +152,7 @@ public function testRingPolygonFromObjectsGetSingleRing() ); $polygon = new Polygon([$ringA, $ringB]); - $this->assertEquals($ringA, $polygon->getRing(0)); + static::assertEquals($ringA, $polygon->getRing(0)); } /** @@ -205,7 +205,7 @@ public function testSolidPolygonFromArrayAddRings() ] ); - $this->assertEquals($expected, $polygon->getRings()); + static::assertEquals($expected, $polygon->getRings()); } /** @@ -234,7 +234,7 @@ public function testSolidPolygonFromArrayOfPoints() $polygon = new Polygon($rings); - $this->assertEquals($expected, $polygon->toArray()); + static::assertEquals($expected, $polygon->toArray()); } /** @@ -265,7 +265,7 @@ public function testSolidPolygonFromArraysGetRings() $polygon = new Polygon($rings); - $this->assertEquals($expected, $polygon->getRings()); + static::assertEquals($expected, $polygon->getRings()); } /** @@ -293,7 +293,7 @@ public function testSolidPolygonFromArraysToString() $polygon = new Polygon($rings); $result = (string) $polygon; - $this->assertEquals($expected, $result); + static::assertEquals($expected, $result); } /** @@ -324,6 +324,6 @@ public function testSolidPolygonFromObjectsToArray() $polygon = new Polygon($rings); - $this->assertEquals($expected, $polygon->toArray()); + static::assertEquals($expected, $polygon->toArray()); } }