diff --git a/TESTING.md b/TESTING.md index d1e062541..3a2f4e538 100644 --- a/TESTING.md +++ b/TESTING.md @@ -9,7 +9,39 @@ Before starting, follow the [instructions](README.md#installation) for installin Before attempting to run the test suite copy the example environment file for tests and update the values to match your environment: `cp .env.testing.example .env.testing` -> Since the data in the database is flushed after each test it is recommended you create a separate mysql database for specifically for tests + +The following should work for running tests in memory with sqlite: +``` +# -------------------------------------------- +# REQUIRED: BASIC APP SETTINGS +# -------------------------------------------- +APP_ENV=testing +APP_DEBUG=true +APP_KEY=base64:glJpcM7BYwWiBggp3SQ/+NlRkqsBQMaGEOjemXqJzOU= +APP_URL=http://localhost:8000 +APP_TIMEZONE='UTC' +APP_LOCALE=en + +# -------------------------------------------- +# REQUIRED: DATABASE SETTINGS +# -------------------------------------------- +DB_CONNECTION=sqlite_testing +#DB_HOST=127.0.0.1 +#DB_PORT=3306 +#DB_DATABASE=null +#DB_USERNAME=null +#DB_PASSWORD=null +``` + +To use MySQL you should update the `DB_` variables to match your local test database: +``` +DB_CONNECTION=mysql +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_DATABASE={} +DB_USERNAME={} +DB_PASSWORD={} +``` Now you are ready to run the entire test suite from your terminal: diff --git a/app/Models/License.php b/app/Models/License.php index 162b3d662..44f1f45b7 100755 --- a/app/Models/License.php +++ b/app/Models/License.php @@ -323,7 +323,10 @@ class License extends Depreciable */ public function checkin_email() { - return $this->category->checkin_email; + if ($this->category) { + return $this->category->checkin_email; + } + return false; } /** @@ -335,7 +338,11 @@ class License extends Depreciable */ public function requireAcceptance() { - return $this->category->require_acceptance; + if ($this->category) { + return $this->category->require_acceptance; + } + + return false; } /** @@ -348,14 +355,16 @@ class License extends Depreciable */ public function getEula() { - - if ($this->category->eula_text) { - return Helper::parseEscapedMarkedown($this->category->eula_text); - } elseif ($this->category->use_default_eula == '1') { - return Helper::parseEscapedMarkedown(Setting::getSettings()->default_eula_text); - } else { - return false; + if ($this->category){ + if ($this->category->eula_text) { + return Helper::parseEscapedMarkedown($this->category->eula_text); + } elseif ($this->category->use_default_eula == '1') { + return Helper::parseEscapedMarkedown(Setting::getSettings()->default_eula_text); + } } + + return false; + } /** diff --git a/app/Models/LicenseSeat.php b/app/Models/LicenseSeat.php index d2a99d3c5..8a51c0c9c 100755 --- a/app/Models/LicenseSeat.php +++ b/app/Models/LicenseSeat.php @@ -48,7 +48,10 @@ class LicenseSeat extends SnipeModel implements ICompanyableChild */ public function requireAcceptance() { - return $this->license->category->require_acceptance; + if ($this->license && $this->license->category) { + return $this->license->category->require_acceptance; + } + return false; } public function getEula() diff --git a/composer.lock b/composer.lock index 9f84ec8b2..7ca88da10 100644 --- a/composer.lock +++ b/composer.lock @@ -78,25 +78,25 @@ "source": { "type": "git", "url": "https://github.com/grokability/laravel-scim-server.git", - "reference": "9e8dd2d3958d3c3c05d0a99fe6475361ad9e9419" + "reference": "dda6dfb60d70fb6cca4b8d4ce1c5f4c19deaab2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/grokability/laravel-scim-server/zipball/9e8dd2d3958d3c3c05d0a99fe6475361ad9e9419", - "reference": "9e8dd2d3958d3c3c05d0a99fe6475361ad9e9419", + "url": "https://api.github.com/repos/grokability/laravel-scim-server/zipball/dda6dfb60d70fb6cca4b8d4ce1c5f4c19deaab2d", + "reference": "dda6dfb60d70fb6cca4b8d4ce1c5f4c19deaab2d", "shasum": "" }, "require": { - "illuminate/console": "^6.0|^7.0|^8.0|^9.0", - "illuminate/database": "^6.0|^7.0|^8.0|^9.0", - "illuminate/support": "^6.0|^7.0|^8.0|^9.0", + "illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/database": "^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0", "php": "^7.0|^8.0", "tmilos/scim-filter-parser": "^1.3", "tmilos/scim-schema": "^0.1.0" }, "require-dev": { "laravel/legacy-factories": "*", - "orchestra/testbench": "^5.0|^6.0" + "orchestra/testbench": "^4.0|^5.0|^6.0|^7.0|^8.0" }, "default-branch": true, "type": "library", @@ -133,7 +133,7 @@ "support": { "source": "https://github.com/grokability/laravel-scim-server/tree/master" }, - "time": "2023-01-12T00:32:07+00:00" + "time": "2023-09-07T16:45:26+00:00" }, { "name": "asm89/stack-cors",