From 378cf1c60c214e70831b49aa0a080c3d47ade5e1 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 6 Apr 2021 08:35:27 +1000 Subject: [PATCH 1/7] Fixes for localizing emails --- app/Jobs/Entity/EmailEntity.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Jobs/Entity/EmailEntity.php b/app/Jobs/Entity/EmailEntity.php index 63b859906c..d6e6c12358 100644 --- a/app/Jobs/Entity/EmailEntity.php +++ b/app/Jobs/Entity/EmailEntity.php @@ -34,6 +34,7 @@ use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Mail; use Illuminate\Support\Str; +use Illuminate\Support\Facades\App; /*Multi Mailer implemented*/ @@ -104,6 +105,9 @@ class EmailEntity implements ShouldQueue /* Set DB */ MultiDB::setDB($this->company->db); + App::setLocale($this->invitation->contact->preferredLocale()); + + $nmo = new NinjaMailerObject; $nmo->mailable = new TemplateEmail($this->email_entity_builder,$this->invitation->contact, $this->invitation); $nmo->company = $this->company; From fac1eebd2cb25eac027e1c0adf46090bcf6c9463 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 6 Apr 2021 10:43:56 +1000 Subject: [PATCH 2/7] PHP 8.0 suppotr --- .github/workflows/phpunit.yml | 2 +- app/Utils/Traits/CompanySettingsSaver.php | 4 +- composer.lock | 65 +++++++++-------------- 3 files changed, 29 insertions(+), 42 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 67a44a3232..67440856c8 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: operating-system: ['ubuntu-18.04', 'ubuntu-20.04'] - php-versions: ['7.4'] + php-versions: ['7.3','7.4','8.0'] phpunit-versions: ['latest'] env: diff --git a/app/Utils/Traits/CompanySettingsSaver.php b/app/Utils/Traits/CompanySettingsSaver.php index 3cc1455130..00fb5bfb83 100644 --- a/app/Utils/Traits/CompanySettingsSaver.php +++ b/app/Utils/Traits/CompanySettingsSaver.php @@ -220,14 +220,14 @@ trait CompanySettingsSaver switch ($key) { case 'int': case 'integer': - return ctype_digit(strval(abs($value))); + return ctype_digit(strval(abs((int)$value))); // return is_int($value) || ctype_digit(strval(abs($value))); case 'real': case 'float': case 'double': return is_float($value) || is_numeric(strval($value)); case 'string': - return method_exists($value, '__toString') || is_null($value) || is_string($value); + return (is_string($value) && method_exists($value, '__toString')) || is_null($value) || is_string($value); //return is_null($value) || is_string($value); case 'bool': case 'boolean': diff --git a/composer.lock b/composer.lock index 25ba157a24..9db957d61e 100644 --- a/composer.lock +++ b/composer.lock @@ -51,16 +51,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.176.5", + "version": "3.176.8", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "45d69a8da4f55879f8a24b0b659a5bc7ad077725" + "reference": "776b944988167fa3d563d2cbc5fcb6763424a9f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/45d69a8da4f55879f8a24b0b659a5bc7ad077725", - "reference": "45d69a8da4f55879f8a24b0b659a5bc7ad077725", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/776b944988167fa3d563d2cbc5fcb6763424a9f0", + "reference": "776b944988167fa3d563d2cbc5fcb6763424a9f0", "shasum": "" }, "require": { @@ -135,9 +135,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.176.5" + "source": "https://github.com/aws/aws-sdk-php/tree/3.176.8" }, - "time": "2021-03-31T18:15:22+00:00" + "time": "2021-04-05T18:16:29+00:00" }, { "name": "bacon/bacon-qr-code", @@ -641,16 +641,16 @@ }, { "name": "composer/composer", - "version": "2.0.11", + "version": "2.0.12", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "a5a5632da0b1c2d6fa9a3b65f1f4e90d1f04abb9" + "reference": "6c12ce263da71641903e399c3ce8ecb08fd375fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/a5a5632da0b1c2d6fa9a3b65f1f4e90d1f04abb9", - "reference": "a5a5632da0b1c2d6fa9a3b65f1f4e90d1f04abb9", + "url": "https://api.github.com/repos/composer/composer/zipball/6c12ce263da71641903e399c3ce8ecb08fd375fb", + "reference": "6c12ce263da71641903e399c3ce8ecb08fd375fb", "shasum": "" }, "require": { @@ -718,7 +718,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/composer/issues", - "source": "https://github.com/composer/composer/tree/2.0.11" + "source": "https://github.com/composer/composer/tree/2.0.12" }, "funding": [ { @@ -734,7 +734,7 @@ "type": "tidelift" } ], - "time": "2021-02-24T13:57:23+00:00" + "time": "2021-04-01T08:14:59+00:00" }, { "name": "composer/semver", @@ -2045,7 +2045,7 @@ }, { "name": "google/apiclient-services", - "version": "v0.166.0", + "version": "v0.167.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", @@ -2080,7 +2080,7 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.166.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.167.0" }, "time": "2021-03-22T11:26:04+00:00" }, @@ -3881,16 +3881,16 @@ }, { "name": "livewire/livewire", - "version": "v2.4.1", + "version": "v2.4.2", "source": { "type": "git", "url": "https://github.com/livewire/livewire.git", - "reference": "b0cb782674673a67ddfd5910d2fcb5308bb32857" + "reference": "2495387841a3eb03ac62b2c984ccd2574303285b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/livewire/livewire/zipball/b0cb782674673a67ddfd5910d2fcb5308bb32857", - "reference": "b0cb782674673a67ddfd5910d2fcb5308bb32857", + "url": "https://api.github.com/repos/livewire/livewire/zipball/2495387841a3eb03ac62b2c984ccd2574303285b", + "reference": "2495387841a3eb03ac62b2c984ccd2574303285b", "shasum": "" }, "require": { @@ -3941,7 +3941,7 @@ "description": "A front-end framework for Laravel.", "support": { "issues": "https://github.com/livewire/livewire/issues", - "source": "https://github.com/livewire/livewire/tree/v2.4.1" + "source": "https://github.com/livewire/livewire/tree/v2.4.2" }, "funding": [ { @@ -3949,7 +3949,7 @@ "type": "github" } ], - "time": "2021-03-22T14:03:36+00:00" + "time": "2021-04-04T15:46:50+00:00" }, { "name": "maennchen/zipstream-php", @@ -5645,23 +5645,22 @@ }, { "name": "predis/predis", - "version": "v1.1.6", + "version": "v1.1.7", "source": { "type": "git", "url": "https://github.com/predis/predis.git", - "reference": "9930e933c67446962997b05201c69c2319bf26de" + "reference": "b240daa106d4e02f0c5b7079b41e31ddf66fddf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/predis/predis/zipball/9930e933c67446962997b05201c69c2319bf26de", - "reference": "9930e933c67446962997b05201c69c2319bf26de", + "url": "https://api.github.com/repos/predis/predis/zipball/b240daa106d4e02f0c5b7079b41e31ddf66fddf8", + "reference": "b240daa106d4e02f0c5b7079b41e31ddf66fddf8", "shasum": "" }, "require": { "php": ">=5.3.9" }, "require-dev": { - "cweagans/composer-patches": "^1.6", "phpunit/phpunit": "~4.8" }, "suggest": { @@ -5669,18 +5668,6 @@ "ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol" }, "type": "library", - "extra": { - "composer-exit-on-patch-failure": true, - "patches": { - "phpunit/phpunit-mock-objects": { - "Fix PHP 7 and 8 compatibility": "./tests/phpunit_mock_objects.patch" - }, - "phpunit/phpunit": { - "Fix PHP 7 compatibility": "./tests/phpunit_php7.patch", - "Fix PHP 8 compatibility": "./tests/phpunit_php8.patch" - } - } - }, "autoload": { "psr-4": { "Predis\\": "src/" @@ -5712,7 +5699,7 @@ ], "support": { "issues": "https://github.com/predis/predis/issues", - "source": "https://github.com/predis/predis/tree/v1.1.6" + "source": "https://github.com/predis/predis/tree/v1.1.7" }, "funding": [ { @@ -5720,7 +5707,7 @@ "type": "github" } ], - "time": "2020-09-11T19:18:05+00:00" + "time": "2021-04-04T19:34:46+00:00" }, { "name": "psr/cache", From 86d612f127d614e75f5230802b1ac6d40ee300eb Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 6 Apr 2021 10:46:45 +1000 Subject: [PATCH 3/7] Update composer to support PHP8.0 --- composer.json | 4 +-- composer.lock | 71 +++++++++++++++++++++++++++------------------------ 2 files changed, 39 insertions(+), 36 deletions(-) diff --git a/composer.json b/composer.json index 05ca3ad487..5edc9a03c5 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ ], "type": "project", "require": { - "php": "^7.3|^7.4", + "php": "^7.3|^7.4|^8.0", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -71,7 +71,7 @@ "wildbit/swiftmailer-postmark": "^3.3" }, "require-dev": { - "php": "^7.3|^7.4", + "php": "^7.3|^7.4|^8.0", "anahkiasen/former": "^4.2", "barryvdh/laravel-debugbar": "^3.4", "brianium/paratest": "^6.1", diff --git a/composer.lock b/composer.lock index 9db957d61e..54731ce781 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": "2307a2f3214da0d1cc772cc1a1405682", + "content-hash": "a76d1ecefd6830083b247e8c1af5c4f0", "packages": [ { "name": "authorizenet/authorizenet", @@ -1008,16 +1008,16 @@ }, { "name": "dacastro4/laravel-gmail", - "version": "v5.1", + "version": "v5.1.2", "source": { "type": "git", "url": "https://github.com/dacastro4/laravel-gmail.git", - "reference": "6d4cabe04f8cdd02b25ef73a1a489099b5e790bd" + "reference": "7db240bb5ac2d86fdce98e1880c4c0857c73aff8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dacastro4/laravel-gmail/zipball/6d4cabe04f8cdd02b25ef73a1a489099b5e790bd", - "reference": "6d4cabe04f8cdd02b25ef73a1a489099b5e790bd", + "url": "https://api.github.com/repos/dacastro4/laravel-gmail/zipball/7db240bb5ac2d86fdce98e1880c4c0857c73aff8", + "reference": "7db240bb5ac2d86fdce98e1880c4c0857c73aff8", "shasum": "" }, "require": { @@ -1028,13 +1028,13 @@ "illuminate/routing": "~5.8|^6.0|^7.0|^8.0", "illuminate/session": "~5.8|^6.0|^7.0|^8.0", "illuminate/support": "~5.8|^6.0|^7.0|^8.0", - "php": "^7.2", + "php": "^8.0", "swiftmailer/swiftmailer": "~5.8|^6.0" }, "require-dev": { "mockery/mockery": "^1.0", - "orchestra/testbench": "^4.0", - "phpunit/phpunit": "^8.5", + "orchestra/testbench": "^4.0|^5.0|^6.0", + "phpunit/phpunit": "^9.3", "squizlabs/php_codesniffer": "~3.4" }, "type": "library", @@ -1061,7 +1061,7 @@ { "name": "Daniel Castro", "email": "danielcastro04@gmail.com", - "homepage": "https://danielcastro.me" + "homepage": "https://danielcastro.dev" } ], "description": "Gmail API package for Laravel", @@ -1072,9 +1072,9 @@ ], "support": { "issues": "https://github.com/dacastro4/laravel-gmail/issues", - "source": "https://github.com/dacastro4/laravel-gmail/tree/v5.1" + "source": "https://github.com/dacastro4/laravel-gmail/tree/v5.1.2" }, - "time": "2020-12-13T19:17:07+00:00" + "time": "2021-04-05T20:34:36+00:00" }, { "name": "dasprid/enum", @@ -1921,26 +1921,27 @@ }, { "name": "fzaninotto/faker", - "version": "v1.9.2", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/fzaninotto/Faker.git", - "reference": "848d8125239d7dbf8ab25cb7f054f1a630e68c2e" + "reference": "5ffe7db6c80f441f150fc88008d64e64af66634b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/848d8125239d7dbf8ab25cb7f054f1a630e68c2e", - "reference": "848d8125239d7dbf8ab25cb7f054f1a630e68c2e", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/5ffe7db6c80f441f150fc88008d64e64af66634b", + "reference": "5ffe7db6c80f441f150fc88008d64e64af66634b", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^5.3.3 || ^7.0 || ^8.0" }, "require-dev": { "ext-intl": "*", "phpunit/phpunit": "^4.8.35 || ^5.7", "squizlabs/php_codesniffer": "^2.9.2" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -1969,10 +1970,10 @@ ], "support": { "issues": "https://github.com/fzaninotto/Faker/issues", - "source": "https://github.com/fzaninotto/Faker/tree/v1.9.2" + "source": "https://github.com/fzaninotto/Faker/tree/master" }, "abandoned": true, - "time": "2020-12-11T09:56:16+00:00" + "time": "2020-12-11T09:59:14+00:00" }, { "name": "google/apiclient", @@ -3824,27 +3825,28 @@ }, { "name": "league/omnipay", - "version": "v3.1.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/thephpleague/omnipay.git", - "reference": "1ba7c8a3312cf2342458b99c9e5b86eaae44aed2" + "reference": "e9439db0633ba988e6f6cdd029fad38aad73f9f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/omnipay/zipball/1ba7c8a3312cf2342458b99c9e5b86eaae44aed2", - "reference": "1ba7c8a3312cf2342458b99c9e5b86eaae44aed2", + "url": "https://api.github.com/repos/thephpleague/omnipay/zipball/e9439db0633ba988e6f6cdd029fad38aad73f9f6", + "reference": "e9439db0633ba988e6f6cdd029fad38aad73f9f6", "shasum": "" }, "require": { "omnipay/common": "^3", - "php": "^7.2", + "php": "^7.2|^8.0", "php-http/discovery": "^1.12", "php-http/guzzle7-adapter": "^0.1" }, "require-dev": { "omnipay/tests": "^3" }, + "default-branch": true, "type": "metapackage", "extra": { "branch-alias": { @@ -3875,9 +3877,9 @@ ], "support": { "issues": "https://github.com/thephpleague/omnipay/issues", - "source": "https://github.com/thephpleague/omnipay/tree/v3.1.0" + "source": "https://github.com/thephpleague/omnipay/tree/master" }, - "time": "2020-09-22T14:02:17+00:00" + "time": "2021-03-12T09:17:59+00:00" }, { "name": "livewire/livewire", @@ -4628,21 +4630,21 @@ }, { "name": "omnipay/common", - "version": "v3.0.5", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/thephpleague/omnipay-common.git", - "reference": "0d1f4486c1c873537ac030d37c7ce2986c4de1d2" + "reference": "e1ebc22615f14219d31cefdf62d7036feb228b1c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/omnipay-common/zipball/0d1f4486c1c873537ac030d37c7ce2986c4de1d2", - "reference": "0d1f4486c1c873537ac030d37c7ce2986c4de1d2", + "url": "https://api.github.com/repos/thephpleague/omnipay-common/zipball/e1ebc22615f14219d31cefdf62d7036feb228b1c", + "reference": "e1ebc22615f14219d31cefdf62d7036feb228b1c", "shasum": "" }, "require": { "moneyphp/money": "^3.1", - "php": "^5.6|^7", + "php": "^5.6|^7|^8", "php-http/client-implementation": "^1", "php-http/discovery": "^1.2.1", "php-http/message": "^1.5", @@ -4657,6 +4659,7 @@ "suggest": { "league/omnipay": "The default Omnipay package provides a default HTTP Adapter." }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -4708,9 +4711,9 @@ ], "support": { "issues": "https://github.com/thephpleague/omnipay-common/issues", - "source": "https://github.com/thephpleague/omnipay-common/tree/v3.0.5" + "source": "https://github.com/thephpleague/omnipay-common/tree/master" }, - "time": "2020-08-20T18:22:12+00:00" + "time": "2020-12-13T12:53:48+00:00" }, { "name": "omnipay/paypal", @@ -14120,13 +14123,13 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^7.3|^7.4", + "php": "^7.3|^7.4|^8.0", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*" }, "platform-dev": { - "php": "^7.3|^7.4" + "php": "^7.3|^7.4|^8.0" }, "plugin-api-version": "2.0.0" } From 47c89067ad398ef6a0f1a1e459a4a111d2c2b700 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 6 Apr 2021 10:49:42 +1000 Subject: [PATCH 4/7] Update composer to support PHP8.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5edc9a03c5..2aeb593660 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "coconutcraig/laravel-postmark": "^2.10", "composer/composer": "^2", "czproject/git-php": "^3.17", - "dacastro4/laravel-gmail": "^5.1", + "dacastro4/laravel-gmail": "5.1", "doctrine/dbal": "^2.10", "fideloper/proxy": "^4.2", "fzaninotto/faker": "^1.4", From 2e72df7f096ece47b567435c73e4ad1795dde2de Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 6 Apr 2021 11:21:18 +1000 Subject: [PATCH 5/7] update dependencies for PHP 8.0 --- composer.json | 2 +- composer.lock | 141 +++++++++++++++++++++++++------------------------- 2 files changed, 71 insertions(+), 72 deletions(-) diff --git a/composer.json b/composer.json index 2aeb593660..bcf189fe9c 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "coconutcraig/laravel-postmark": "^2.10", "composer/composer": "^2", "czproject/git-php": "^3.17", - "dacastro4/laravel-gmail": "5.1", + "turbo124/laravel-gmail": "^5", "doctrine/dbal": "^2.10", "fideloper/proxy": "^4.2", "fzaninotto/faker": "^1.4", diff --git a/composer.lock b/composer.lock index 54731ce781..91baf1447f 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": "a76d1ecefd6830083b247e8c1af5c4f0", + "content-hash": "feb70f976b798dde6550a7b5439bb191", "packages": [ { "name": "authorizenet/authorizenet", @@ -1006,76 +1006,6 @@ }, "time": "2021-02-15T11:41:33+00:00" }, - { - "name": "dacastro4/laravel-gmail", - "version": "v5.1.2", - "source": { - "type": "git", - "url": "https://github.com/dacastro4/laravel-gmail.git", - "reference": "7db240bb5ac2d86fdce98e1880c4c0857c73aff8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dacastro4/laravel-gmail/zipball/7db240bb5ac2d86fdce98e1880c4c0857c73aff8", - "reference": "7db240bb5ac2d86fdce98e1880c4c0857c73aff8", - "shasum": "" - }, - "require": { - "google/apiclient": "^2.5", - "illuminate/auth": "~5.8|^6.0|^7.0|^8.0", - "illuminate/config": "~5.8|^6.0|^7.0|^8.0", - "illuminate/database": "~5.8|^6.0|^7.0|^8.0", - "illuminate/routing": "~5.8|^6.0|^7.0|^8.0", - "illuminate/session": "~5.8|^6.0|^7.0|^8.0", - "illuminate/support": "~5.8|^6.0|^7.0|^8.0", - "php": "^8.0", - "swiftmailer/swiftmailer": "~5.8|^6.0" - }, - "require-dev": { - "mockery/mockery": "^1.0", - "orchestra/testbench": "^4.0|^5.0|^6.0", - "phpunit/phpunit": "^9.3", - "squizlabs/php_codesniffer": "~3.4" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Dacastro4\\LaravelGmail\\LaravelGmailServiceProvider" - ], - "aliases": { - "LaravelGmail": "Dacastro4\\LaravelGmail\\Facade\\LaravelGmail" - } - } - }, - "autoload": { - "psr-4": { - "Dacastro4\\LaravelGmail\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Castro", - "email": "danielcastro04@gmail.com", - "homepage": "https://danielcastro.dev" - } - ], - "description": "Gmail API package for Laravel", - "keywords": [ - "api", - "gmail", - "laravel" - ], - "support": { - "issues": "https://github.com/dacastro4/laravel-gmail/issues", - "source": "https://github.com/dacastro4/laravel-gmail/tree/v5.1.2" - }, - "time": "2021-04-05T20:34:36+00:00" - }, { "name": "dasprid/enum", "version": "1.0.3", @@ -9751,6 +9681,75 @@ }, "time": "2021-03-23T09:54:29+00:00" }, + { + "name": "turbo124/laravel-gmail", + "version": "v5.0.1", + "source": { + "type": "git", + "url": "https://github.com/turbo124/laravel-gmail.git", + "reference": "55ca0271a54a568ebaa26febbe0790b2ce5ac966" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/turbo124/laravel-gmail/zipball/55ca0271a54a568ebaa26febbe0790b2ce5ac966", + "reference": "55ca0271a54a568ebaa26febbe0790b2ce5ac966", + "shasum": "" + }, + "require": { + "google/apiclient": "^2.5", + "illuminate/auth": "~5.8|^6.0|^7.0|^8.0", + "illuminate/config": "~5.8|^6.0|^7.0|^8.0", + "illuminate/database": "~5.8|^6.0|^7.0|^8.0", + "illuminate/routing": "~5.8|^6.0|^7.0|^8.0", + "illuminate/session": "~5.8|^6.0|^7.0|^8.0", + "illuminate/support": "~5.8|^6.0|^7.0|^8.0", + "php": "^7.3|^7.4|^8.0", + "swiftmailer/swiftmailer": "~5.8|^6.0" + }, + "require-dev": { + "mockery/mockery": "^1.0", + "orchestra/testbench": "^4.0", + "phpunit/phpunit": "^8.5", + "squizlabs/php_codesniffer": "~3.4" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Dacastro4\\LaravelGmail\\LaravelGmailServiceProvider" + ], + "aliases": { + "LaravelGmail": "Dacastro4\\LaravelGmail\\Facade\\LaravelGmail" + } + } + }, + "autoload": { + "psr-4": { + "Dacastro4\\LaravelGmail\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Castro", + "email": "danielcastro04@gmail.com", + "homepage": "https://danielcastro.me" + } + ], + "description": "Gmail API package for Laravel", + "keywords": [ + "api", + "gmail", + "laravel" + ], + "support": { + "source": "https://github.com/turbo124/laravel-gmail/tree/v5.0.1" + }, + "time": "2021-04-06T00:53:48+00:00" + }, { "name": "vlucas/phpdotenv", "version": "v5.3.0", From 6d1d950c4ea788498ddd30fdcdb0865b3ee62a08 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 6 Apr 2021 13:05:40 +1000 Subject: [PATCH 6/7] Ninja Feature Tests --- app/Models/Account.php | 15 ++++++--- tests/Feature/Ninja/PlanTest.php | 55 ++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 tests/Feature/Ninja/PlanTest.php diff --git a/app/Models/Account.php b/app/Models/Account.php index 737abe4578..f9afffc065 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -53,6 +53,7 @@ class Account extends BaseModel 'deleted_at', 'promo_expires', 'discount_expires', + 'trial_started', ]; const PLAN_FREE = 'free'; @@ -239,13 +240,17 @@ class Account extends BaseModel $trial_active = false; if ($trial_plan && $include_trial) { - $trial_started = DateTime::createFromFormat('Y-m-d', $this->trial_started); - $trial_expires = clone $trial_started; - $trial_expires->modify('+2 weeks'); + $trial_started = $this->trial_started; + $trial_expires = $this->trial_started->addSeconds($this->trial_duration); + // $trial_expires->modify('+2 weeks'); - if ($trial_expires >= date_create()) { + if($trial_expires->lessThan(now())){ $trial_active = true; - } + } + + // if ($trial_expires >= date_create()) { + // $trial_active = true; + // } } $plan_active = false; diff --git a/tests/Feature/Ninja/PlanTest.php b/tests/Feature/Ninja/PlanTest.php new file mode 100644 index 0000000000..1ce48c321a --- /dev/null +++ b/tests/Feature/Ninja/PlanTest.php @@ -0,0 +1,55 @@ +makeTestData(); + + Session::start(); + + $this->faker = \Faker\Factory::create(); + + Model::reguard(); + } + + public function testTrialPlans() + { + + $this->account->trial_plan = 'enterprise'; + $this->account->trial_started = now(); + $this->account->trial_duration = 60*60*24*31; + $this->account->save(); + + $this->assertTrue($this->account->hasFeature(Account::FEATURE_USERS)); + } + + +} From 355d0ae7b545617689e639559c548e015caba9a3 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 6 Apr 2021 14:02:27 +1000 Subject: [PATCH 7/7] Testing Permissions --- app/Models/Account.php | 4 +++- tests/Feature/Ninja/PlanTest.php | 14 +++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/Models/Account.php b/app/Models/Account.php index f9afffc065..71cca3cfc1 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -239,12 +239,13 @@ class Account extends BaseModel } $trial_active = false; + if ($trial_plan && $include_trial) { $trial_started = $this->trial_started; $trial_expires = $this->trial_started->addSeconds($this->trial_duration); // $trial_expires->modify('+2 weeks'); - if($trial_expires->lessThan(now())){ + if($trial_expires->greaterThan(now())){ $trial_active = true; } @@ -270,6 +271,7 @@ class Account extends BaseModel return null; } + // Should we show plan details or trial details? if (($plan && ! $trial_plan) || ! $include_trial) { $use_plan = true; diff --git a/tests/Feature/Ninja/PlanTest.php b/tests/Feature/Ninja/PlanTest.php index 1ce48c321a..4ec042b83e 100644 --- a/tests/Feature/Ninja/PlanTest.php +++ b/tests/Feature/Ninja/PlanTest.php @@ -42,13 +42,25 @@ class PlanTest extends TestCase public function testTrialPlans() { + config(['ninja.production' => true]); + + $this->assertFalse($this->account->hasFeature(Account::FEATURE_USERS)); $this->account->trial_plan = 'enterprise'; $this->account->trial_started = now(); $this->account->trial_duration = 60*60*24*31; $this->account->save(); - $this->assertTrue($this->account->hasFeature(Account::FEATURE_USERS)); + nlog($this->account->getPlanDetails()); + + $this->assertFalse($this->account->hasFeature(Account::FEATURE_USERS)); + + $this->account->trial_plan = 'pro'; + $this->account->save(); + + $this->assertFalse($this->account->hasFeature(Account::FEATURE_USERS)); + $this->assertTrue($this->account->hasFeature(Account::FEATURE_CUSTOM_URL)); + }