diff --git a/.circleci/config.yml b/.circleci/config.yml index e166ff46e..abc10eb97 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -74,7 +74,8 @@ aliases: name: Run unit tests command: | php artisan route:cache - phpdbg -dmemory_limit=4G -qrr vendor/bin/phpunit -c phpunit.xml --log-junit ./results/junit/unit/results.xml --coverage-clover ./results/coverage.xml + TESTSUITE=$(echo -e "Api-and-Feature\nUnit" | circleci tests split) + phpdbg -dmemory_limit=4G -qrr vendor/bin/phpunit -c phpunit.xml --log-junit ./results/junit/unit/results${CIRCLE_NODE_INDEX}.xml --coverage-clover ./results/coverage${CIRCLE_NODE_INDEX}.xml --testsuite $TESTSUITE - &psalm run: name: Run psalm @@ -86,7 +87,7 @@ aliases: - &browser-tests run: name: Run browser tests - command: php artisan dusk --log-junit results/junit/dusk/results.xml + command: php artisan dusk --log-junit results/junit/dusk/results3.xml - &browser-cypress run: name: Run browser tests (cypress) @@ -97,13 +98,13 @@ aliases: run: name: Fix coverage command: | - vendor/bin/phpcov merge --clover=results/coverage2.xml results/coverage/ + vendor/bin/phpcov merge --clover=results/coverage3.xml results/coverage/ rm -rf results/coverage - &fix-coverage2 run: name: Fix coverage command: | - vendor/bin/phpcov merge --clover=results/coverage3.xml results/coverage/ + vendor/bin/phpcov merge --clover=results/coverage4.xml results/coverage/ rm -rf results/coverage - &selenium run: @@ -208,6 +209,7 @@ jobs: environment: MYSQL_ALLOW_EMPTY_PASSWORD: yes MYSQL_ROOT_PASSWORD: '' + parallelism: 2 steps: - checkout: @@ -344,7 +346,7 @@ jobs: name: Run sonar scanner command: | export SONAR_RESULT=./results/results.xml - export SONAR_COVERAGE=./results/coverage.xml,./results/coverage2.xml,./results/coverage3.xml + export SONAR_COVERAGE=$(ls -m ./results/coverage*.xml | sed 's/ //g' | sed ':a;N;$!ba;s/\n//g') scripts/tests/runsonar.sh - save_cache: diff --git a/.circleci/config.yml.sig b/.circleci/config.yml.sig index a71f19930..01fc04d6a 100644 Binary files a/.circleci/config.yml.sig and b/.circleci/config.yml.sig differ diff --git a/phpunit.xml b/phpunit.xml index 3541da50a..1568bea1c 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -9,20 +9,14 @@ processIsolation="false" stopOnFailure="false"> - - ./tests/Unit - - - + ./tests/Api - - - ./tests/Commands + ./tests/Feature - - ./tests/Feature + + ./tests/Unit diff --git a/tests/Api/Auth/AuthControllerTest.php b/tests/Browser/Auth/AuthControllerTest.php similarity index 98% rename from tests/Api/Auth/AuthControllerTest.php rename to tests/Browser/Auth/AuthControllerTest.php index 9943c3abf..f92bd668c 100644 --- a/tests/Api/Auth/AuthControllerTest.php +++ b/tests/Browser/Auth/AuthControllerTest.php @@ -1,6 +1,6 @@ assertSee('Login'); } + + public function test_it_updates_the_default_profile_view() + { + $user = $this->signin(); + + $response = $this->json('POST', '/settings/updateDefaultProfileView', [ + 'name' => 'life-events', + ]); + + $response->assertStatus(200); + + $this->assertDatabaseHas('users', [ + 'profile_active_tab' => 'life-events', + 'id' => $user->id, + ]); + + $response = $this->json('POST', '/settings/updateDefaultProfileView', [ + 'name' => 'notes', + ]); + + $response->assertStatus(200); + + $this->assertDatabaseHas('users', [ + 'profile_active_tab' => 'notes', + 'id' => $user->id, + ]); + + $response = $this->json('POST', '/settings/updateDefaultProfileView', [ + 'name' => 'nawak', + ]); + + $response->assertStatus(200); + } } diff --git a/tests/Unit/Controllers/SettingsControllerTest.php b/tests/Unit/Controllers/SettingsControllerTest.php deleted file mode 100644 index 2ac07bf3a..000000000 --- a/tests/Unit/Controllers/SettingsControllerTest.php +++ /dev/null @@ -1,44 +0,0 @@ -signin(); - - $response = $this->json('POST', '/settings/updateDefaultProfileView', [ - 'name' => 'life-events', - ]); - - $response->assertStatus(200); - - $this->assertDatabaseHas('users', [ - 'profile_active_tab' => 'life-events', - 'id' => $user->id, - ]); - - $response = $this->json('POST', '/settings/updateDefaultProfileView', [ - 'name' => 'notes', - ]); - - $response->assertStatus(200); - - $this->assertDatabaseHas('users', [ - 'profile_active_tab' => 'notes', - 'id' => $user->id, - ]); - - $response = $this->json('POST', '/settings/updateDefaultProfileView', [ - 'name' => 'nawak', - ]); - - $response->assertStatus(200); - } -}