diff --git a/.coveralls.yml b/.coveralls.yml
new file mode 100644
index 0000000..739aeeb
--- /dev/null
+++ b/.coveralls.yml
@@ -0,0 +1,2 @@
+coverage_clover: clover.xml
+json_path: coveralls-upload.json
\ No newline at end of file
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..e817297
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,8 @@
+/.coveralls.yml export-ignore
+/.gitattributes export-ignore
+/.github/ export-ignore
+/.gitignore export-ignore
+/.travis.yml export-ignore
+/phpcs.xml export-ignore
+/phpunit.xml.dist export-ignore
+/test/ export-ignore
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index b4f3562..53234a5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
# Composer files
composer.phar
composer.lock
+phpunit.xml
vendor/
.idea/
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..3d2b529
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,60 @@
+language: php
+
+cache:
+ directories:
+ - $HOME/.composer/cache
+
+env:
+ global:
+ - COMPOSER_PROCESS_TIMEOUT=600
+ - COMPOSER_ARGS="--no-interaction"
+ - COVERAGE_DEPS="php-coveralls/php-coveralls"
+ - LOWEST_DEPS_REMOVE=""
+ - LATEST_DEPS_REQUIRE=""
+
+matrix:
+ fast_finish: true
+ include:
+ - php: 7.3
+ env:
+ - DEPS=lowest
+ - php: 7.3
+ env:
+ - DEPS=latest
+ - CS_CHECK=true
+ - TEST_COVERAGE=true
+ - php: 7.4
+ env:
+ - DEPS=lowest
+ - php: 7.4
+ env:
+ - DEPS=latest
+ - php: nightly
+ env:
+ - DEPS=lowest
+ - COMPOSER_ARGS="--no-interaction --ignore-platform-reqs"
+ - php: nightly
+ env:
+ - DEPS=latest
+ - COMPOSER_ARGS="--no-interaction --ignore-platform-reqs"
+
+before_install:
+ - if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
+ - if [[ $DEPS == 'lowest' ]]; then travis_retry composer remove $COMPOSER_ARGS --no-update --dev $LOWEST_DEPS_REMOVE ; fi
+ - if [[ $DEPS == 'latest' ]]; then travis_retry composer require $COMPOSER_ARGS --no-update --dev $LATEST_DEPS_REQUIRE ; fi
+
+install:
+ - if [[ $DEPS == 'lowest' ]]; then travis_retry composer update $COMPOSER_ARGS --prefer-lowest ; fi
+ - if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi
+ - if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS $COVERAGE_DEPS ; fi
+ - stty cols 120 && composer show
+
+script:
+ - if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi
+ - if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi
+
+after_script:
+ - if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry php vendor/bin/php-coveralls -v ; fi
+
+notifications:
+ email: false
diff --git a/composer.json b/composer.json
index 7f41e84..b77ee0f 100644
--- a/composer.json
+++ b/composer.json
@@ -31,9 +31,30 @@
"lm-commons/lmc-user": "~3.3",
"doctrine/doctrine-orm-module": "~3.0"
},
+ "require-dev": {
+ "laminas/laminas-coding-standard": "~1.0.0",
+ "phpspec/prophecy-phpunit": "^2.0",
+ "phpspec/prophecy": "^1.12",
+ "phpunit/phpunit": "^9.3"
+ },
"autoload": {
"psr-4": {
"LmcUserDoctrineORM\\": "src/"
}
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "LmcUserDoctrineORMTest\\": "test/"
+ }
+ },
+ "scripts": {
+ "check": [
+ "@cs-check",
+ "@test"
+ ],
+ "cs-check": "phpcs",
+ "cs-fix": "phpcbf",
+ "test": "phpunit --colors=always",
+ "test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
}
}
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 0000000..0f671e6
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+ src
+ test
+
\ No newline at end of file
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 0000000..806da86
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,25 @@
+
+
+
+
+ ./test/
+
+
+
+
+ disable
+
+
+
+
+ ./src
+
+
+
+
+
+
+
+
diff --git a/src/Mapper/User.php b/src/Mapper/User.php
index 3b76587..dbf404f 100644
--- a/src/Mapper/User.php
+++ b/src/Mapper/User.php
@@ -75,7 +75,7 @@ public function findById($id)
* @param null $tableName
* @param HydratorInterface|null $hydrator
*
- * @return ResultInterface
+ * @return ResultInterface|UserInterface
*/
public function insert(UserInterface $entity, $tableName = null, HydratorInterface $hydrator = null)
{
@@ -88,7 +88,7 @@ public function insert(UserInterface $entity, $tableName = null, HydratorInterfa
* @param null $tableName
* @param HydratorInterface|null $hydrator
*
- * @return ResultInterface
+ * @return ResultInterface|UserInterface
*/
public function update(UserInterface $entity, $where = null, $tableName = null, HydratorInterface $hydrator = null)
{
@@ -96,11 +96,11 @@ public function update(UserInterface $entity, $where = null, $tableName = null,
}
/**
- * @param $entity
+ * @param UserInterface $entity
*
- * @return mixed
+ * @return UserInterface
*/
- protected function persist(UserInterface $entity)
+ protected function persist(UserInterface $entity): UserInterface
{
$this->em->persist($entity);
$this->em->flush();
diff --git a/test/Options/ModuleOptionsTest.php b/test/Options/ModuleOptionsTest.php
new file mode 100644
index 0000000..5dce722
--- /dev/null
+++ b/test/Options/ModuleOptionsTest.php
@@ -0,0 +1,26 @@
+getEnableDefaultEntities());
+ }
+}