Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull request to test value before using function ctype #208

Closed
wants to merge 45 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
c213033
Test type of value before using ctype function
Alexandre-T Feb 21, 2020
c6e9471
Test type of value before using ctype function
Alexandre-T Feb 21, 2020
4dfa9b3
Fork and code quality and code test updated
Alexandre-T Feb 21, 2020
e096609
Void added to setUp method, Php-cs-fixer fix
Alexandre-T Feb 21, 2020
6788738
Replacing CoversNothing by CoversDefaultClass
Alexandre-T Feb 21, 2020
23bdc72
Fixing code sniffer errors and warnings
Alexandre-T Feb 21, 2020
ff1c3dc
Fixing code sniffer errors and warnings
Alexandre-T Feb 21, 2020
9a14a9c
Fixing code sniffer errors and warnings
Alexandre-T Feb 21, 2020
40e874b
Readme updated
Alexandre-T Feb 22, 2020
0ffee7d
Code climat test coverage
Alexandre-T Feb 22, 2020
6d59ebb
Installing postgresql server and postgis extension
Alexandre-T Feb 22, 2020
a585cef
Phpunit configuration updated
Alexandre-T Feb 22, 2020
6739159
Comments improved
Alexandre-T Feb 22, 2020
888a0f1
Converts methods With PHP to camel case (Php)
Alexandre-T Feb 22, 2020
96a383c
Fixing syntax
Alexandre-T Feb 22, 2020
163894e
Only stable upcoming releases are tested
Alexandre-T Feb 22, 2020
bab8986
Only stable upcoming releases are tested
Alexandre-T Feb 22, 2020
669fe34
Fixing phpunit.xml.dist
Alexandre-T Feb 22, 2020
8befc21
Try postgis2.5
Alexandre-T Feb 22, 2020
0f7a374
Try postgis2.5
Alexandre-T Feb 22, 2020
c947070
Trying mysql
Alexandre-T Feb 22, 2020
feb4af3
Fixing composer to test doctrine 3.0 version
Alexandre-T Feb 22, 2020
d9dfd0d
Converting methods to camel case
Alexandre-T Feb 22, 2020
cec951d
Comments improved
Alexandre-T Feb 22, 2020
6c8a609
Test simplified
Alexandre-T Feb 23, 2020
4292b86
Methods move into parent class
Alexandre-T Feb 23, 2020
24e08f2
Methods move into parent class
Alexandre-T Feb 23, 2020
fbe8b04
Documentation for tests improved
Alexandre-T Feb 24, 2020
fb9336b
Documentation for tests improved
Alexandre-T Feb 24, 2020
8c20cde
Test code simplified
Alexandre-T Feb 24, 2020
c35c6da
Helper created to simplify tests
Alexandre-T Feb 24, 2020
c53e009
3 Helpers created to simplify tests
Alexandre-T Feb 25, 2020
8d556c9
phpcsfixer
Alexandre-T Feb 25, 2020
0b6698f
Upgrade of tests finished
Alexandre-T Feb 25, 2020
63cfe5a
Upgrade of tests finished
Alexandre-T Feb 25, 2020
96bc21c
Updating travis to test doctrine 3 only with php 7.4
Alexandre-T Feb 25, 2020
6d5b561
Adding return types
Alexandre-T Feb 25, 2020
e1d1f16
Quality should respect quality code rules to be merged
Alexandre-T Feb 25, 2020
e48f049
Clodeclimate updated to avoid similar code process
Alexandre-T Feb 26, 2020
c5c7c20
Abstract Geometry and all its children updated with methods insteadof…
Alexandre-T Feb 26, 2020
71b4bb8
Composer quality wont break a pull request
Alexandre-T Feb 26, 2020
b0ed403
license with http link replaced by https link.
Alexandre-T Feb 26, 2020
0630456
http link replaced by https link.
Alexandre-T Feb 26, 2020
60fa6a1
Updated
Alexandre-T Feb 26, 2020
ffa6fc3
PHPUnit method replaced by PHPUnit static method
Alexandre-T Feb 26, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,13 @@ ratings:
paths:
- "**.php"
exclude_paths: []
plugins:
duplication:
enabled: true
config:
languages:
php:
mass_threshold: 42
checks:
Similar code:
enabled: false
14 changes: 9 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
*.phar
.phpcs-cache
.php_cs.cache
.php-version
.phpunit.result.cache
composer.*.lock
composer.lock
phpunit.xml
phpunit.*.xml
vendor/
composer.lock*
doctrine2-spatial.iml
.idea*
.idea/*
/nbproject
80 changes: 80 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('var')
->exclude('vendor')
;

$header = <<<EOF
Copyright (C) 2020 Alexandre Tranchant
Copyright (C) 2015 Derek J. Lambert

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
EOF;

return PhpCsFixer\Config::create()
// ->setCacheFile(__DIR__.'/.php_cs.cache')
->setRules([
'@DoctrineAnnotation' => true,
'@PhpCsFixer' => true,
'@Symfony' => true,
'@PHPUnit75Migration: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'
],
'php_unit_test_case_static_method_calls' => true,
'single_line_throw' => false
])
->setFinder($finder)
;
43 changes: 29 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,37 @@ language: php

sudo: false

services:
- mysql

addons:
postgresql: '9.6'
apt:
packages:
- postgresql-9.6-postgis-2.5

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm
- 7.2
- 7.3
- 7.4

env:
- ORM=2.3
- ORM=2.4
- ORM=2.5
# Only stable and upcoming releases are tested https://www.doctrine-project.org/projects/orm.html
- ORM=2.7
- ORM=2.8
- ORM=3.0

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
- 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
Expand All @@ -29,13 +41,16 @@ 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
# Code should respect rules
- composer check-quality-code

notifications:
webhooks: https://coveralls.io/webhook?repo_token=$COVERALLS_WEBHOOK

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
# Upcoming releases can fail
- env: ORM=2.8
- env: ORM=3.0
29 changes: 27 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
# 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
- 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

## [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
Expand Down
42 changes: 36 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,37 @@
(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.
## 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 check-quality-code
```

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
69 changes: 53 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,63 @@
# 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.

[![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)
## 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.

## 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).

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.
Feel free to [contribute](./CONTRIBUTING.md)!

Documentation can be found at [here](./doc/index.md)
## 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)

## 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

"doctrine/orm": ">=2.3",
You will also have to change the version requirement of doctrine to the stable version 2.7:
```yaml
"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**



Loading