From 34cd46185bb6a9ec6f7eee25fc4be6886f0ad2e7 Mon Sep 17 00:00:00 2001 From: Michelangelo van Dam Date: Mon, 31 Dec 2018 10:41:07 +0100 Subject: [PATCH 1/6] Improving quality by adding mutation tests Activating mutation testing with Infection --- .circleci/config.yml | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5bd3fc0..e3047e2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -38,7 +38,13 @@ jobs: # fallback to using the latest cache if no exact match is found - v1-dependencies- - - run: composer install -n --prefer-dist + - run: + name: Installing Composer + command: composer install -n --prefer-dist + + - run: + name: Create artifacts directory + command: mkdir -p ~/build/logs/coverage/coverage-xml - save_cache: paths: @@ -46,8 +52,25 @@ jobs: key: v1-dependencies-{{ checksum "composer.json" }} # run tests! - - run: cp phpcs.xml.dist phpcs.xml - - run: ./vendor/bin/phpunit --configuration=phpunit.xml.dist - - run: ./vendor/bin/phpcs + - run: + name: Create a CodeSniffer configuration file + command: cp phpcs.xml.dist phpcs.xml + + - run: + name: Perform unit tests + command: ./vendor/bin/phpunit --configuration=phpunit.xml.dist + + - store_test_results: + path: ~/build/logs + + - store_artefacts: + path: ~/build/logs + + - run: + name: Check coding standards + command: ./vendor/bin/phpcs + # For some reason infection is not executed correctly - # - run: ./vendor/bin/infection --configuration=infection.json + - run: + name: Execute mutation testing + command: ./vendor/bin/infection --configuration=infection.json.dist From a07f834910a5096e9ae806dcd3217d7db2dc4019 Mon Sep 17 00:00:00 2001 From: Michelangelo van Dam Date: Mon, 31 Dec 2018 10:43:43 +0100 Subject: [PATCH 2/6] Fixing typo in CircleCI command Those pesky terminologies :doh: --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e3047e2..58ee887 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -63,7 +63,7 @@ jobs: - store_test_results: path: ~/build/logs - - store_artefacts: + - store_artifacts: path: ~/build/logs - run: From 4882aadf881fdc8f6cc4cc19a6c6b1bf294ba147 Mon Sep 17 00:00:00 2001 From: Michelangelo van Dam Date: Mon, 31 Dec 2018 11:16:51 +0100 Subject: [PATCH 3/6] Setting explicit coverage path Apparently the coverage path is not read correctly from the configuration --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 58ee887..135e30e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -73,4 +73,4 @@ jobs: # For some reason infection is not executed correctly - run: name: Execute mutation testing - command: ./vendor/bin/infection --configuration=infection.json.dist + command: ./vendor/bin/infection -c infection.json.dist --coverage=~/build/logs/coverage/coverage-xml From a4ba8eae65749f7e233dff8e86b1b3f3f5158265 Mon Sep 17 00:00:00 2001 From: Michelangelo van Dam Date: Mon, 31 Dec 2018 11:19:04 +0100 Subject: [PATCH 4/6] Setting explicit configuration path I needed to spell out configuration for Infection to work --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 135e30e..a361652 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -73,4 +73,4 @@ jobs: # For some reason infection is not executed correctly - run: name: Execute mutation testing - command: ./vendor/bin/infection -c infection.json.dist --coverage=~/build/logs/coverage/coverage-xml + command: ./vendor/bin/infection --configuration=infection.json.dist --coverage=~/build/logs/coverage/coverage-xml From d009f74f110b72eae436de726c00ff42ab860e31 Mon Sep 17 00:00:00 2001 From: Michelangelo van Dam Date: Mon, 31 Dec 2018 11:27:40 +0100 Subject: [PATCH 5/6] Adjusting to environment settings Using the `~/project` folder as starting point --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a361652..3f37fe8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,7 +44,7 @@ jobs: - run: name: Create artifacts directory - command: mkdir -p ~/build/logs/coverage/coverage-xml + command: mkdir -p build/logs/coverage/coverage-xml - save_cache: paths: @@ -61,10 +61,10 @@ jobs: command: ./vendor/bin/phpunit --configuration=phpunit.xml.dist - store_test_results: - path: ~/build/logs + path: build/logs - store_artifacts: - path: ~/build/logs + path: build/logs - run: name: Check coding standards @@ -73,4 +73,4 @@ jobs: # For some reason infection is not executed correctly - run: name: Execute mutation testing - command: ./vendor/bin/infection --configuration=infection.json.dist --coverage=~/build/logs/coverage/coverage-xml + command: ./vendor/bin/infection --configuration=infection.json.dist --coverage=build/logs/coverage/coverage-xml From aebc08e72cb5dadd39c0d4ba4fd34e106432cedb Mon Sep 17 00:00:00 2001 From: Michelangelo van Dam Date: Mon, 31 Dec 2018 11:53:55 +0100 Subject: [PATCH 6/6] Updating paths for Infection Apparently some paths were not set correctly --- .circleci/config.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3f37fe8..6696b22 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -71,6 +71,10 @@ jobs: command: ./vendor/bin/phpcs # For some reason infection is not executed correctly + - run: + name: Copying the junit files to coverage for Infection to run + command: cp build/logs/logfile.xml build/logs/coverage/phpunit.junit.xml + - run: name: Execute mutation testing - command: ./vendor/bin/infection --configuration=infection.json.dist --coverage=build/logs/coverage/coverage-xml + command: ./vendor/bin/infection --configuration=infection.json.dist --coverage=build/logs/coverage