Skip to content

Firefly III: a personal finances manager

Expand test script and fix first functional test.

James Cole06be3f0d4691
diff --git a/.ci/phpunit.sh b/.ci/phpunit.sh
index 4dd50e63aa..ed35296c64 100755
--- a/.ci/phpunit.sh
+++ b/.ci/phpunit.sh
@@ -19,13 +19,43 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
-
+SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# enable test .env file.
-cp .ci/.env.ci ../.env
+cp $SCRIPT_DIR/../.env $SCRIPT_DIR/../.env.backup
+cp $SCRIPT_DIR/.env.ci $SCRIPT_DIR/../.env
+
+COVERAGE=false
+RESET=false
+FILE=storage/database/database.sqlite
+
+while getopts "cr" o; do
+ case "${o}" in
+ c) COVERAGE=true;;
+ r) RESET=true;;
+ esac
+done
+
+# reset if necessary.
+if [ $RESET = "true" ] ; then
+ rm -f $FILE
+fi
# download test database
-# TODO no longer exists
-#wget https://raw.githubusercontent.com/firefly-iii/test-data/main/test_database.sqlite -o storage/database/database.sqlite
+if [ -f "$FILE" ]; then
+ echo 'DB exists, will use it'
+else
+ echo 'Download new DB'
+ wget --quiet https://github.com/firefly-iii/test-fixtures/raw/main/test-database.sqlite -O $FILE
+fi
# run phpunit
-./vendor/bin/phpunit --configuration phpunit.xml
+if [ $COVERAGE = "true" ] ; then
+ echo 'Run with coverage'
+ XDEBUG_MODE=coverage ./vendor/bin/phpunit --configuration phpunit.xml --coverage-html $SCRIPT_DIR/coverage
+else
+ echo 'Run without coverage'
+ ./vendor/bin/phpunit --configuration phpunit.xml
+fi
+
+# restore .env file
+mv $SCRIPT_DIR/../.env.backup $SCRIPT_DIR/../.env
diff --git a/.gitignore b/.gitignore
index 8333193216..220b48d300 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@ npm-debug.log
yarn-error.log
.env
/.ci/php-cs-fixer/vendor
+/.ci/coverage
diff --git a/composer.json b/composer.json
index 0844b2384f..14ef8bed66 100644
--- a/composer.json
+++ b/composer.json
@@ -118,7 +118,7 @@
"phpstan/phpstan": "^1.9",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-strict-rules": "^1.4",
- "phpunit/phpunit": "^9.5",
+ "phpunit/phpunit": "^9",
"thecodingmachine/phpstan-strict-rules": "^1.0"
},
"suggest": {
diff --git a/composer.lock b/composer.lock
index f6a17bc791..e615dae580 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "581e0863eb409791dd91d28405ab8452",
+ "content-hash": "052f139e8202508ed3608b6447bec7dd",
"packages": [
{
"name": "bacon/bacon-qr-code",
@@ -8572,26 +8572,26 @@
"packages-dev": [
{
"name": "barryvdh/laravel-ide-helper",
- "version": "v2.12.3",
+ "version": "v2.13.0",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-ide-helper.git",
- "reference": "3ba1e2573b38f72107b8aacc4ee177fcab30a550"
+ "reference": "81d5b223ff067a1f38e14c100997e153b837fe4a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/3ba1e2573b38f72107b8aacc4ee177fcab30a550",
- "reference": "3ba1e2573b38f72107b8aacc4ee177fcab30a550",
+ "url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/81d5b223ff067a1f38e14c100997e153b837fe4a",
+ "reference": "81d5b223ff067a1f38e14c100997e153b837fe4a",
"shasum": ""
},
"require": {
"barryvdh/reflection-docblock": "^2.0.6",
- "composer/pcre": "^1 || ^2 || ^3",
+ "composer/class-map-generator": "^1.0",
"doctrine/dbal": "^2.6 || ^3",
"ext-json": "*",
- "illuminate/console": "^8 || ^9",
- "illuminate/filesystem": "^8 || ^9",
- "illuminate/support": "^8 || ^9",
+ "illuminate/console": "^8 || ^9 || ^10",
+ "illuminate/filesystem": "^8 || ^9 || ^10",
+ "illuminate/support": "^8 || ^9 || ^10",
"nikic/php-parser": "^4.7",
"php": "^7.3 || ^8.0",
"phpdocumentor/type-resolver": "^1.1.0"
@@ -8599,16 +8599,16 @@
"require-dev": {
"ext-pdo_sqlite": "*",
"friendsofphp/php-cs-fixer": "^2",
- "illuminate/config": "^8 || ^9",
- "illuminate/view": "^8 || ^9",
+ "illuminate/config": "^8 || ^9 || ^10",
+ "illuminate/view": "^8 || ^9 || ^10",
"mockery/mockery": "^1.4",
- "orchestra/testbench": "^6 || ^7",
+ "orchestra/testbench": "^6 || ^7 || ^8",
"phpunit/phpunit": "^8.5 || ^9",
"spatie/phpunit-snapshot-assertions": "^3 || ^4",
"vimeo/psalm": "^3.12"
},
"suggest": {
- "illuminate/events": "Required for automatic helper generation (^6|^7|^8|^9)."
+ "illuminate/events": "Required for automatic helper generation (^6|^7|^8|^9|^10)."
},
"type": "library",
"extra": {
@@ -8650,7 +8650,7 @@
],
"support": {
"issues": "https://github.com/barryvdh/laravel-ide-helper/issues",
- "source": "https://github.com/barryvdh/laravel-ide-helper/tree/v2.12.3"
+ "source": "https://github.com/barryvdh/laravel-ide-helper/tree/v2.13.0"
},
"funding": [
{
@@ -8662,7 +8662,7 @@
"type": "github"
}
],
- "time": "2022-03-06T14:33:42+00:00"
+ "time": "2023-02-04T13:56:40+00:00"
},
{
"name": "barryvdh/reflection-docblock",
@@ -8716,6 +8716,79 @@
},
"time": "2022-10-31T15:35:43+00:00"
},
+ {
+ "name": "composer/class-map-generator",
+ "version": "1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/composer/class-map-generator.git",
+ "reference": "1e1cb2b791facb2dfe32932a7718cf2571187513"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/composer/class-map-generator/zipball/1e1cb2b791facb2dfe32932a7718cf2571187513",
+ "reference": "1e1cb2b791facb2dfe32932a7718cf2571187513",
+ "shasum": ""
+ },
+ "require": {
+ "composer/pcre": "^2 || ^3",
+ "php": "^7.2 || ^8.0",
+ "symfony/finder": "^4.4 || ^5.3 || ^6"
+ },
+ "require-dev": {
+ "phpstan/phpstan": "^1.6",
+ "phpstan/phpstan-deprecation-rules": "^1",
+ "phpstan/phpstan-phpunit": "^1",
+ "phpstan/phpstan-strict-rules": "^1.1",
+ "symfony/filesystem": "^5.4 || ^6",
+ "symfony/phpunit-bridge": "^5"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Composer\\ClassMapGenerator\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jordi Boggiano",
+ "email": "[email protected]",
+ "homepage": "https://seld.be"
+ }
+ ],
+ "description": "Utilities to scan PHP code and generate class maps.",
+ "keywords": [
+ "classmap"
+ ],
+ "support": {
+ "issues": "https://github.com/composer/class-map-generator/issues",
+ "source": "https://github.com/composer/class-map-generator/tree/1.0.0"
+ },
+ "funding": [
+ {
+ "url": "https://packagist.com",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/composer",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/composer/composer",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2022-06-19T11:31:27+00:00"
+ },
{
"name": "composer/pcre",
"version": "3.1.0",
@@ -10118,16 +10191,16 @@
},
{
"name": "phpunit/phpunit",
- "version": "9.6.2",
+ "version": "9.6.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "1a461cabfbd5b464f5d41c49a9959c63b4ecd2d1"
+ "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1a461cabfbd5b464f5d41c49a9959c63b4ecd2d1",
- "reference": "1a461cabfbd5b464f5d41c49a9959c63b4ecd2d1",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e7b1615e3e887d6c719121c6d4a44b0ab9645555",
+ "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555",
"shasum": ""
},
"require": {
@@ -10200,7 +10273,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
- "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.2"
+ "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.3"
},
"funding": [
{
@@ -10216,7 +10289,7 @@
"type": "tidelift"
}
],
- "time": "2023-02-04T06:59:53+00:00"
+ "time": "2023-02-04T13:37:15+00:00"
},
{
"name": "sebastian/cli-parser",
diff --git a/tests/Api/Autocomplete/AccountControllerTest.php b/tests/Api/Autocomplete/AccountControllerTest.php
index e95f9e5bb7..7ff8e51672 100644
--- a/tests/Api/Autocomplete/AccountControllerTest.php
+++ b/tests/Api/Autocomplete/AccountControllerTest.php
@@ -51,6 +51,7 @@ class AccountControllerTest extends TestCase
$response = $this->get(route('api.v1.autocomplete.accounts'), ['Accept' => 'application/json']);
$response->assertStatus(200);
$response->assertHeader('Content-Type', 'application/json');
+ $response->assertSee('Checking Account');
}
/**
diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php
index a88287c0f5..22211a5905 100644
--- a/tests/CreatesApplication.php
+++ b/tests/CreatesApplication.php
@@ -28,9 +28,6 @@ use Illuminate\Foundation\Application;
/**
* Trait CreatesApplication
*
- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- * @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/
trait CreatesApplication
{