From f1d5c2e40c59f0dd4dbecd5f4d94471996dbea15 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:21:05 +0200 Subject: [PATCH 01/72] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e6b58465..044e946b 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Thanks. To run this application on your machine, you need at least: * PHP >= 7.2 -* Phalcon >= 4.0 +* Phalcon >= 5.1.2 * MySQL >= 5.5 * Apache Web Server with `mod_rewrite enabled`, and `AllowOverride Options` (or `All`) in your `httpd.conf` or Nginx Web Server * Latest [Phalcon Framework](https://github.com/phalcon/cphalcon) extension installed/enabled From 1a8e46b0a2631b49bdf79cae8b6b5be9a5a3f25f Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:23:45 +0200 Subject: [PATCH 02/72] Update Helpers.php --- src/Helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Helpers.php b/src/Helpers.php index b0af6fd3..9b085b2e 100644 --- a/src/Helpers.php +++ b/src/Helpers.php @@ -3,7 +3,7 @@ namespace Vokuro; -use Phalcon\Di; +use Phalcon\Di\Di; use Phalcon\Di\DiInterface; /** From a587826e89429734d476c23ebdbf8121336460d7 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:24:43 +0200 Subject: [PATCH 03/72] Update config.php --- config/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.php b/config/config.php index b834ef7d..0c9602ae 100644 --- a/config/config.php +++ b/config/config.php @@ -10,7 +10,7 @@ * the LICENSE file that was distributed with this source code. */ -use Phalcon\Logger; +use Phalcon\Logger\Logger; use function Vokuro\root_path; return [ From f2b2632ea41057db15fecc961029e44f0e30b6da Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:25:36 +0200 Subject: [PATCH 04/72] Update ConfigProvider.php --- src/Providers/ConfigProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Providers/ConfigProvider.php b/src/Providers/ConfigProvider.php index ca96ccb4..58a418b6 100644 --- a/src/Providers/ConfigProvider.php +++ b/src/Providers/ConfigProvider.php @@ -12,7 +12,7 @@ namespace Vokuro\Providers; -use Phalcon\Config; +use Phalcon\Config\Config; use Phalcon\Di\DiInterface; use Phalcon\Di\ServiceProviderInterface; use Vokuro\Application; From 6dd97dc68f66cc0ebbff24489c2b77b9dcdf151e Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:27:06 +0200 Subject: [PATCH 05/72] Update DbProvider.php --- src/Providers/DbProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Providers/DbProvider.php b/src/Providers/DbProvider.php index ecae3b0f..fcd793ab 100644 --- a/src/Providers/DbProvider.php +++ b/src/Providers/DbProvider.php @@ -12,7 +12,7 @@ namespace Vokuro\Providers; -use Phalcon\Config; +use Phalcon\Config\Config; use Phalcon\Db\Adapter\Pdo; use Phalcon\Di\DiInterface; use Phalcon\Di\ServiceProviderInterface; From 11ae1a3fe1a6f42133499060e669e46e64aa8c28 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:27:44 +0200 Subject: [PATCH 06/72] Update AssetsProvider.php --- src/Providers/AssetsProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Providers/AssetsProvider.php b/src/Providers/AssetsProvider.php index f0fb325d..5dd9129d 100644 --- a/src/Providers/AssetsProvider.php +++ b/src/Providers/AssetsProvider.php @@ -31,7 +31,7 @@ class AssetsProvider implements ServiceProviderInterface */ public function register(DiInterface $di): void { - $assetManager = new Manager(); + $assetManager = new Manager($di->getShared('tag')); $di->setShared($this->providerName, function () use ($assetManager) { From dff146cc81223f25580207f0aeef4f412764566f Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:28:07 +0200 Subject: [PATCH 07/72] Update UrlProvider.php --- src/Providers/UrlProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Providers/UrlProvider.php b/src/Providers/UrlProvider.php index baa88023..177c59ec 100644 --- a/src/Providers/UrlProvider.php +++ b/src/Providers/UrlProvider.php @@ -14,7 +14,7 @@ use Phalcon\Di\DiInterface; use Phalcon\Di\ServiceProviderInterface; -use Phalcon\Url as UrlResolver; +use Phalcon\Mvc\Url as UrlResolver; class UrlProvider implements ServiceProviderInterface { From bffaa95add839acc7fd2ac4154d6e489b6749a1a Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:28:35 +0200 Subject: [PATCH 08/72] Update FlashProvider.php --- src/Providers/FlashProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Providers/FlashProvider.php b/src/Providers/FlashProvider.php index 7d65115e..9295f4d3 100644 --- a/src/Providers/FlashProvider.php +++ b/src/Providers/FlashProvider.php @@ -12,7 +12,7 @@ namespace Vokuro\Providers; -use Phalcon\Escaper; +use Phalcon\Html\Escaper; use Phalcon\Di\DiInterface; use Phalcon\Di\ServiceProviderInterface; use Phalcon\Flash\Direct as Flash; From 20cfaa1020ece61de1225d83717f0e6691da2f0f Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:29:08 +0200 Subject: [PATCH 09/72] Update SignUpForm.php --- src/Forms/SignUpForm.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Forms/SignUpForm.php b/src/Forms/SignUpForm.php index 5e0f5b5a..5d6b531b 100644 --- a/src/Forms/SignUpForm.php +++ b/src/Forms/SignUpForm.php @@ -18,11 +18,11 @@ use Phalcon\Forms\Element\Submit; use Phalcon\Forms\Element\Text; use Phalcon\Forms\Form; -use Phalcon\Validation\Validator\Confirmation; -use Phalcon\Validation\Validator\Email; -use Phalcon\Validation\Validator\Identical; -use Phalcon\Validation\Validator\PresenceOf; -use Phalcon\Validation\Validator\StringLength; +use Phalcon\Filter\Validation\Validator\Confirmation; +use Phalcon\Filter\Validation\Validator\Email; +use Phalcon\Filter\Validation\Validator\Identical; +use Phalcon\Filter\Validation\Validator\PresenceOf; +use Phalcon\Filter\Validation\Validator\StringLength; class SignUpForm extends Form { From 01c81f5bf9045b60f38df86b0162f1a9c22e1a84 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:29:37 +0200 Subject: [PATCH 10/72] Update SecurityProvider.php --- src/Providers/SecurityProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Providers/SecurityProvider.php b/src/Providers/SecurityProvider.php index bb9462d3..f94dcd90 100644 --- a/src/Providers/SecurityProvider.php +++ b/src/Providers/SecurityProvider.php @@ -14,7 +14,7 @@ use Phalcon\Di\DiInterface; use Phalcon\Di\ServiceProviderInterface; -use Phalcon\Security; +use Phalcon\Encryption\Security; class SecurityProvider implements ServiceProviderInterface { From 146ccd9b9e4ce8097152fefb12aa112c5ec0267a Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:30:23 +0200 Subject: [PATCH 11/72] Update Users.php --- src/Models/Users.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Models/Users.php b/src/Models/Users.php index 518f8308..4c1fda7a 100644 --- a/src/Models/Users.php +++ b/src/Models/Users.php @@ -13,9 +13,9 @@ namespace Vokuro\Models; use Phalcon\Mvc\Model; -use Phalcon\Security; -use Phalcon\Validation; -use Phalcon\Validation\Validator\Uniqueness; +use Phalcon\Encryption\Security; +use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Validator\Uniqueness; /** * All the users registered in the application From eedd01c32a0a21727461ce05c961c22f842fbbbf Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:31:14 +0200 Subject: [PATCH 12/72] Update LoginForm.php --- src/Forms/LoginForm.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Forms/LoginForm.php b/src/Forms/LoginForm.php index 8dc2043b..32e207bd 100644 --- a/src/Forms/LoginForm.php +++ b/src/Forms/LoginForm.php @@ -18,9 +18,9 @@ use Phalcon\Forms\Element\Submit; use Phalcon\Forms\Element\Text; use Phalcon\Forms\Form; -use Phalcon\Validation\Validator\Email; -use Phalcon\Validation\Validator\Identical; -use Phalcon\Validation\Validator\PresenceOf; +use Phalcon\Filter\Validation\Validator\Email; +use Phalcon\Filter\Validation\Validator\Identical; +use Phalcon\Filter\Validation\Validator\PresenceOf; class LoginForm extends Form { From 75070e88baecb693c21962f03e37ac26b894583b Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:32:40 +0200 Subject: [PATCH 13/72] Update ProfilesForm.php --- src/Forms/ProfilesForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Forms/ProfilesForm.php b/src/Forms/ProfilesForm.php index 9e6d4285..d8d3e26e 100644 --- a/src/Forms/ProfilesForm.php +++ b/src/Forms/ProfilesForm.php @@ -16,7 +16,7 @@ use Phalcon\Forms\Element\Select; use Phalcon\Forms\Element\Text; use Phalcon\Forms\Form; -use Phalcon\Validation\Validator\PresenceOf; +use Phalcon\Filter\Validation\Validator\PresenceOf; class ProfilesForm extends Form { From 1f5fb879d2298bba3a8a37323b7b935377149794 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:33:06 +0200 Subject: [PATCH 14/72] Update ChangePasswordForm.php --- src/Forms/ChangePasswordForm.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Forms/ChangePasswordForm.php b/src/Forms/ChangePasswordForm.php index 6ed94f6d..2c23633c 100644 --- a/src/Forms/ChangePasswordForm.php +++ b/src/Forms/ChangePasswordForm.php @@ -14,9 +14,9 @@ use Phalcon\Forms\Element\Password; use Phalcon\Forms\Form; -use Phalcon\Validation\Validator\Confirmation; -use Phalcon\Validation\Validator\PresenceOf; -use Phalcon\Validation\Validator\StringLength; +use Phalcon\Filter\Validation\Validator\Confirmation; +use Phalcon\Filter\Validation\Validator\PresenceOf; +use Phalcon\Filter\Validation\Validator\StringLength; class ChangePasswordForm extends Form { From 285b894cc3101fe50844398fa7807932ed0f6c55 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:33:21 +0200 Subject: [PATCH 15/72] Update ForgotPasswordForm.php --- src/Forms/ForgotPasswordForm.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Forms/ForgotPasswordForm.php b/src/Forms/ForgotPasswordForm.php index 64473b0c..ff61cbb7 100644 --- a/src/Forms/ForgotPasswordForm.php +++ b/src/Forms/ForgotPasswordForm.php @@ -15,8 +15,8 @@ use Phalcon\Forms\Element\Submit; use Phalcon\Forms\Element\Text; use Phalcon\Forms\Form; -use Phalcon\Validation\Validator\Email; -use Phalcon\Validation\Validator\PresenceOf; +use Phalcon\Filter\Validation\Validator\Email; +use Phalcon\Filter\Validation\Validator\PresenceOf; class ForgotPasswordForm extends Form { From 05657a3f449a6454709e371d27c5503bd1dab847 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:34:03 +0200 Subject: [PATCH 16/72] Update UsersForm.php --- src/Forms/UsersForm.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Forms/UsersForm.php b/src/Forms/UsersForm.php index 1ed37491..5494e9ad 100644 --- a/src/Forms/UsersForm.php +++ b/src/Forms/UsersForm.php @@ -16,8 +16,8 @@ use Phalcon\Forms\Element\Select; use Phalcon\Forms\Element\Text; use Phalcon\Forms\Form; -use Phalcon\Validation\Validator\Email; -use Phalcon\Validation\Validator\PresenceOf; +use Phalcon\Filter\Validation\Validator\Email; +use Phalcon\Filter\Validation\Validator\PresenceOf; use Vokuro\Models\Profiles; class UsersForm extends Form From 31c723f7dbd740082e2ac4438681fa3dc94d46f2 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:36:49 +0200 Subject: [PATCH 17/72] Update LoggerProvider.php --- src/Providers/LoggerProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Providers/LoggerProvider.php b/src/Providers/LoggerProvider.php index 0eadca08..61d5ded0 100644 --- a/src/Providers/LoggerProvider.php +++ b/src/Providers/LoggerProvider.php @@ -12,7 +12,7 @@ namespace Vokuro\Providers; -use Phalcon\Config; +use Phalcon\Config\Config; use Phalcon\Di\DiInterface; use Phalcon\Di\ServiceProviderInterface; use Phalcon\Logger\Adapter\Stream as FileLogger; From 0323d155a589971e4e579257084f856f84db4735 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:38:23 +0200 Subject: [PATCH 18/72] Update ViewProvider.php --- src/Providers/ViewProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Providers/ViewProvider.php b/src/Providers/ViewProvider.php index 3d3cc5b8..06fbb3c6 100644 --- a/src/Providers/ViewProvider.php +++ b/src/Providers/ViewProvider.php @@ -12,7 +12,7 @@ namespace Vokuro\Providers; -use Phalcon\Config; +use Phalcon\Config\Config; use Phalcon\Di\DiInterface; use Phalcon\Di\ServiceProviderInterface; use Phalcon\Mvc\View; From e46fbc9fde4dedfaef55b986f0fec490272b607b Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 20:45:16 +0200 Subject: [PATCH 19/72] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 92e63bf4..a990153f 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "require": { "php": ">=7.2", "ext-openssl": "*", - "ext-phalcon": "~4.0.0", + "ext-phalcon": ">=5.1.2", "robmorgan/phinx": "^0.11.1", "swiftmailer/swiftmailer": "^6.2", "vlucas/phpdotenv": "^3.6" From 8c395f2857483efbb76b3d4c838026728ebab378 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 21:22:12 +0200 Subject: [PATCH 20/72] Update search.volt --- themes/vokuro/profiles/search.volt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/themes/vokuro/profiles/search.volt b/themes/vokuro/profiles/search.volt index a08967e4..512345f4 100644 --- a/themes/vokuro/profiles/search.volt +++ b/themes/vokuro/profiles/search.volt @@ -18,14 +18,14 @@ {% for profile in page.items %} - {{ profile['id'] }} - {{ profile['name'] }} - {{ profile['active'] == 'Y' ? 'Yes' : 'No' }} + {{ profile.id }} + {{ profile.id }} + {{ profile.id == 'Y' ? 'Yes' : 'No' }} - {{ link_to("profiles/edit/" ~ profile['id'], ' Edit', "class": "btn btn-sm btn-outline-warning") }} + {{ link_to("profiles/edit/" ~ profile.id, ' Edit', "class": "btn btn-sm btn-outline-warning") }} - {{ link_to("profiles/delete/" ~ profile['id'], ' Delete', "class": "btn btn-sm btn-outline-danger") }} + {{ link_to("profiles/delete/" ~ profile.id, ' Delete', "class": "btn btn-sm btn-outline-danger") }} {% else %} From b22744bcd85d0609cefe7daf866e934738f3ef15 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 17 Jan 2023 21:33:01 +0200 Subject: [PATCH 21/72] Update search.volt --- themes/vokuro/profiles/search.volt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/vokuro/profiles/search.volt b/themes/vokuro/profiles/search.volt index 512345f4..c12e985a 100644 --- a/themes/vokuro/profiles/search.volt +++ b/themes/vokuro/profiles/search.volt @@ -19,8 +19,8 @@ {% for profile in page.items %} {{ profile.id }} - {{ profile.id }} - {{ profile.id == 'Y' ? 'Yes' : 'No' }} + {{ profile.name }} + {{ profile.active == 'Y' ? 'Yes' : 'No' }} {{ link_to("profiles/edit/" ~ profile.id, ' Edit', "class": "btn btn-sm btn-outline-warning") }} From aca97aa22a623c656d093d6d24b380aab7616a95 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Wed, 18 Jan 2023 12:31:36 +0200 Subject: [PATCH 22/72] Update composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index a990153f..67a37023 100644 --- a/composer.json +++ b/composer.json @@ -27,14 +27,14 @@ "require": { "php": ">=7.2", "ext-openssl": "*", - "ext-phalcon": ">=5.1.2", + "ext-phalcon": ">=5.1.4", "robmorgan/phinx": "^0.11.1", "swiftmailer/swiftmailer": "^6.2", "vlucas/phpdotenv": "^3.6" }, "require-dev": { "codeception/codeception": "^4.1.6", - "phalcon/ide-stubs": "4.0.6", + "phalcon/ide-stubs": "5.1.4", "phpunit/phpunit": "^8.4", "squizlabs/php_codesniffer": "3.5.5", "vimeo/psalm": "^3.7", From 7efdb319cca3a5d0e04cdb4ce6f0d07abf008f0f Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Wed, 18 Jan 2023 12:34:51 +0200 Subject: [PATCH 23/72] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 044e946b..ddc1bf0e 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Thanks. To run this application on your machine, you need at least: * PHP >= 7.2 -* Phalcon >= 5.1.2 +* Phalcon >= 5.1.4 * MySQL >= 5.5 * Apache Web Server with `mod_rewrite enabled`, and `AllowOverride Options` (or `All`) in your `httpd.conf` or Nginx Web Server * Latest [Phalcon Framework](https://github.com/phalcon/cphalcon) extension installed/enabled From 346562b05926cd22d2283eb54c71e931d6291829 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Wed, 18 Jan 2023 20:57:18 +0200 Subject: [PATCH 24/72] Update SessionBagProvider.php --- src/Providers/SessionBagProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Providers/SessionBagProvider.php b/src/Providers/SessionBagProvider.php index 76291835..44217829 100644 --- a/src/Providers/SessionBagProvider.php +++ b/src/Providers/SessionBagProvider.php @@ -31,7 +31,7 @@ class SessionBagProvider implements ServiceProviderInterface public function register(DiInterface $di): void { $di->set($this->providerName, function () { - return new Bag('conditions'); + return new Bag($this->getShared('session'), 'conditions'); }); } } From 30c74a5579b41b821df08a81f0382a3276cd81ba Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Wed, 18 Jan 2023 21:08:39 +0200 Subject: [PATCH 25/72] Update PermissionsController.php --- src/Controllers/PermissionsController.php | 51 +++++++++++++++++------ 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/src/Controllers/PermissionsController.php b/src/Controllers/PermissionsController.php index bb9f074e..fade55e3 100644 --- a/src/Controllers/PermissionsController.php +++ b/src/Controllers/PermissionsController.php @@ -14,7 +14,8 @@ use Vokuro\Models\Permissions; use Vokuro\Models\Profiles; - +use Phalcon\Html\Escaper; +use Phalcon\Html\Helper\Input\Select; /** * View and define permissions for the various profile levels. */ @@ -29,6 +30,7 @@ public function indexAction(): void $this->view->setTemplateBefore('private'); if ($this->request->isPost()) { + $profile = Profiles::findFirstById($this->request->getPost('profileId')); if ($profile) { if ($this->request->hasPost('permissions') && $this->request->hasPost('submit')) { @@ -67,18 +69,41 @@ public function indexAction(): void ], ]); - $profilesSelect = $this->tag->select([ - 'profileId', - $profiles, - 'using' => [ - 'id', - 'name', - ], - 'useEmpty' => true, - 'emptyText' => '...', - 'emptyValue' => '', - 'class' => 'form-control mr-sm-2', - ]); + // $profilesSelect = $this->tag->select([ + // 'profileId', + // $profiles, + // 'using' => [ + // 'id', + // 'name', + // ], + // 'useEmpty' => true, + // 'emptyText' => '...', + // 'emptyValue' => '', + // 'class' => 'form-control mr-sm-2', + // ]); + + //SEA MAN v5 edit + $escaper = new Escaper(); + $helper = new Select($escaper); + + $options = [ + 'id' => 'profileId', + 'name' => 'profileId' + ]; + + $profilesSelect = $helper(' ', PHP_EOL, $options); + $profilesSelect + ->addPlaceholder( + '...', + "0", + [], + true, + ) + ; + + foreach ($profiles as $profile) { + $profilesSelect->add($profile->name, strval($profile->id)); + } $this->view->setVar('profilesSelect', $profilesSelect); } From 11fa3955ae0710850443abefeab85dfa8cec2bb0 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Wed, 18 Jan 2023 21:42:45 +0200 Subject: [PATCH 26/72] Update PermissionsController.php --- src/Controllers/PermissionsController.php | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/Controllers/PermissionsController.php b/src/Controllers/PermissionsController.php index fade55e3..8fb46380 100644 --- a/src/Controllers/PermissionsController.php +++ b/src/Controllers/PermissionsController.php @@ -69,26 +69,13 @@ public function indexAction(): void ], ]); - // $profilesSelect = $this->tag->select([ - // 'profileId', - // $profiles, - // 'using' => [ - // 'id', - // 'name', - // ], - // 'useEmpty' => true, - // 'emptyText' => '...', - // 'emptyValue' => '', - // 'class' => 'form-control mr-sm-2', - // ]); - - //SEA MAN v5 edit $escaper = new Escaper(); $helper = new Select($escaper); $options = [ 'id' => 'profileId', - 'name' => 'profileId' + 'name' => 'profileId', + 'class' => 'form-control mr-sm-2' ]; $profilesSelect = $helper(' ', PHP_EOL, $options); @@ -98,7 +85,7 @@ public function indexAction(): void "0", [], true, - ) + ) ->selected(strval($profile->id)) ; foreach ($profiles as $profile) { From 429d7fb3dc379bc879e6e83b2196465677d6aa24 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Wed, 18 Jan 2023 22:14:25 +0200 Subject: [PATCH 27/72] Update PermissionsController.php --- src/Controllers/PermissionsController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Controllers/PermissionsController.php b/src/Controllers/PermissionsController.php index 8fb46380..53c04a7f 100644 --- a/src/Controllers/PermissionsController.php +++ b/src/Controllers/PermissionsController.php @@ -16,6 +16,7 @@ use Vokuro\Models\Profiles; use Phalcon\Html\Escaper; use Phalcon\Html\Helper\Input\Select; + /** * View and define permissions for the various profile levels. */ @@ -30,7 +31,6 @@ public function indexAction(): void $this->view->setTemplateBefore('private'); if ($this->request->isPost()) { - $profile = Profiles::findFirstById($this->request->getPost('profileId')); if ($profile) { if ($this->request->hasPost('permissions') && $this->request->hasPost('submit')) { @@ -85,12 +85,13 @@ public function indexAction(): void "0", [], true, - ) ->selected(strval($profile->id)) + ) + ->selected(strval($profile->id)) ; foreach ($profiles as $profile) { $profilesSelect->add($profile->name, strval($profile->id)); - } + } $this->view->setVar('profilesSelect', $profilesSelect); } From 573b45e3ae868fa77f460e5f099d8d3b3c458a91 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Thu, 26 Jan 2023 18:19:22 +0200 Subject: [PATCH 28/72] Update LoggerProvider.php --- src/Providers/LoggerProvider.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Providers/LoggerProvider.php b/src/Providers/LoggerProvider.php index 61d5ded0..7e356050 100644 --- a/src/Providers/LoggerProvider.php +++ b/src/Providers/LoggerProvider.php @@ -39,13 +39,20 @@ public function register(DiInterface $di): void $loggerConfigs = $di->getShared('config')->get('logger'); $di->set($this->providerName, function () use ($loggerConfigs) { - $filename = trim($loggerConfigs->get('filename'), '\\/'); - $path = rtrim($loggerConfigs->get('path'), '\\/') . DIRECTORY_SEPARATOR; - $formatter = new FormatterLine($loggerConfigs->get('format'), $loggerConfigs->get('date')); - $logger = new FileLogger($path . $filename); + $loggerAdapter = new FileLogger($loggerConfigs->get('path') . $loggerConfigs->get('filename')); - $logger->setFormatter($formatter); + $loggerFormatter = new FormatterLine($loggerConfigs->get('format'), $loggerConfigs->get('date')); + $loggerAdapter->setFormatter($loggerFormatter); + + $logger = new Logger( + 'messages', + [ + 'main' => $loggerAdapter, + ] + ); + + $logger->setLogLevel($loggerConfigs->get('logLevel')); return $logger; }); From f281eb7e99e14ed4514eee81ea02a2f7150c6930 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 11:15:59 +0200 Subject: [PATCH 29/72] Update Application.php --- src/Application.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Application.php b/src/Application.php index 2db8959a..1f9dad88 100644 --- a/src/Application.php +++ b/src/Application.php @@ -67,14 +67,17 @@ public function __construct(string $rootPath) */ public function run(): string { - $baseUri = $this->di->getShared('url')->getBaseUri(); - $position = strpos($_SERVER['REQUEST_URI'], $baseUri) + strlen($baseUri); - $uri = '/' . substr($_SERVER['REQUEST_URI'], $position); + $baseUri = $this->di->getShared('url') + ->getBaseUri() + ; + $uri = $_SERVER['REQUEST_URI'] ?? '/'; + $position = (int) strpos($uri, $baseUri) + strlen($baseUri); + $uri = '/' . substr($uri, $position); /** @var ResponseInterface $response */ $response = $this->app->handle($uri); - return (string)$response->getContent(); + return (string) $response->getContent(); } /** From 73371ecce6c9ffcc7a6167085776df836c6ed2ae Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 11:22:09 +0200 Subject: [PATCH 30/72] Update Acl.php --- src/Plugins/Acl/Acl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Plugins/Acl/Acl.php b/src/Plugins/Acl/Acl.php index 1a27912d..ff30a59c 100644 --- a/src/Plugins/Acl/Acl.php +++ b/src/Plugins/Acl/Acl.php @@ -230,9 +230,9 @@ public function rebuild(): AclMemory */ protected function getFilePath() { - if (!isset($this->filePath)) { + if (true === empty($this->filePath)) { $this->filePath = rtrim($this->config->application->cacheDir, '\\/') . '/acl/data.txt'; - } + return $this->filePath; } From ff0615c525c2efe0fa1e5691d12d56dab424a2ad Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 11:35:42 +0200 Subject: [PATCH 31/72] Update CryptProvider.php --- src/Providers/CryptProvider.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Providers/CryptProvider.php b/src/Providers/CryptProvider.php index 7af441b7..d41a778c 100644 --- a/src/Providers/CryptProvider.php +++ b/src/Providers/CryptProvider.php @@ -12,7 +12,7 @@ namespace Vokuro\Providers; -use Phalcon\Crypt; +use Phalcon\Encryption\Crypt; use Phalcon\Di\DiInterface; use Phalcon\Di\ServiceProviderInterface; @@ -31,13 +31,17 @@ class CryptProvider implements ServiceProviderInterface public function register(DiInterface $di): void { /** @var string $cryptSalt */ - $cryptSalt = $di->getShared('config')->path('application.cryptSalt'); + $cryptSalt = $di->getShared('config') + ->path('application.cryptSalt'); - $di->set($this->providerName, function () use ($cryptSalt) { - $crypt = new Crypt(); - $crypt->setKey($cryptSalt); + $di->set( + $this->providerName, + function () use ($cryptSalt) { + $crypt = new Crypt(); + $crypt->setKey($cryptSalt); - return $crypt; - }); + return $crypt; + } + ); } } From bc36edcf2c155e7f0dd0a0e4be885149e4c7f26e Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 11:37:18 +0200 Subject: [PATCH 32/72] Update LoggerProvider.php --- src/Providers/LoggerProvider.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Providers/LoggerProvider.php b/src/Providers/LoggerProvider.php index 7e356050..774256a4 100644 --- a/src/Providers/LoggerProvider.php +++ b/src/Providers/LoggerProvider.php @@ -17,6 +17,7 @@ use Phalcon\Di\ServiceProviderInterface; use Phalcon\Logger\Adapter\Stream as FileLogger; use Phalcon\Logger\Formatter\Line as FormatterLine; +use Phalcon\Logger\Logger; /** * Logger service From f4f77ff9972a8230ae30cc546e7054614e62355c Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 13:34:04 +0200 Subject: [PATCH 33/72] v.5 update Improvements added from #165 by @niden; Was resetting to default select selection - added selected option to the select after a "search" and "submit" --- src/Controllers/PermissionsController.php | 39 +++++++++++------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/Controllers/PermissionsController.php b/src/Controllers/PermissionsController.php index 53c04a7f..864fefe3 100644 --- a/src/Controllers/PermissionsController.php +++ b/src/Controllers/PermissionsController.php @@ -1,5 +1,4 @@ view->setTemplateBefore('private'); + //default select option value + $selectedOption = 0; if ($this->request->isPost()) { - $profile = Profiles::findFirstById($this->request->getPost('profileId')); + $selectedOption = $this->request->getPost('profileId'); + $profile = Profiles::findFirstById($selectedOption); if ($profile) { if ($this->request->hasPost('permissions') && $this->request->hasPost('submit')) { // Deletes the current permissions - $profile->getPermissions()->delete(); + $profile->getPermissions() + ->delete() + ; // Save the new permissions foreach ($this->request->getPost('permissions') as $permission) { @@ -69,30 +75,23 @@ public function indexAction(): void ], ]); - $escaper = new Escaper(); - $helper = new Select($escaper); - $options = [ 'id' => 'profileId', 'name' => 'profileId', 'class' => 'form-control mr-sm-2' ]; - - $profilesSelect = $helper(' ', PHP_EOL, $options); - $profilesSelect - ->addPlaceholder( - '...', - "0", - [], - true, - ) - ->selected(strval($profile->id)) + + $select = $this + ->tag + ->inputSelect(' ', PHP_EOL, $options) + ->addPlaceholder('...', '', [], true) + ->selected((string) $selectedOption) ; foreach ($profiles as $profile) { - $profilesSelect->add($profile->name, strval($profile->id)); + $select->add($profile->name, (string) $profile->id); } - $this->view->setVar('profilesSelect', $profilesSelect); + $this->view->setVar('profilesSelect', $select); } } From 49e222be9b9081f32b9cbad33d0078cda7d4abc8 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:27:10 +0200 Subject: [PATCH 34/72] Update validations.yml --- .github/workflows/validations.yml | 132 ++++++++++++++++-------------- 1 file changed, 71 insertions(+), 61 deletions(-) diff --git a/.github/workflows/validations.yml b/.github/workflows/validations.yml index 69ad839f..de970445 100644 --- a/.github/workflows/validations.yml +++ b/.github/workflows/validations.yml @@ -1,88 +1,98 @@ -name: "Validations" -on: [push, pull_request] -jobs: - validate-code-style: - name: PSR-12 Code style - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - - name: Validate composer.json and composer.lock - run: composer validate +name: Testing Suite - - name: Get Composer Cache Directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" +on: [push, pull_request] - - name: Cache composer dependencies - uses: actions/cache@v1 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- +env: + DB_HOST: '127.0.0.1' - - name: Install PHP_CodeSniffer composer package - run: composer global require "squizlabs/php_codesniffer=*" +jobs: + run: + runs-on: ubuntu-latest + name: Workflow - PHP-${{ matrix.php }} - - name: Validate PSR-12 Code Style - run: ~/.composer/vendor/bin/phpcs + services: + mysql: + image: mysql:5.7 + ports: + - "3306:3306" + env: + MYSQL_ROOT_PASSWORD: secret + MYSQL_USER: phalcon + MYSQL_DATABASE: vokuro + MYSQL_PASSWORD: secret - validate-code-static: - name: Static Code with PHP ${{ matrix.php-versions }} - runs-on: ubuntu-latest - env: - extensions: mbstring, intl, json, psr, phalcon-4.0.5 - key: cache-v2.0~14.05.2020 - needs: validate-code-style strategy: fail-fast: false matrix: - php-versions: ['7.2', '7.3', '7.4'] + php: ['8.0', '8.1'] steps: - - name: Checkout the code - uses: actions/checkout@v1 - - - name: Setup cache environment - id: cache-env - uses: shivammathur/cache-extensions@v1 - with: - php-version: ${{ matrix.php-versions }} - extensions: ${{ env.extensions }} - key: ${{ env.key }} - - - name: Cache extensions - uses: actions/cache@v1 - with: - path: ${{ steps.cache-env.outputs.dir }} - key: ${{ steps.cache-env.outputs.key }} - restore-keys: ${{ steps.cache-env.outputs.key }} - + - uses: actions/checkout@v1 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: ${{ matrix.php-versions }} - extensions: ${{ env.extensions }} + php-version: ${{ matrix.php }} tools: pecl + extensions: mbstring, intl, json, phalcon-5.0.1 + coverage: xdebug - - name: Get Composer Cache Directory + - name: Init Database + run: | + mysql -uroot -h127.0.0.1 -psecret -e 'CREATE DATABASE IF NOT EXISTS `vokuro`;' + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Get composer cache directory id: composer-cache run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - name: Cache composer dependencies - uses: actions/cache@v1 + - name: Cache dependencies + uses: actions/cache@v2 with: path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- + key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ matrix.php }}-composer- + + - name: Install Composer dependencies + run: composer install --prefer-dist --no-progress --no-suggest - - name: Install Composer dependencies with PHPStan - run: composer require --prefer-dist --no-progress --no-suggest --dev phpstan/phpstan + - name: Run PHPCS + if: always() + run: vendor/bin/phpcs - name: Run Psalm if: always() run: vendor/bin/psalm --show-info=false - - name: Run PHPStan + - name: Env file if: always() - run: vendor/bin/phpstan analyse -l 5 src + run: cp -v ./.ci/.env.ci ./.env + +# - name: Run migrations +# if: always() +# run: | +# vendor/bin/phinx migrate +# +# - name: Run seeds +# if: always() +# run: | +# vendor/bin/phinx seed:run + + - name: Run tests + if: always() + run: | + sudo php -S 0.0.0.0 -t ./.htrouter.php & + vendor/bin/codecept build + vendor/bin/codecept run unit --coverage-xml=unit-coverage.xml +# vendor/bin/codecept run functional --coverage-xml=functional-coverage.xml +# vendor/bin/codecept run acceptance --coverage-xml=acceptance-coverage.xml + +# - name: Upload to codecov +# uses: codecov/codecov-action@v3 +# with: +# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos +# directory: ./tests/_output/ +# files: unit-coverage.xml,functional-coverage.xml,acceptance-coverage.xml +# name: codecov-umbrella # optional +# fail_ci_if_error: false +# verbose: true # optional (default = false) From fac21500ead704ea8e7d0d88fb0f662418c9d955 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:30:50 +0200 Subject: [PATCH 35/72] Update composer.json --- composer.json | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 67a37023..02094539 100644 --- a/composer.json +++ b/composer.json @@ -25,21 +25,21 @@ } ], "require": { - "php": ">=7.2", + "php": ">=7.4", "ext-openssl": "*", - "ext-phalcon": ">=5.1.4", - "robmorgan/phinx": "^0.11.1", - "swiftmailer/swiftmailer": "^6.2", - "vlucas/phpdotenv": "^3.6" + "ext-phalcon": "~5.0.0", + "robmorgan/phinx": "^0.12.12", + "symfony/mailer": "^6.0", + "vlucas/phpdotenv": "^5.4" }, "require-dev": { - "codeception/codeception": "^4.1.6", - "phalcon/ide-stubs": "5.1.4", - "phpunit/phpunit": "^8.4", - "squizlabs/php_codesniffer": "3.5.5", - "vimeo/psalm": "^3.7", - "codeception/module-phpbrowser": "^1.0", - "codeception/module-asserts": "^1.2" + "codeception/codeception": "^5.0", + "codeception/module-asserts": "^3.0", + "codeception/module-phpbrowser": "^3.0", + "phalcon/ide-stubs": "^v5.0.1", + "squizlabs/php_codesniffer": "^3.7", + "vimeo/psalm": "^4.27", + "phpstan/phpstan": "^1.8" }, "suggest": { "ext-apc": "Needed to support caching ACL" @@ -56,7 +56,6 @@ "exclude": [ "/.ci", ".dockerignore", - ".travis.yml", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md" ] From 11dae1dd649b079b2e38d9bb63b0df0803dbc52d Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:35:28 +0200 Subject: [PATCH 36/72] Add files via upload --- docker/8.0/Dockerfile | 69 +++++++++++++++++++++++++++++++++++++ docker/8.0/config/extra.ini | 8 +++++ 2 files changed, 77 insertions(+) create mode 100644 docker/8.0/Dockerfile create mode 100644 docker/8.0/config/extra.ini diff --git a/docker/8.0/Dockerfile b/docker/8.0/Dockerfile new file mode 100644 index 00000000..129a9fc4 --- /dev/null +++ b/docker/8.0/Dockerfile @@ -0,0 +1,69 @@ +FROM composer:latest as composer +FROM php:8.0-fpm + +# Set working directory +WORKDIR /code + +LABEL vendor="Phalcon" \ + maintainer="Phalcon Team " \ + description="The PHP image to test the Vökuró example concepts" + +ENV PHALCON_VERSION="5.0.1" \ + PHP_VERSION="8.0" + +# Update +RUN apt update -y && \ + apt install -y \ + apt-utils \ + gettext \ + git \ + libzip-dev \ + nano \ + sudo \ + wget \ + zip + +# PECL Packages +RUN pecl install -o -f redis && \ + pecl install phalcon-${PHALCON_VERSION} \ + xdebug + +# Install PHP extensions +RUN docker-php-ext-install \ + gettext \ + pdo_mysql \ + zip + +# Install PHP extensions +RUN docker-php-ext-enable \ + opcache \ + phalcon \ + redis \ + xdebug + +# Clear cache +RUN apt-get clean && rm -rf /var/lib/apt/lists/* + +# Add user +RUN groupadd -g 1000 phalcon +RUN useradd -u 1000 -ms /bin/bash -g phalcon phalcon + +# Composer +COPY --from=composer /usr/bin/composer /usr/local/bin/composer + +# Copy existing application directory contents +COPY . /code + +# Bash script with helper aliases +COPY ./config/.bashrc /root/.bashrc +COPY ./config/.bashrc /home/phalcon/.bashrc + +# Copy existing application directory permissions +COPY --chown=phalcon:phalcon . /code + +# Change current user to phalcon +USER phalcon + +EXPOSE 80 + +CMD ["php", "-S", "0.0.0.0:80", "-t", "public/", ".htrouter.php"] diff --git a/docker/8.0/config/extra.ini b/docker/8.0/config/extra.ini new file mode 100644 index 00000000..ec632f51 --- /dev/null +++ b/docker/8.0/config/extra.ini @@ -0,0 +1,8 @@ +error_reporting = E_ALL +display_errors = "On" +display_startup_errors = "On" +log_errors = "On" +error_log = /srv/storage/logs/php_errors.log +memory_limit = 512M +apc.enable_cli = "On" +session.save_path = "/tmp" From 029a1378613397980a07278bc5bc0c477647971d Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:35:40 +0200 Subject: [PATCH 37/72] Add files via upload --- docker/8.1/Dockerfile | 69 +++++++++++++++++++++++++++++++++++++ docker/8.1/config/extra.ini | 8 +++++ 2 files changed, 77 insertions(+) create mode 100644 docker/8.1/Dockerfile create mode 100644 docker/8.1/config/extra.ini diff --git a/docker/8.1/Dockerfile b/docker/8.1/Dockerfile new file mode 100644 index 00000000..5d6c557b --- /dev/null +++ b/docker/8.1/Dockerfile @@ -0,0 +1,69 @@ +FROM composer:latest as composer +FROM php:8.1-fpm + +# Set working directory +WORKDIR /code + +LABEL vendor="Phalcon" \ + maintainer="Phalcon Team " \ + description="The PHP image to test the Vökuró example concepts" + +ENV PHALCON_VERSION="5.0.1" \ + PHP_VERSION="8.1" + +# Update +RUN apt update -y && \ + apt install -y \ + apt-utils \ + gettext \ + git \ + libzip-dev \ + nano \ + sudo \ + wget \ + zip + +# PECL Packages +RUN pecl install -o -f redis && \ + pecl install phalcon-${PHALCON_VERSION} \ + xdebug + +# Install PHP extensions +RUN docker-php-ext-install \ + gettext \ + pdo_mysql \ + zip + +# Install PHP extensions +RUN docker-php-ext-enable \ + opcache \ + phalcon \ + redis \ + xdebug + +# Clear cache +RUN apt-get clean && rm -rf /var/lib/apt/lists/* + +# Add user +RUN groupadd -g 1000 phalcon +RUN useradd -u 1000 -ms /bin/bash -g phalcon phalcon + +# Composer +COPY --from=composer /usr/bin/composer /usr/local/bin/composer + +# Copy existing application directory contents +COPY . /code + +# Bash script with helper aliases +COPY config/.bashrc /root/.bashrc +COPY config/.bashrc /home/phalcon/.bashrc + +# Copy existing application directory permissions +COPY --chown=phalcon:phalcon . /code + +# Change current user to phalcon +USER phalcon + +EXPOSE 80 + +CMD ["php", "-S", "0.0.0.0:80", "-t", "public/", ".htrouter.php"] diff --git a/docker/8.1/config/extra.ini b/docker/8.1/config/extra.ini new file mode 100644 index 00000000..ec632f51 --- /dev/null +++ b/docker/8.1/config/extra.ini @@ -0,0 +1,8 @@ +error_reporting = E_ALL +display_errors = "On" +display_startup_errors = "On" +log_errors = "On" +error_log = /srv/storage/logs/php_errors.log +memory_limit = 512M +apc.enable_cli = "On" +session.save_path = "/tmp" From 95711deb88bfdd391d06d53cbfca5b61a8184a07 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:35:59 +0200 Subject: [PATCH 38/72] Delete Dockerfile --- docker/Dockerfile | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 docker/Dockerfile diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index bdc5e6a7..00000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -# docker build -t phalconphp/vokuro:4.1.2 -f docker/Dockerfile . - -# debian/buster -FROM php:7.4-cli - -ENV VERSION=4.1.2 - -LABEL version="$VERSION" \ - vendor="Phalcon" \ - maintainer="Phalcon Team " \ - description="The PHP image to test Vökuró example concepts" - -ADD . /code - -WORKDIR /code - -RUN apt update \ - && curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh | bash \ - && apt update -y \ - && apt install php7.4-phalcon \ - && docker-php-ext-install opcache pdo_mysql mysqli 1> /dev/null \ - && printf "\\n" | pecl install --force psr 1> /dev/null \ - && docker-php-ext-enable psr \ - && docker-php-ext-enable phalcon \ - && php -m | grep -i "opcache\|mysql\|phalcon\|psr\|pdo\|mbstring" \ - && mv /code/.env.example /code/.env \ - && apt-get autoremove -y \ - && apt-get autoclean -y \ - && apt-get clean -y \ - && rm -rf /tmp/* /var/tmp/* \ - && find /var/cache/apt/archives /var/lib/apt/lists /var/cache \ - -not -name lock \ - -type f \ - -delete \ - && find /var/log -type f | while read f; do echo -n '' > ${f}; done - -EXPOSE 80 - -# docker run -p 80:80 phalconphp/vokuro:4.1.2 -CMD ["php", "-S", "0.0.0.0:80", "-t", "public/", ".htrouter.php"] From 11a34215527cbdac2d9683a7829bf244e1035c97 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:38:15 +0200 Subject: [PATCH 39/72] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ddc1bf0e..7cd007eb 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ Thanks. To run this application on your machine, you need at least: -* PHP >= 7.2 -* Phalcon >= 5.1.4 +* PHP >= 7.4 +* Phalcon >= 5.0 * MySQL >= 5.5 * Apache Web Server with `mod_rewrite enabled`, and `AllowOverride Options` (or `All`) in your `httpd.conf` or Nginx Web Server * Latest [Phalcon Framework](https://github.com/phalcon/cphalcon) extension installed/enabled @@ -28,7 +28,7 @@ To run this application on your machine, you need at least: ### Install Vökuró via composer create-project ```bash -composer create-project phalcon/vokuro /path/to/vokuro-folder "4.1.2" --prefer-dist +composer create-project phalcon/vokuro /path/to/vokuro-folder "5.0.0" --prefer-dist ``` ### Installing Dependencies via Composer @@ -44,7 +44,7 @@ Run the composer installer: ```bash cd vokuro composer install -cp .env.example .env +cp ./.ci/.env.example .env vendor/bin/phinx migrate vendor/bin/phinx seed:run ``` @@ -64,11 +64,11 @@ If you wish to check older versions or newer ones currently under development, p Phalcon is an open source project and a volunteer effort. Vökuró does not have human resources fully dedicated to the maintenance of this software. -If you want something to be improved or you want a new feature please submit a Pull Request. +If you want something to be improved, or you want a new feature please submit a Pull Request. ## Sponsors -Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/phalcon#sponsor)] +Become a sponsor and get your logo on our README on GitHub with a link to your site. [[Become a sponsor](https://opencollective.com/phalcon#sponsor)] sponsors From acf22a337a056a494552beae37d52b8d77b86883 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:40:27 +0200 Subject: [PATCH 40/72] Add files via upload --- .ci/create-db.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/create-db.sh b/.ci/create-db.sh index 907ff226..08b2199f 100755 --- a/.ci/create-db.sh +++ b/.ci/create-db.sh @@ -9,7 +9,7 @@ set -e -: "${DB_NAME:=vokuro}" +: "${DB_NAME:=phalcon_vokuro}" case "$DB_ADAPTER" in "mysql") From ab34fae2d67e7ffb72030f16d8ac24d34fc8d161 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:41:53 +0200 Subject: [PATCH 41/72] Create .env.example --- .ci/.env.example | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .ci/.env.example diff --git a/.ci/.env.example b/.ci/.env.example new file mode 100644 index 00000000..becff2ac --- /dev/null +++ b/.ci/.env.example @@ -0,0 +1,25 @@ +APP_CRYPT_SALT=eEAfR|_&G&f,+vU]:jFr!!A&+71w1Ms9~8_4L!<@[N@DyaIP_2My|:+.u>/6m,$D +APP_BASE_URI=/ +APP_PUBLIC_URL=dev.vokuro.phalcon.io + +# Supported adapters are: +# - mysql +# - sqlite +# - pgsql +DB_ADAPTER=mysql +DB_HOST=vokuro-mysql +DB_PORT=3306 +DB_USERNAME=root +DB_PASSWORD=secret +DB_NAME=phalcon_vokuro + +MAIL_FROM_NAME=Vokuro +MAIL_FROM_EMAIL=mail@dev.vokuro.phalcon.io +MAIL_SMTP_SERVER=smtp.gmail.com +MAIL_SMTP_PORT=587 +MAIL_SMTP_SECURITY=tls +MAIL_SMTP_USERNAME= +MAIL_SMTP_PASSWORD= + +CODECEPTION_URL=127.0.0.1 +CODECEPTION_PORT=8888 From 69ab8383062bebf141c260e625c5c8654119f4d7 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:42:31 +0200 Subject: [PATCH 42/72] Create .env.ci --- .ci/.env.ci | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .ci/.env.ci diff --git a/.ci/.env.ci b/.ci/.env.ci new file mode 100644 index 00000000..8d9ee1bf --- /dev/null +++ b/.ci/.env.ci @@ -0,0 +1,25 @@ +APP_CRYPT_SALT=eEAfR|_&G&f,+vU]:jFr!!A&+71w1Ms9~8_4L!<@[N@DyaIP_2My|:+.u>/6m,$D +APP_BASE_URI=/ +APP_PUBLIC_URL=dev.vokuro.phalcon.io + +# Supported adapters are: +# - mysql +# - sqlite +# - pgsql +DB_ADAPTER=mysql +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_USERNAME=root +DB_PASSWORD=secret +DB_NAME=vokuro + +MAIL_FROM_NAME=Vokuro +MAIL_FROM_EMAIL=mail@dev.vokuro.phalcon.io +MAIL_SMTP_SERVER=smtp.gmail.com +MAIL_SMTP_PORT=587 +MAIL_SMTP_SECURITY=tls +MAIL_SMTP_USERNAME= +MAIL_SMTP_PASSWORD= + +CODECEPTION_URL=127.0.0.1 +CODECEPTION_PORT=80 From ae3d79c38a003561bb17f316a5d92983485b69af Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:42:55 +0200 Subject: [PATCH 43/72] Delete install-phalcon.sh --- .ci/install-phalcon.sh | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100755 .ci/install-phalcon.sh diff --git a/.ci/install-phalcon.sh b/.ci/install-phalcon.sh deleted file mode 100755 index 1d87f3f1..00000000 --- a/.ci/install-phalcon.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash -# -# This file is part of the Phalcon Framework. -# -# (c) Phalcon Team -# -# For the full copyright and license information, please view the -# LICENSE.txt file that was distributed with this source code. - -set -e - -: "${PHALCON_VERSION:=master}" - -EXT_DIR="$(php-config --extension-dir)" -LOCAL_PATH="phalcon-$PHALCON_VERSION/php-$(php-config --vernum)/$TRAVIS_ARCH" - -# Using cache only for tagged Phalcon versions -if [ "$PHALCON_VERSION" != "master" ] && - [ "$PHALCON_VERSION" != "4.0.x" ] && - [ -f "$HOME/assets/$LOCAL_PATH/phalcon.so" ] -then - cp "$HOME/assets/$LOCAL_PATH/phalcon.so" "$EXT_DIR/phalcon.so" -else - git clone --depth=1 -v https://github.com/phalcon/cphalcon.git -b "$PHALCON_VERSION" /tmp/phalcon - cd /tmp/phalcon/build || exit 1 - ./install --phpize "$(phpenv which phpize)" --php-config "$(phpenv which php-config)" 1> /dev/null - - mkdir -p "$HOME/assets/$LOCAL_PATH" - cp "$EXT_DIR/phalcon.so" "$HOME/assets/$LOCAL_PATH/phalcon.so" -fi - -echo extension=phalcon.so >> "$(phpenv prefix)/etc/php.ini" - -"$(phpenv which php)" -m | grep -q phalcon From d90c50b31d4b6e236dd4d3c79d693582cd48e891 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:48:22 +0200 Subject: [PATCH 44/72] Update Mail.php --- src/Plugins/Mail/Mail.php | 51 ++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/src/Plugins/Mail/Mail.php b/src/Plugins/Mail/Mail.php index 02901292..f6bc9ff7 100644 --- a/src/Plugins/Mail/Mail.php +++ b/src/Plugins/Mail/Mail.php @@ -1,5 +1,4 @@ config->mail; $template = $this->getTemplate($name, $params); + $mailUsername = $mailSettings->smtp->username; + if (true !== empty($mailUsername)) { + $mailUsername .= ':' . $mailSettings->smtp->password; + } + // Create the message - $message = new Message(); + $message = new Email(); $message - ->setSubject($subject) - ->setTo($to) - ->setFrom([$mailSettings->fromEmail => $mailSettings->fromName]) - ->setBody($template, 'text/html'); + ->subject($subject) + ->from(new Address($mailSettings->fromEmail, $mailSettings->fromName)) + ->to(...$to) + ->text($template) + ; - $transport = new Smtp($mailSettings->smtp->server, $mailSettings->smtp->port, $mailSettings->smtp->security); - $transport - ->setUsername($mailSettings->smtp->username) - ->setPassword($mailSettings->smtp->password); + $dsn = sprintf( + 'smtp://%s@%s:%s', + $mailUsername, + $mailSettings->smtp->server, + $mailSettings->smtp->port + ); + $transport = Transport::fromDsn($dsn); - return (new Swift_Mailer($transport))->send($message); + (new Mailer($transport))->send($message); } /** From cbe64417ca983ab4a035a4c8fa29629a5bb23ee5 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:50:22 +0200 Subject: [PATCH 45/72] Update docker-build.yml --- .github/workflows/docker-build.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 4d5d2479..34fbedf8 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -5,8 +5,10 @@ on: [push, pull_request] jobs: build: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v1 - - name: Build Vokuro image - run: docker build -t phalconphp/vokuro:4.1.2 -f docker/Dockerfile . + - name: Build Vokuro image 8.0 + run: docker build -t phalconphp/vokuro:5.0.0-8.0 -f docker/8.0/Dockerfile . + + - name: Build Vokuro image 8.1 + run: docker build -t phalconphp/vokuro:5.0.0-8.1 -f docker/8.1/Dockerfile . From 0af48d4410ef15cd7782b575c952e561ae3a2e63 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:53:37 +0200 Subject: [PATCH 46/72] Update providers.php --- config/providers.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/providers.php b/config/providers.php index 38ed0cd4..d590b024 100644 --- a/config/providers.php +++ b/config/providers.php @@ -1,5 +1,4 @@ Date: Sat, 28 Jan 2023 15:54:06 +0200 Subject: [PATCH 47/72] Update routes.php --- config/routes.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/routes.php b/config/routes.php index a3d75bb4..682cf820 100644 --- a/config/routes.php +++ b/config/routes.php @@ -1,5 +1,4 @@ Date: Sat, 28 Jan 2023 15:55:28 +0200 Subject: [PATCH 48/72] Update config.php --- config/config.php | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/config/config.php b/config/config.php index 0c9602ae..f738533e 100644 --- a/config/config.php +++ b/config/config.php @@ -1,5 +1,4 @@ [ - 'adapter' => getenv('DB_ADAPTER'), - 'host' => getenv('DB_HOST'), - 'port' => getenv('DB_PORT'), - 'username' => getenv('DB_USERNAME'), - 'password' => getenv('DB_PASSWORD'), - 'dbname' => getenv('DB_NAME'), + 'adapter' => $_ENV['DB_ADAPTER'] ?? 'mysql', + 'host' => $_ENV['DB_HOST'] ?? '127.0.0.1', + 'port' => $_ENV['DB_PORT'] ?? 3306, + 'username' => $_ENV['DB_USERNAME'] ?? 'root', + 'password' => $_ENV['DB_PASSWORD'] ?? 'secret', + 'dbname' => $_ENV['DB_NAME'] ?? 'phalcon_vokuro', ], 'application' => [ - 'baseUri' => getenv('APP_BASE_URI'), - 'publicUrl' => getenv('APP_PUBLIC_URL'), - 'cryptSalt' => getenv('APP_CRYPT_SALT'), + 'baseUri' => $_ENV['APP_BASE_URI'] ?? '/', + 'publicUrl' => $_ENV['APP_PUBLIC_URL'] ?? 'https://vokuro.phalcon.ld', + 'cryptSalt' => $_ENV['APP_CRYPT_SALT'] ?? '', 'viewsDir' => root_path('themes/vokuro/'), 'cacheDir' => root_path('var/cache/'), 'sessionSavePath' => root_path('var/cache/session/'), ], 'mail' => [ - 'fromName' => getenv('MAIL_FROM_NAME'), - 'fromEmail' => getenv('MAIL_FROM_EMAIL'), + 'fromName' => $_ENV['MAIL_FROM_NAME'] ?? 'Vokuro Mailer', + 'fromEmail' => $_ENV['MAIL_FROM_EMAIL'] ?? 'vokuro@localhost', 'smtp' => [ - 'server' => getenv('MAIL_SMTP_SERVER'), - 'port' => getenv('MAIL_SMTP_PORT'), - 'security' => getenv('MAIL_SMTP_SECURITY'), - 'username' => getenv('MAIL_SMTP_USERNAME'), - 'password' => getenv('MAIL_SMTP_PASSWORD'), + 'server' => $_ENV['MAIL_SMTP_SERVER'] ?? 'localhost', + 'port' => $_ENV['MAIL_SMTP_PORT'] ?? 25, + 'security' => $_ENV['MAIL_SMTP_SECURITY'] ?? '', + 'username' => $_ENV['MAIL_SMTP_USERNAME'] ?? '', + 'password' => $_ENV['MAIL_SMTP_PASSWORD'] ?? '', ], ], 'logger' => [ 'path' => root_path('var/logs/'), - 'format' => '%date% [%type%] %message%', + 'format' => '%date% [%level%] %message%', 'date' => 'D j H:i:s', - 'logLevel' => Logger::DEBUG, + 'logLevel' => Enum::DEBUG, 'filename' => 'application.log', ], - // Set to false to disable sending emails (for use in test environment) + // Set to false, to disable sending emails (for use in test environment) 'useMail' => true, ]; From 145909b5432313bfa39f59eb823564dccfe3afc4 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:56:14 +0200 Subject: [PATCH 49/72] Update acl.php --- config/acl.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/acl.php b/config/acl.php index 3751a2a1..67c5f8eb 100644 --- a/config/acl.php +++ b/config/acl.php @@ -1,5 +1,4 @@ [ 'users' => [ From 01b2dc0d7e2aa794466b436701a2a645637510a1 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:58:10 +0200 Subject: [PATCH 50/72] Update index.php --- public/index.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/index.php b/public/index.php index 2e0fdaf1..2c510298 100644 --- a/public/index.php +++ b/public/index.php @@ -9,6 +9,9 @@ * the LICENSE file that was distributed with this source code. */ +declare(strict_types=1); + +use Dotenv\Dotenv; use Vokuro\Application as VokuroApplication; error_reporting(E_ALL); @@ -20,7 +23,7 @@ /** * Load .env configurations */ - Dotenv\Dotenv::create($rootPath)->load(); + (Dotenv::createImmutable($rootPath))->load(); /** * Run Vökuró! From 7d6781f499be8cbb14522ec032c8447c443b9fb1 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:58:47 +0200 Subject: [PATCH 51/72] Update phinx.php --- phinx.php | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/phinx.php b/phinx.php index 0cbf3e62..bf727490 100644 --- a/phinx.php +++ b/phinx.php @@ -2,32 +2,39 @@ use Dotenv\Dotenv; -$dotenv = Dotenv::create(__DIR__); -$dotenv->load(); +(Dotenv::createImmutable(__DIR__))->load(); -return -[ - 'paths' => [ +$adapter = strtolower($_ENV['DB_ADAPTER'] ?? 'mysql'); +$host = $_ENV['DB_HOST'] ?? 'localhost'; +$user = $_ENV['DB_USERNAME'] ?? 'root'; +$pass = $_ENV['DB_PASSWORD'] ?? ''; +$port = $_ENV['DB_PORT'] ?? 3306; +$name = $_ENV['DB_NAME'] ?? 'phalcon_vokuro'; + +if ('sqlite' === $adapter) { + $name = '%%PHINX_CONFIG_DIR%%/db/' . $name; +} + +return [ + 'paths' => [ 'migrations' => [ 'Vokuro\\Migrations' => '%%PHINX_CONFIG_DIR%%/db/migrations' ], - 'seeds' => [ + 'seeds' => [ 'Vokuro\\Seeds' => '%%PHINX_CONFIG_DIR%%/db/seeds', ], ], - 'environments' => [ + 'environments' => [ 'default_migration_table' => 'phinxlog', - 'default_database' => 'development', - 'development' => [ - 'adapter' => strtolower(getenv('DB_ADAPTER')), - 'host' => getenv('DB_HOST'), - 'name' => strtolower(getenv('DB_ADAPTER')) === 'sqlite' ? - '%%PHINX_CONFIG_DIR%%/db/' . getenv('DB_NAME') : - getenv('DB_NAME'), - 'user' => getenv('DB_USERNAME'), - 'pass' => getenv('DB_PASSWORD'), - 'port' => getenv('DB_PORT'), - 'charset' => 'utf8', + 'default_database' => 'development', + 'development' => [ + 'adapter' => $adapter, + 'host' => $host, + 'name' => $name, + 'user' => $user, + 'pass' => $pass, + 'port' => $port, + 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', ], ], From fadcaac820e615b109ea95fde49eb91b397d62be Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 15:59:45 +0200 Subject: [PATCH 52/72] Update codeception.yml --- codeception.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codeception.yml b/codeception.yml index e6cc38eb..66f5e65e 100644 --- a/codeception.yml +++ b/codeception.yml @@ -29,7 +29,7 @@ extensions: # Get params from .env file params: - - tests/.env.test + - .env error_level: "E_ALL" From c0682edff701750bca490de266633be387295e5d Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 19:03:54 +0200 Subject: [PATCH 53/72] Update phpstan.neon.dist --- phpstan.neon.dist | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index f6c3a616..69e04b8e 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,6 +1,9 @@ parameters: - bootstrap: %rootDir%/../../../vendor/autoload.php - + level: 5 + paths: + - src + bootstrapFiles: + - %rootDir%/../../../vendor/autoload.php ignoreErrors: - '#Parameter \#1 \$eventsManager of method Phalcon#' reportUnmatchedIgnoredErrors: false From 592813b6a5bfee3f3e786526b2e163e16d7c5aa4 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 19:04:35 +0200 Subject: [PATCH 54/72] Update psalm.xml.dist --- psalm.xml.dist | 1 - 1 file changed, 1 deletion(-) diff --git a/psalm.xml.dist b/psalm.xml.dist index e45c0a31..57dab7d0 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -1,6 +1,5 @@ Date: Sat, 28 Jan 2023 19:09:22 +0200 Subject: [PATCH 55/72] Delete tests directory --- tests/.env.test | 25 ---- tests/_data/.gitkeep | 0 tests/_output/.gitignore | 2 - tests/_support/AcceptanceTester.php | 26 ----- tests/_support/FunctionalTester.php | 26 ----- tests/_support/Helper/Acceptance.php | 30 ----- tests/_support/Helper/Functional.php | 10 -- tests/_support/Helper/Unit.php | 10 -- tests/_support/UnitTester.php | 26 ----- tests/_support/_generated/.gitignore | 2 - tests/acceptance.suite.yml | 15 --- .../controllers/AboutControllerCest.php | 18 --- .../controllers/IndexControllerCest.php | 18 --- .../controllers/PermissionsControllerCest.php | 50 -------- .../controllers/PrivacyControllerCest.php | 18 --- .../controllers/ProfilesControllerCest.php | 107 ----------------- .../controllers/SessionControllerCest.php | 60 ---------- .../controllers/TermsControllerCest.php | 18 --- .../controllers/UsersControllerCest.php | 108 ------------------ tests/functional.suite.yml | 13 --- .../forms/ChangePasswordFormTest.php | 76 ------------ .../forms/ForgotPasswordFormTest.php | 42 ------- tests/functional/forms/LoginFormTest.php | 57 --------- tests/functional/forms/ProfilesFormTest.php | 41 ------- tests/unit.suite.yml | 10 -- tests/unit/ApplicationTest.php | 18 --- .../unit/controllers/AboutControllerTest.php | 18 --- tests/unit/controllers/ControllerBaseTest.php | 18 --- .../unit/controllers/IndexControllerTest.php | 18 --- .../controllers/PermissionsControllerTest.php | 18 --- .../controllers/PrivacyControllerTest.php | 18 --- .../controllers/ProfilesControllerTest.php | 18 --- .../controllers/SessionControllerTest.php | 18 --- .../unit/controllers/TermsControllerTest.php | 18 --- .../controllers/UserControlControllerTest.php | 18 --- .../unit/controllers/UsersControllerTest.php | 18 --- tests/unit/forms/ChangePasswordFormTest.php | 18 --- tests/unit/forms/ForgotPasswordFormTest.php | 18 --- tests/unit/forms/LoginFormTest.php | 18 --- tests/unit/forms/ProfilesFormTest.php | 18 --- tests/unit/forms/SignUpFormTest.php | 18 --- tests/unit/forms/UsersFormTest.php | 18 --- tests/unit/models/EmailConfirmationsTest.php | 18 --- tests/unit/models/FailedLoginsTest.php | 18 --- tests/unit/models/PasswordChangesTest.php | 18 --- tests/unit/models/PermissionsTest.php | 18 --- tests/unit/models/ProfilesTest.php | 18 --- tests/unit/models/RememberTokensTest.php | 18 --- tests/unit/models/ResetPasswordsTest.php | 18 --- tests/unit/models/SuccessLoginsTest.php | 18 --- tests/unit/models/UsersTest.php | 18 --- tests/unit/plugins/acl/AclTest.php | 18 --- tests/unit/plugins/auth/AuthTest.php | 18 --- tests/unit/plugins/mail/MailTest.php | 18 --- tests/unit/providers/AclProviderTest.php | 18 --- tests/unit/providers/AssetsProviderTest.php | 18 --- tests/unit/providers/AuthProviderTest.php | 18 --- tests/unit/providers/ConfigProviderTest.php | 18 --- tests/unit/providers/CryptProviderTest.php | 18 --- tests/unit/providers/DbProviderTest.php | 18 --- .../unit/providers/DispatcherProviderTest.php | 18 --- tests/unit/providers/FlashProviderTest.php | 18 --- tests/unit/providers/LoggerProviderTest.php | 18 --- tests/unit/providers/MailProviderTest.php | 18 --- .../providers/ModelsMetadataProviderTest.php | 18 --- tests/unit/providers/RouterProviderTest.php | 18 --- tests/unit/providers/SecurityProviderTest.php | 18 --- .../unit/providers/SessionBagProviderTest.php | 18 --- tests/unit/providers/SessionProviderTest.php | 18 --- tests/unit/providers/UrlProviderTest.php | 18 --- tests/unit/providers/ViewProviderTest.php | 18 --- 71 files changed, 1636 deletions(-) delete mode 100644 tests/.env.test delete mode 100644 tests/_data/.gitkeep delete mode 100644 tests/_output/.gitignore delete mode 100644 tests/_support/AcceptanceTester.php delete mode 100644 tests/_support/FunctionalTester.php delete mode 100644 tests/_support/Helper/Acceptance.php delete mode 100644 tests/_support/Helper/Functional.php delete mode 100644 tests/_support/Helper/Unit.php delete mode 100644 tests/_support/UnitTester.php delete mode 100644 tests/_support/_generated/.gitignore delete mode 100644 tests/acceptance.suite.yml delete mode 100644 tests/acceptance/controllers/AboutControllerCest.php delete mode 100644 tests/acceptance/controllers/IndexControllerCest.php delete mode 100644 tests/acceptance/controllers/PermissionsControllerCest.php delete mode 100644 tests/acceptance/controllers/PrivacyControllerCest.php delete mode 100644 tests/acceptance/controllers/ProfilesControllerCest.php delete mode 100644 tests/acceptance/controllers/SessionControllerCest.php delete mode 100644 tests/acceptance/controllers/TermsControllerCest.php delete mode 100644 tests/acceptance/controllers/UsersControllerCest.php delete mode 100644 tests/functional.suite.yml delete mode 100644 tests/functional/forms/ChangePasswordFormTest.php delete mode 100644 tests/functional/forms/ForgotPasswordFormTest.php delete mode 100644 tests/functional/forms/LoginFormTest.php delete mode 100644 tests/functional/forms/ProfilesFormTest.php delete mode 100644 tests/unit.suite.yml delete mode 100644 tests/unit/ApplicationTest.php delete mode 100644 tests/unit/controllers/AboutControllerTest.php delete mode 100644 tests/unit/controllers/ControllerBaseTest.php delete mode 100644 tests/unit/controllers/IndexControllerTest.php delete mode 100644 tests/unit/controllers/PermissionsControllerTest.php delete mode 100644 tests/unit/controllers/PrivacyControllerTest.php delete mode 100644 tests/unit/controllers/ProfilesControllerTest.php delete mode 100644 tests/unit/controllers/SessionControllerTest.php delete mode 100644 tests/unit/controllers/TermsControllerTest.php delete mode 100644 tests/unit/controllers/UserControlControllerTest.php delete mode 100644 tests/unit/controllers/UsersControllerTest.php delete mode 100644 tests/unit/forms/ChangePasswordFormTest.php delete mode 100644 tests/unit/forms/ForgotPasswordFormTest.php delete mode 100644 tests/unit/forms/LoginFormTest.php delete mode 100644 tests/unit/forms/ProfilesFormTest.php delete mode 100644 tests/unit/forms/SignUpFormTest.php delete mode 100644 tests/unit/forms/UsersFormTest.php delete mode 100644 tests/unit/models/EmailConfirmationsTest.php delete mode 100644 tests/unit/models/FailedLoginsTest.php delete mode 100644 tests/unit/models/PasswordChangesTest.php delete mode 100644 tests/unit/models/PermissionsTest.php delete mode 100644 tests/unit/models/ProfilesTest.php delete mode 100644 tests/unit/models/RememberTokensTest.php delete mode 100644 tests/unit/models/ResetPasswordsTest.php delete mode 100644 tests/unit/models/SuccessLoginsTest.php delete mode 100644 tests/unit/models/UsersTest.php delete mode 100644 tests/unit/plugins/acl/AclTest.php delete mode 100644 tests/unit/plugins/auth/AuthTest.php delete mode 100644 tests/unit/plugins/mail/MailTest.php delete mode 100644 tests/unit/providers/AclProviderTest.php delete mode 100644 tests/unit/providers/AssetsProviderTest.php delete mode 100644 tests/unit/providers/AuthProviderTest.php delete mode 100644 tests/unit/providers/ConfigProviderTest.php delete mode 100644 tests/unit/providers/CryptProviderTest.php delete mode 100644 tests/unit/providers/DbProviderTest.php delete mode 100644 tests/unit/providers/DispatcherProviderTest.php delete mode 100644 tests/unit/providers/FlashProviderTest.php delete mode 100644 tests/unit/providers/LoggerProviderTest.php delete mode 100644 tests/unit/providers/MailProviderTest.php delete mode 100644 tests/unit/providers/ModelsMetadataProviderTest.php delete mode 100644 tests/unit/providers/RouterProviderTest.php delete mode 100644 tests/unit/providers/SecurityProviderTest.php delete mode 100644 tests/unit/providers/SessionBagProviderTest.php delete mode 100644 tests/unit/providers/SessionProviderTest.php delete mode 100644 tests/unit/providers/UrlProviderTest.php delete mode 100644 tests/unit/providers/ViewProviderTest.php diff --git a/tests/.env.test b/tests/.env.test deleted file mode 100644 index c2f7250d..00000000 --- a/tests/.env.test +++ /dev/null @@ -1,25 +0,0 @@ -APP_CRYPT_SALT=eEAfR|_&G&f,+vU]:jFr!!A&+71w1Ms9~8_4L!<@[N@DyaIP_2My|:+.u>/6m,$D -APP_BASE_URI=/ -APP_PUBLIC_URL=dev.vokuro.phalcon.io - -# Supported adapters are: -# - mysql -# - sqlite -# - pgsql -DB_ADAPTER=mysql -DB_HOST=127.0.0.1 -DB_PORT=3306 -DB_USERNAME=root -DB_PASSWORD= -DB_NAME=vokuro - -MAIL_FROM_NAME=Vokuro -MAIL_FROM_EMAIL=mail@dev.vokuro.phalcon.io -MAIL_SMTP_SERVER=smtp.gmail.com -MAIL_SMTP_PORT=587 -MAIL_SMTP_SECURITY=tls -MAIL_SMTP_USERNAME= -MAIL_SMTP_PASSWORD= - -CODECEPTION_URL=127.0.0.1 -CODECEPTION_PORT=8888 diff --git a/tests/_data/.gitkeep b/tests/_data/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/_output/.gitignore b/tests/_output/.gitignore deleted file mode 100644 index c96a04f0..00000000 --- a/tests/_output/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php deleted file mode 100644 index 95c00ec2..00000000 --- a/tests/_support/AcceptanceTester.php +++ /dev/null @@ -1,26 +0,0 @@ -setAutoExit(false); - $app->run(new StringInput('rollback -e testing -t 0'), new NullOutput()); - $app->run(new StringInput('migrate -e testing'), new NullOutput()); - $app->run(new StringInput('seed:run -e testing'), new NullOutput()); - } -} diff --git a/tests/_support/Helper/Functional.php b/tests/_support/Helper/Functional.php deleted file mode 100644 index 4183cb0a..00000000 --- a/tests/_support/Helper/Functional.php +++ /dev/null @@ -1,10 +0,0 @@ -amOnPage('/about'); - $I->see('About this Demo'); - } -} diff --git a/tests/acceptance/controllers/IndexControllerCest.php b/tests/acceptance/controllers/IndexControllerCest.php deleted file mode 100644 index 5c13142b..00000000 --- a/tests/acceptance/controllers/IndexControllerCest.php +++ /dev/null @@ -1,18 +0,0 @@ -amOnPage('/'); - $I->see('Welcome!'); - } -} diff --git a/tests/acceptance/controllers/PermissionsControllerCest.php b/tests/acceptance/controllers/PermissionsControllerCest.php deleted file mode 100644 index f158680a..00000000 --- a/tests/acceptance/controllers/PermissionsControllerCest.php +++ /dev/null @@ -1,50 +0,0 @@ -amOnPage('/session/login'); - $I->see('Log In'); - $I->fillField('email', 'bob@phalcon.io'); - $I->fillField('password', 'password1'); - $I->click('//form/*[@type="submit"]'); - $I->see('Search users'); - - $this->cookie = $I->grabCookie('PHPSESSID'); - } - - /** - * @depends login - * @param AcceptanceTester $I - */ - public function testIndex(AcceptanceTester $I): void - { - $I->setCookie('PHPSESSID', $this->cookie); - - $I->amOnPage('/permissions'); - $I->see('Manage Permissions'); - } - - /** - * @param AcceptanceTester $I - */ - public function testIndexAsGuest(AcceptanceTester $I): void - { - $I->amOnPage('/permissions'); - $I->see('You don\'t have access to this module: private'); - } -} diff --git a/tests/acceptance/controllers/PrivacyControllerCest.php b/tests/acceptance/controllers/PrivacyControllerCest.php deleted file mode 100644 index 4ff4fa9c..00000000 --- a/tests/acceptance/controllers/PrivacyControllerCest.php +++ /dev/null @@ -1,18 +0,0 @@ -amOnPage('/privacy'); - $I->see('Privacy'); - } -} diff --git a/tests/acceptance/controllers/ProfilesControllerCest.php b/tests/acceptance/controllers/ProfilesControllerCest.php deleted file mode 100644 index c73738a7..00000000 --- a/tests/acceptance/controllers/ProfilesControllerCest.php +++ /dev/null @@ -1,107 +0,0 @@ -amOnPage('/session/login'); - $I->see('Log In'); - $I->fillField('email', 'bob@phalcon.io'); - $I->fillField('password', 'password1'); - $I->click('//form/*[@type="submit"]'); - $I->see('Search users'); - - $this->cookie = $I->grabCookie('PHPSESSID'); - } - - /** - * @param AcceptanceTester $I - */ - public function testIndexAsGuest(AcceptanceTester $I): void - { - $I->amOnPage('/profiles'); - $I->see('You don\'t have access to this module: private'); - } - - /** - * @depends login - * @param AcceptanceTester $I - */ - public function testIndex(AcceptanceTester $I): void - { - $I->setCookie('PHPSESSID', $this->cookie); - - $I->amOnPage('/profiles'); - $I->see('Search profiles'); - } - - /** - * @depends login - * @param AcceptanceTester $I - */ - public function testSearch(AcceptanceTester $I): void - { - $I->setCookie('PHPSESSID', $this->cookie); - - $I->amOnPage('/profiles'); - $I->click('Search'); - $I->see('Found profiles'); - } - - /** - * @depends login - * @param AcceptanceTester $I - */ - public function testCreate(AcceptanceTester $I): void - { - $I->setCookie('PHPSESSID', $this->cookie); - - $I->amOnPage('/profiles/create'); - $I->see('Create a Profile'); - } - - /** - * @depends login - * @param AcceptanceTester $I - */ - public function testEdit(AcceptanceTester $I): void - { - $I->setCookie('PHPSESSID', $this->cookie); - - $I->amOnPage('/profiles/edit/1'); - $I->see('Edit profile'); - } - - /** - * @depends login - * @param AcceptanceTester $I - */ - public function testDelete(AcceptanceTester $I): void - { - $I->setCookie('PHPSESSID', $this->cookie); - - $I->amOnPage('/profiles'); - $I->click('Search'); - $I->see('Found profiles'); - $I->see('Administrators'); - - $I->click('//a[@href="/profiles/delete/1"]'); - - $I->amOnPage('/profiles'); - $I->see('Search'); - $I->cantSee('Administrators'); - } -} diff --git a/tests/acceptance/controllers/SessionControllerCest.php b/tests/acceptance/controllers/SessionControllerCest.php deleted file mode 100644 index c728ae95..00000000 --- a/tests/acceptance/controllers/SessionControllerCest.php +++ /dev/null @@ -1,60 +0,0 @@ -amOnPage('/session/login'); - $I->see('Log In'); - } - - /** - * @param AcceptanceTester $I - */ - public function testSignup(AcceptanceTester $I): void - { - $I->amOnPage('/session/signup'); - $I->see('Sign up'); - } - - /** - * @param AcceptanceTester $I - */ - public function testForgotPassword(AcceptanceTester $I): void - { - $I->amOnPage('/session/forgotPassword'); - $I->see('Forgot Password?'); - } - - /** - * @param AcceptanceTester $I - */ - public function testLogoutAsGuest(AcceptanceTester $I): void - { - $I->amOnPage('/session/logout'); - $I->see('Welcome!'); - } - - /** - * @param AcceptanceTester $I - */ - public function testLogoutAsUser(AcceptanceTester $I): void - { - $I->amOnPage('/session/login'); - $I->see('Log In'); - $I->fillField('email', 'bob@phalcon.io'); - $I->fillField('password', 'password1'); - $I->click('//form/*[@type="submit"]'); - $I->see('Search users'); - $I->amOnPage('/session/logout'); - $I->see('Welcome!'); - } -} diff --git a/tests/acceptance/controllers/TermsControllerCest.php b/tests/acceptance/controllers/TermsControllerCest.php deleted file mode 100644 index e2e19cd0..00000000 --- a/tests/acceptance/controllers/TermsControllerCest.php +++ /dev/null @@ -1,18 +0,0 @@ -amOnPage('/terms'); - $I->see('Terms'); - } -} diff --git a/tests/acceptance/controllers/UsersControllerCest.php b/tests/acceptance/controllers/UsersControllerCest.php deleted file mode 100644 index bf1b79d7..00000000 --- a/tests/acceptance/controllers/UsersControllerCest.php +++ /dev/null @@ -1,108 +0,0 @@ -amOnPage('/session/login'); - $I->see('Log In'); - $I->fillField('email', 'bob@phalcon.io'); - $I->fillField('password', 'password1'); - $I->click('//form/*[@type="submit"]'); - $I->see('Search users'); - - $this->cookie = $I->grabCookie('PHPSESSID'); - } - - /** - * @param AcceptanceTester $I - */ - public function testIndexAsGuest(AcceptanceTester $I): void - { - $I->amOnPage('/users'); - $I->see('You don\'t have access to this module: private'); - } - - /** - * @depends login - * @param AcceptanceTester $I - */ - public function testIndex(AcceptanceTester $I): void - { - $I->setCookie('PHPSESSID', $this->cookie); - - $I->amOnPage('/users'); - $I->see('Search users'); - } - - /** - * @depends login - * @param AcceptanceTester $I - */ - public function testSearch(AcceptanceTester $I): void - { - $I->setCookie('PHPSESSID', $this->cookie); - - $I->amOnPage('/users/search'); - $I->see('Found users'); - } - - /** - * @depends login - * @param AcceptanceTester $I - */ - public function testCreate(AcceptanceTester $I): void - { - $I->setCookie('PHPSESSID', $this->cookie); - - $I->amOnPage('/users/create'); - $I->see('Create a User'); - } - - /** - * @depends login - * @param AcceptanceTester $I - */ - public function testEdit(AcceptanceTester $I): void - { - $I->setCookie('PHPSESSID', $this->cookie); - - $I->amOnPage('/users/edit/1'); - $I->see('Edit users'); - } - - /** - * @depends login - * @param AcceptanceTester $I - */ - public function testDelete(AcceptanceTester $I): void - { - $I->setCookie('PHPSESSID', $this->cookie); - - $I->amOnPage('/users/delete/4'); - $I->amOnPage('/users/search'); - $I->cantSee('Yukimi Nagano'); - } - - /** - * @depends login - * @param AcceptanceTester $I - */ - public function testChangePassword(AcceptanceTester $I): void - { - $I->setCookie('PHPSESSID', $this->cookie); - - $I->amOnPage('/users/changePassword'); - $I->see('Change Password'); - } -} diff --git a/tests/functional.suite.yml b/tests/functional.suite.yml deleted file mode 100644 index 31e19044..00000000 --- a/tests/functional.suite.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Codeception Test Suite Configuration -# -# Suite for functional tests -# Emulate web requests and make application process them -# Include one of framework modules (Symfony2, Yii2, Laravel5) to use it -# Remove this suite if you don't use frameworks - -actor: FunctionalTester -modules: - enabled: - # add a framework module here - - \Helper\Functional - step_decorators: ~ diff --git a/tests/functional/forms/ChangePasswordFormTest.php b/tests/functional/forms/ChangePasswordFormTest.php deleted file mode 100644 index 5ec6265e..00000000 --- a/tests/functional/forms/ChangePasswordFormTest.php +++ /dev/null @@ -1,76 +0,0 @@ - '', - self::CONFIRM_PASS_KEY => '', - ]; - $shortPasswordData = [ - self::PASS_KEY => '123', - self::CONFIRM_PASS_KEY => '123', - ]; - $emptyConfirmPasswordData = [ - self::PASS_KEY => 'valid password empty config', - ]; - $missMatchConfigPasswordData = [ - self::PASS_KEY => '123456780', - self::CONFIRM_PASS_KEY => '123456789', - ]; - $correctData1 = [ - self::PASS_KEY => '12345678', - self::CONFIRM_PASS_KEY => '12345678', - ]; - $correctData2 = [ - self::PASS_KEY => 'valid password', - self::CONFIRM_PASS_KEY => 'valid password' - ]; - $correctData3 = [ - self::PASS_KEY => '(*%^%$#@#$%^', - self::CONFIRM_PASS_KEY => '(*%^%$#@#$%^', - ]; - - return [ - [$emptyData, 3, false], - [$emptyPasswordData, 3, false], - [$shortPasswordData, 1, false], - [$emptyConfirmPasswordData, 2, false], - [$missMatchConfigPasswordData, 1, false], - [$correctData1, 0, true], - [$correctData2, 0, true], - [$correctData3, 0, true], - ]; - } - - /** - * @dataProvider dataProvider - * - * @param array $data - * @param int $errorsCount - * @param bool $expected - */ - public function testValidations(array $data, int $errorsCount, bool $expected): void - { - $form = new ChangePasswordForm(); - $isValid = $form->isValid($data); - $messages = $form->getMessages(); - - $this->assertEquals($expected, $isValid); - $this->assertEquals($errorsCount, count($messages)); - } -} diff --git a/tests/functional/forms/ForgotPasswordFormTest.php b/tests/functional/forms/ForgotPasswordFormTest.php deleted file mode 100644 index 9533f2f7..00000000 --- a/tests/functional/forms/ForgotPasswordFormTest.php +++ /dev/null @@ -1,42 +0,0 @@ - 'invalid email'], 1, false], - [[self::EMAIL_KEY => 'valid@email.com'], 0, true], - [[self::EMAIL_KEY => 'bob@phalcon.io'], 0, true], - ]; - } - - /** - * @dataProvider dataProvider - * - * @param array $data - * @param int $errorsCount - * @param bool $expected - */ - public function testValidations(array $data, int $errorsCount, bool $expected): void - { - $form = new ForgotPasswordForm(); - $isValid = $form->isValid($data); - $messages = $form->getMessages(); - - $this->assertEquals($expected, $isValid); - $this->assertEquals($errorsCount, count($messages)); - } -} diff --git a/tests/functional/forms/LoginFormTest.php b/tests/functional/forms/LoginFormTest.php deleted file mode 100644 index dc88c37c..00000000 --- a/tests/functional/forms/LoginFormTest.php +++ /dev/null @@ -1,57 +0,0 @@ -register($di); - - $emptyData = []; - $incorrectCsrfData = [ - self::EMAIL_KEY => 'bob@phalcon.io', - self::PASS_KEY => 'password1', - self::CSRF_KEY => 'invalid', - ]; - - return [ - [$emptyData, 4, false], - [$incorrectCsrfData, 1, false], - ]; - } - - /** - * @dataProvider dataProvider - * - * @param array $data - * @param int $errorsCount - * @param bool $expected - */ - public function testValidations(array $data, int $errorsCount, bool $expected): void - { - $form = new LoginForm(); - $isValid = $form->isValid($data); - $messages = $form->getMessages(); - - $this->assertEquals($expected, $isValid); - $this->assertEquals($errorsCount, count($messages)); - } -} diff --git a/tests/functional/forms/ProfilesFormTest.php b/tests/functional/forms/ProfilesFormTest.php deleted file mode 100644 index 2df5ad8a..00000000 --- a/tests/functional/forms/ProfilesFormTest.php +++ /dev/null @@ -1,41 +0,0 @@ - ''], 1, false], - [[self::NAME_KEY => 'valid name'], 0, true], - ]; - } - - /** - * @dataProvider dataProvider - * - * @param array $data - * @param int $errorsCount - * @param bool $expected - */ - public function testValidations(array $data, int $errorsCount, bool $expected): void - { - $form = new ProfilesForm(); - $isValid = $form->isValid($data); - $messages = $form->getMessages(); - - $this->assertEquals($expected, $isValid); - $this->assertEquals($errorsCount, count($messages)); - } -} diff --git a/tests/unit.suite.yml b/tests/unit.suite.yml deleted file mode 100644 index a2f1803d..00000000 --- a/tests/unit.suite.yml +++ /dev/null @@ -1,10 +0,0 @@ -# Codeception Test Suite Configuration -# -# Suite for unit or integration tests. - -actor: UnitTester -modules: - enabled: - - Asserts - - \Helper\Unit - step_decorators: ~ diff --git a/tests/unit/ApplicationTest.php b/tests/unit/ApplicationTest.php deleted file mode 100644 index 924d20c2..00000000 --- a/tests/unit/ApplicationTest.php +++ /dev/null @@ -1,18 +0,0 @@ -constructEmptyExcept(Application::class, 'getRootPath', ['rootPath' => $rootPath]); - - $this->assertEquals($rootPath, $class->getRootPath()); - } -} diff --git a/tests/unit/controllers/AboutControllerTest.php b/tests/unit/controllers/AboutControllerTest.php deleted file mode 100644 index 69adbc7b..00000000 --- a/tests/unit/controllers/AboutControllerTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(AboutController::class); - - $this->assertInstanceOf(Controller::class, $class); - } -} diff --git a/tests/unit/controllers/ControllerBaseTest.php b/tests/unit/controllers/ControllerBaseTest.php deleted file mode 100644 index ab9d7e48..00000000 --- a/tests/unit/controllers/ControllerBaseTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(ControllerBase::class); - - $this->assertInstanceOf(Controller::class, $class); - } -} diff --git a/tests/unit/controllers/IndexControllerTest.php b/tests/unit/controllers/IndexControllerTest.php deleted file mode 100644 index eaf67aff..00000000 --- a/tests/unit/controllers/IndexControllerTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(IndexController::class); - - $this->assertInstanceOf(Controller::class, $class); - } -} diff --git a/tests/unit/controllers/PermissionsControllerTest.php b/tests/unit/controllers/PermissionsControllerTest.php deleted file mode 100644 index f2496cab..00000000 --- a/tests/unit/controllers/PermissionsControllerTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(PermissionsController::class); - - $this->assertInstanceOf(Controller::class, $class); - } -} diff --git a/tests/unit/controllers/PrivacyControllerTest.php b/tests/unit/controllers/PrivacyControllerTest.php deleted file mode 100644 index e98c6297..00000000 --- a/tests/unit/controllers/PrivacyControllerTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(PrivacyController::class); - - $this->assertInstanceOf(Controller::class, $class); - } -} diff --git a/tests/unit/controllers/ProfilesControllerTest.php b/tests/unit/controllers/ProfilesControllerTest.php deleted file mode 100644 index 5eadb078..00000000 --- a/tests/unit/controllers/ProfilesControllerTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(ProfilesController::class); - - $this->assertInstanceOf(Controller::class, $class); - } -} diff --git a/tests/unit/controllers/SessionControllerTest.php b/tests/unit/controllers/SessionControllerTest.php deleted file mode 100644 index 2cb77791..00000000 --- a/tests/unit/controllers/SessionControllerTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(SessionController::class); - - $this->assertInstanceOf(Controller::class, $class); - } -} diff --git a/tests/unit/controllers/TermsControllerTest.php b/tests/unit/controllers/TermsControllerTest.php deleted file mode 100644 index 31fd9152..00000000 --- a/tests/unit/controllers/TermsControllerTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(TermsController::class); - - $this->assertInstanceOf(Controller::class, $class); - } -} diff --git a/tests/unit/controllers/UserControlControllerTest.php b/tests/unit/controllers/UserControlControllerTest.php deleted file mode 100644 index 698a62a4..00000000 --- a/tests/unit/controllers/UserControlControllerTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(UserControlController::class); - - $this->assertInstanceOf(Controller::class, $class); - } -} diff --git a/tests/unit/controllers/UsersControllerTest.php b/tests/unit/controllers/UsersControllerTest.php deleted file mode 100644 index ed4a8392..00000000 --- a/tests/unit/controllers/UsersControllerTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(UsersController::class); - - $this->assertInstanceOf(Controller::class, $class); - } -} diff --git a/tests/unit/forms/ChangePasswordFormTest.php b/tests/unit/forms/ChangePasswordFormTest.php deleted file mode 100644 index 0f545e63..00000000 --- a/tests/unit/forms/ChangePasswordFormTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(ChangePasswordForm::class); - - $this->assertInstanceOf(Form::class, $class); - } -} diff --git a/tests/unit/forms/ForgotPasswordFormTest.php b/tests/unit/forms/ForgotPasswordFormTest.php deleted file mode 100644 index dbf67536..00000000 --- a/tests/unit/forms/ForgotPasswordFormTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(ForgotPasswordForm::class); - - $this->assertInstanceOf(Form::class, $class); - } -} diff --git a/tests/unit/forms/LoginFormTest.php b/tests/unit/forms/LoginFormTest.php deleted file mode 100644 index ce881f42..00000000 --- a/tests/unit/forms/LoginFormTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(LoginForm::class); - - $this->assertInstanceOf(Form::class, $class); - } -} diff --git a/tests/unit/forms/ProfilesFormTest.php b/tests/unit/forms/ProfilesFormTest.php deleted file mode 100644 index 6493746a..00000000 --- a/tests/unit/forms/ProfilesFormTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(ProfilesForm::class); - - $this->assertInstanceOf(Form::class, $class); - } -} diff --git a/tests/unit/forms/SignUpFormTest.php b/tests/unit/forms/SignUpFormTest.php deleted file mode 100644 index 6930d2af..00000000 --- a/tests/unit/forms/SignUpFormTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(SignUpForm::class); - - $this->assertInstanceOf(Form::class, $class); - } -} diff --git a/tests/unit/forms/UsersFormTest.php b/tests/unit/forms/UsersFormTest.php deleted file mode 100644 index 16cbd968..00000000 --- a/tests/unit/forms/UsersFormTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(UsersForm::class); - - $this->assertInstanceOf(Form::class, $class); - } -} diff --git a/tests/unit/models/EmailConfirmationsTest.php b/tests/unit/models/EmailConfirmationsTest.php deleted file mode 100644 index c5cf4713..00000000 --- a/tests/unit/models/EmailConfirmationsTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(EmailConfirmations::class); - - $this->assertInstanceOf(Model::class, $class); - } -} diff --git a/tests/unit/models/FailedLoginsTest.php b/tests/unit/models/FailedLoginsTest.php deleted file mode 100644 index abd26b2a..00000000 --- a/tests/unit/models/FailedLoginsTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(FailedLogins::class); - - $this->assertInstanceOf(Model::class, $class); - } -} diff --git a/tests/unit/models/PasswordChangesTest.php b/tests/unit/models/PasswordChangesTest.php deleted file mode 100644 index 081c0edd..00000000 --- a/tests/unit/models/PasswordChangesTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(PasswordChanges::class); - - $this->assertInstanceOf(Model::class, $class); - } -} diff --git a/tests/unit/models/PermissionsTest.php b/tests/unit/models/PermissionsTest.php deleted file mode 100644 index 33629936..00000000 --- a/tests/unit/models/PermissionsTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(Permissions::class); - - $this->assertInstanceOf(Model::class, $class); - } -} diff --git a/tests/unit/models/ProfilesTest.php b/tests/unit/models/ProfilesTest.php deleted file mode 100644 index 5985924c..00000000 --- a/tests/unit/models/ProfilesTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(Profiles::class); - - $this->assertInstanceOf(Model::class, $class); - } -} diff --git a/tests/unit/models/RememberTokensTest.php b/tests/unit/models/RememberTokensTest.php deleted file mode 100644 index 01bdb7dc..00000000 --- a/tests/unit/models/RememberTokensTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(RememberTokens::class); - - $this->assertInstanceOf(Model::class, $class); - } -} diff --git a/tests/unit/models/ResetPasswordsTest.php b/tests/unit/models/ResetPasswordsTest.php deleted file mode 100644 index a4bccef8..00000000 --- a/tests/unit/models/ResetPasswordsTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(ResetPasswords::class); - - $this->assertInstanceOf(Model::class, $class); - } -} diff --git a/tests/unit/models/SuccessLoginsTest.php b/tests/unit/models/SuccessLoginsTest.php deleted file mode 100644 index 43db607f..00000000 --- a/tests/unit/models/SuccessLoginsTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(SuccessLogins::class); - - $this->assertInstanceOf(Model::class, $class); - } -} diff --git a/tests/unit/models/UsersTest.php b/tests/unit/models/UsersTest.php deleted file mode 100644 index 7fa683d8..00000000 --- a/tests/unit/models/UsersTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(Users::class); - - $this->assertInstanceOf(Model::class, $class); - } -} diff --git a/tests/unit/plugins/acl/AclTest.php b/tests/unit/plugins/acl/AclTest.php deleted file mode 100644 index 9e415eab..00000000 --- a/tests/unit/plugins/acl/AclTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(Acl::class); - - $this->assertInstanceOf(Injectable::class, $class); - } -} diff --git a/tests/unit/plugins/auth/AuthTest.php b/tests/unit/plugins/auth/AuthTest.php deleted file mode 100644 index 98cea90f..00000000 --- a/tests/unit/plugins/auth/AuthTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(Auth::class); - - $this->assertInstanceOf(Injectable::class, $class); - } -} diff --git a/tests/unit/plugins/mail/MailTest.php b/tests/unit/plugins/mail/MailTest.php deleted file mode 100644 index 0c4cedb9..00000000 --- a/tests/unit/plugins/mail/MailTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(Mail::class); - - $this->assertInstanceOf(Injectable::class, $class); - } -} diff --git a/tests/unit/providers/AclProviderTest.php b/tests/unit/providers/AclProviderTest.php deleted file mode 100644 index b519ada9..00000000 --- a/tests/unit/providers/AclProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(AclProvider::class); - - $this->assertInstanceOf(ServiceProviderInterface::class, $class); - } -} diff --git a/tests/unit/providers/AssetsProviderTest.php b/tests/unit/providers/AssetsProviderTest.php deleted file mode 100644 index 8fc33090..00000000 --- a/tests/unit/providers/AssetsProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(AssetsProvider::class); - - $this->assertInstanceOf(ServiceProviderInterface::class, $class); - } -} diff --git a/tests/unit/providers/AuthProviderTest.php b/tests/unit/providers/AuthProviderTest.php deleted file mode 100644 index 6fed62d5..00000000 --- a/tests/unit/providers/AuthProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(AuthProvider::class); - - $this->assertInstanceOf(ServiceProviderInterface::class, $class); - } -} diff --git a/tests/unit/providers/ConfigProviderTest.php b/tests/unit/providers/ConfigProviderTest.php deleted file mode 100644 index 198cf015..00000000 --- a/tests/unit/providers/ConfigProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(ConfigProvider::class); - - $this->assertInstanceOf(ServiceProviderInterface::class, $class); - } -} diff --git a/tests/unit/providers/CryptProviderTest.php b/tests/unit/providers/CryptProviderTest.php deleted file mode 100644 index 1a17ed4a..00000000 --- a/tests/unit/providers/CryptProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(CryptProvider::class); - - $this->assertInstanceOf(ServiceProviderInterface::class, $class); - } -} diff --git a/tests/unit/providers/DbProviderTest.php b/tests/unit/providers/DbProviderTest.php deleted file mode 100644 index a95d1371..00000000 --- a/tests/unit/providers/DbProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(DbProvider::class); - - $this->assertInstanceOf(ServiceProviderInterface::class, $class); - } -} diff --git a/tests/unit/providers/DispatcherProviderTest.php b/tests/unit/providers/DispatcherProviderTest.php deleted file mode 100644 index 0fd5fb1b..00000000 --- a/tests/unit/providers/DispatcherProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(DispatcherProvider::class); - - $this->assertInstanceOf(ServiceProviderInterface::class, $class); - } -} diff --git a/tests/unit/providers/FlashProviderTest.php b/tests/unit/providers/FlashProviderTest.php deleted file mode 100644 index d3abc730..00000000 --- a/tests/unit/providers/FlashProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(FlashProvider::class); - - $this->assertInstanceOf(ServiceProviderInterface::class, $class); - } -} diff --git a/tests/unit/providers/LoggerProviderTest.php b/tests/unit/providers/LoggerProviderTest.php deleted file mode 100644 index 74be3f67..00000000 --- a/tests/unit/providers/LoggerProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(LoggerProvider::class); - - $this->assertInstanceOf(ServiceProviderInterface::class, $class); - } -} diff --git a/tests/unit/providers/MailProviderTest.php b/tests/unit/providers/MailProviderTest.php deleted file mode 100644 index 4bf371ca..00000000 --- a/tests/unit/providers/MailProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(MailProvider::class); - - $this->assertInstanceOf(ServiceProviderInterface::class, $class); - } -} diff --git a/tests/unit/providers/ModelsMetadataProviderTest.php b/tests/unit/providers/ModelsMetadataProviderTest.php deleted file mode 100644 index 4aba2813..00000000 --- a/tests/unit/providers/ModelsMetadataProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(ModelsMetadataProvider::class); - - $this->assertInstanceOf(ServiceProviderInterface::class, $class); - } -} diff --git a/tests/unit/providers/RouterProviderTest.php b/tests/unit/providers/RouterProviderTest.php deleted file mode 100644 index 1f7cbe61..00000000 --- a/tests/unit/providers/RouterProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(RouterProvider::class); - - $this->assertInstanceOf(ServiceProviderInterface::class, $class); - } -} diff --git a/tests/unit/providers/SecurityProviderTest.php b/tests/unit/providers/SecurityProviderTest.php deleted file mode 100644 index 81fe73e3..00000000 --- a/tests/unit/providers/SecurityProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(SecurityProvider::class); - - $this->assertInstanceOf(ServiceProviderInterface::class, $class); - } -} diff --git a/tests/unit/providers/SessionBagProviderTest.php b/tests/unit/providers/SessionBagProviderTest.php deleted file mode 100644 index f02c93cb..00000000 --- a/tests/unit/providers/SessionBagProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(SessionBagProvider::class); - - $this->assertInstanceOf(ServiceProviderInterface::class, $class); - } -} diff --git a/tests/unit/providers/SessionProviderTest.php b/tests/unit/providers/SessionProviderTest.php deleted file mode 100644 index bf950475..00000000 --- a/tests/unit/providers/SessionProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(SessionProvider::class); - - $this->assertInstanceOf(ServiceProviderInterface::class, $class); - } -} diff --git a/tests/unit/providers/UrlProviderTest.php b/tests/unit/providers/UrlProviderTest.php deleted file mode 100644 index 0642c9a3..00000000 --- a/tests/unit/providers/UrlProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(UrlProvider::class); - - $this->assertInstanceOf(ServiceProviderInterface::class, $class); - } -} diff --git a/tests/unit/providers/ViewProviderTest.php b/tests/unit/providers/ViewProviderTest.php deleted file mode 100644 index 5ecb90bf..00000000 --- a/tests/unit/providers/ViewProviderTest.php +++ /dev/null @@ -1,18 +0,0 @@ -make(ViewProvider::class); - - $this->assertInstanceOf(ServiceProviderInterface::class, $class); - } -} From 585f2c48c03a96859b6cfc41ddbc54f5168a2dea Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 19:10:23 +0200 Subject: [PATCH 56/72] Add files via upload --- tests/_support/AcceptanceTester.php | 26 ++++ tests/_support/FunctionalTester.php | 26 ++++ tests/_support/Helper/Acceptance.php | 30 +++++ tests/_support/Helper/Functional.php | 10 ++ tests/_support/Helper/Unit.php | 10 ++ tests/_support/UnitTester.php | 26 ++++ tests/acceptance.suite.yml | 15 +++ .../controllers/AboutControllerCest.php | 19 +++ .../controllers/IndexControllerCest.php | 19 +++ .../controllers/PermissionsControllerCest.php | 52 ++++++++ .../controllers/PrivacyControllerCest.php | 19 +++ .../controllers/ProfilesControllerCest.php | 113 +++++++++++++++++ .../controllers/SessionControllerCest.php | 61 ++++++++++ .../controllers/TermsControllerCest.php | 19 +++ .../controllers/UsersControllerCest.php | 115 ++++++++++++++++++ tests/functional.suite.yml | 13 ++ .../forms/ChangePasswordFormTest.php | 77 ++++++++++++ .../forms/ForgotPasswordFormTest.php | 43 +++++++ tests/functional/forms/LoginFormTest.php | 56 +++++++++ tests/functional/forms/ProfilesFormTest.php | 42 +++++++ tests/unit.suite.yml | 10 ++ tests/unit/ApplicationTest.php | 19 +++ .../unit/controllers/AboutControllerTest.php | 19 +++ tests/unit/controllers/ControllerBaseTest.php | 19 +++ .../unit/controllers/IndexControllerTest.php | 19 +++ .../controllers/PermissionsControllerTest.php | 19 +++ .../controllers/PrivacyControllerTest.php | 19 +++ .../controllers/ProfilesControllerTest.php | 19 +++ .../controllers/SessionControllerTest.php | 19 +++ .../unit/controllers/TermsControllerTest.php | 19 +++ .../controllers/UserControlControllerTest.php | 19 +++ .../unit/controllers/UsersControllerTest.php | 19 +++ tests/unit/forms/ChangePasswordFormTest.php | 19 +++ tests/unit/forms/ForgotPasswordFormTest.php | 19 +++ tests/unit/forms/LoginFormTest.php | 19 +++ tests/unit/forms/ProfilesFormTest.php | 19 +++ tests/unit/forms/SignUpFormTest.php | 19 +++ tests/unit/forms/UsersFormTest.php | 19 +++ tests/unit/models/EmailConfirmationsTest.php | 19 +++ tests/unit/models/FailedLoginsTest.php | 19 +++ tests/unit/models/PasswordChangesTest.php | 19 +++ tests/unit/models/PermissionsTest.php | 19 +++ tests/unit/models/ProfilesTest.php | 19 +++ tests/unit/models/RememberTokensTest.php | 19 +++ tests/unit/models/ResetPasswordsTest.php | 19 +++ tests/unit/models/SuccessLoginsTest.php | 19 +++ tests/unit/models/UsersTest.php | 19 +++ tests/unit/plugins/acl/AclTest.php | 19 +++ tests/unit/plugins/auth/AuthTest.php | 19 +++ tests/unit/plugins/mail/MailTest.php | 19 +++ tests/unit/providers/AclProviderTest.php | 19 +++ tests/unit/providers/AssetsProviderTest.php | 19 +++ tests/unit/providers/AuthProviderTest.php | 19 +++ tests/unit/providers/ConfigProviderTest.php | 19 +++ tests/unit/providers/CryptProviderTest.php | 19 +++ tests/unit/providers/DbProviderTest.php | 19 +++ .../unit/providers/DispatcherProviderTest.php | 19 +++ tests/unit/providers/FlashProviderTest.php | 19 +++ tests/unit/providers/LoggerProviderTest.php | 19 +++ tests/unit/providers/MailProviderTest.php | 19 +++ .../providers/ModelsMetadataProviderTest.php | 19 +++ tests/unit/providers/RouterProviderTest.php | 19 +++ tests/unit/providers/SecurityProviderTest.php | 19 +++ .../unit/providers/SessionBagProviderTest.php | 19 +++ tests/unit/providers/SessionProviderTest.php | 19 +++ tests/unit/providers/UrlProviderTest.php | 19 +++ tests/unit/providers/ViewProviderTest.php | 19 +++ 67 files changed, 1675 insertions(+) create mode 100644 tests/_support/AcceptanceTester.php create mode 100644 tests/_support/FunctionalTester.php create mode 100644 tests/_support/Helper/Acceptance.php create mode 100644 tests/_support/Helper/Functional.php create mode 100644 tests/_support/Helper/Unit.php create mode 100644 tests/_support/UnitTester.php create mode 100644 tests/acceptance.suite.yml create mode 100644 tests/acceptance/controllers/AboutControllerCest.php create mode 100644 tests/acceptance/controllers/IndexControllerCest.php create mode 100644 tests/acceptance/controllers/PermissionsControllerCest.php create mode 100644 tests/acceptance/controllers/PrivacyControllerCest.php create mode 100644 tests/acceptance/controllers/ProfilesControllerCest.php create mode 100644 tests/acceptance/controllers/SessionControllerCest.php create mode 100644 tests/acceptance/controllers/TermsControllerCest.php create mode 100644 tests/acceptance/controllers/UsersControllerCest.php create mode 100644 tests/functional.suite.yml create mode 100644 tests/functional/forms/ChangePasswordFormTest.php create mode 100644 tests/functional/forms/ForgotPasswordFormTest.php create mode 100644 tests/functional/forms/LoginFormTest.php create mode 100644 tests/functional/forms/ProfilesFormTest.php create mode 100644 tests/unit.suite.yml create mode 100644 tests/unit/ApplicationTest.php create mode 100644 tests/unit/controllers/AboutControllerTest.php create mode 100644 tests/unit/controllers/ControllerBaseTest.php create mode 100644 tests/unit/controllers/IndexControllerTest.php create mode 100644 tests/unit/controllers/PermissionsControllerTest.php create mode 100644 tests/unit/controllers/PrivacyControllerTest.php create mode 100644 tests/unit/controllers/ProfilesControllerTest.php create mode 100644 tests/unit/controllers/SessionControllerTest.php create mode 100644 tests/unit/controllers/TermsControllerTest.php create mode 100644 tests/unit/controllers/UserControlControllerTest.php create mode 100644 tests/unit/controllers/UsersControllerTest.php create mode 100644 tests/unit/forms/ChangePasswordFormTest.php create mode 100644 tests/unit/forms/ForgotPasswordFormTest.php create mode 100644 tests/unit/forms/LoginFormTest.php create mode 100644 tests/unit/forms/ProfilesFormTest.php create mode 100644 tests/unit/forms/SignUpFormTest.php create mode 100644 tests/unit/forms/UsersFormTest.php create mode 100644 tests/unit/models/EmailConfirmationsTest.php create mode 100644 tests/unit/models/FailedLoginsTest.php create mode 100644 tests/unit/models/PasswordChangesTest.php create mode 100644 tests/unit/models/PermissionsTest.php create mode 100644 tests/unit/models/ProfilesTest.php create mode 100644 tests/unit/models/RememberTokensTest.php create mode 100644 tests/unit/models/ResetPasswordsTest.php create mode 100644 tests/unit/models/SuccessLoginsTest.php create mode 100644 tests/unit/models/UsersTest.php create mode 100644 tests/unit/plugins/acl/AclTest.php create mode 100644 tests/unit/plugins/auth/AuthTest.php create mode 100644 tests/unit/plugins/mail/MailTest.php create mode 100644 tests/unit/providers/AclProviderTest.php create mode 100644 tests/unit/providers/AssetsProviderTest.php create mode 100644 tests/unit/providers/AuthProviderTest.php create mode 100644 tests/unit/providers/ConfigProviderTest.php create mode 100644 tests/unit/providers/CryptProviderTest.php create mode 100644 tests/unit/providers/DbProviderTest.php create mode 100644 tests/unit/providers/DispatcherProviderTest.php create mode 100644 tests/unit/providers/FlashProviderTest.php create mode 100644 tests/unit/providers/LoggerProviderTest.php create mode 100644 tests/unit/providers/MailProviderTest.php create mode 100644 tests/unit/providers/ModelsMetadataProviderTest.php create mode 100644 tests/unit/providers/RouterProviderTest.php create mode 100644 tests/unit/providers/SecurityProviderTest.php create mode 100644 tests/unit/providers/SessionBagProviderTest.php create mode 100644 tests/unit/providers/SessionProviderTest.php create mode 100644 tests/unit/providers/UrlProviderTest.php create mode 100644 tests/unit/providers/ViewProviderTest.php diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php new file mode 100644 index 00000000..95c00ec2 --- /dev/null +++ b/tests/_support/AcceptanceTester.php @@ -0,0 +1,26 @@ +setAutoExit(false); + $app->run(new StringInput('rollback -e testing -t 0'), new NullOutput()); + $app->run(new StringInput('migrate -e testing'), new NullOutput()); + $app->run(new StringInput('seed:run -e testing'), new NullOutput()); + } +} diff --git a/tests/_support/Helper/Functional.php b/tests/_support/Helper/Functional.php new file mode 100644 index 00000000..4183cb0a --- /dev/null +++ b/tests/_support/Helper/Functional.php @@ -0,0 +1,10 @@ +amOnPage('/about'); + $I->see('About this Demo'); + } +} diff --git a/tests/acceptance/controllers/IndexControllerCest.php b/tests/acceptance/controllers/IndexControllerCest.php new file mode 100644 index 00000000..306436b6 --- /dev/null +++ b/tests/acceptance/controllers/IndexControllerCest.php @@ -0,0 +1,19 @@ +amOnPage('/'); + $I->see('Welcome!'); + } +} diff --git a/tests/acceptance/controllers/PermissionsControllerCest.php b/tests/acceptance/controllers/PermissionsControllerCest.php new file mode 100644 index 00000000..3ba2de2c --- /dev/null +++ b/tests/acceptance/controllers/PermissionsControllerCest.php @@ -0,0 +1,52 @@ +amOnPage('/session/login'); + $I->see('Log In'); + $I->fillField('email', 'bob@phalcon.io'); + $I->fillField('password', 'password1'); + $I->click('//form/*[@type="submit"]'); + $I->see('Search users'); + + $this->cookie = $I->grabCookie('PHPSESSID'); + } + + /** + * @depends login + * + * @param AcceptanceTester $I + */ + public function testIndex(AcceptanceTester $I): void + { + $I->setCookie('PHPSESSID', $this->cookie); + + $I->amOnPage('/permissions'); + $I->see('Manage Permissions'); + } + + /** + * @param AcceptanceTester $I + */ + public function testIndexAsGuest(AcceptanceTester $I): void + { + $I->amOnPage('/permissions'); + $I->see('You don\'t have access to this module: private'); + } +} diff --git a/tests/acceptance/controllers/PrivacyControllerCest.php b/tests/acceptance/controllers/PrivacyControllerCest.php new file mode 100644 index 00000000..1ec6f254 --- /dev/null +++ b/tests/acceptance/controllers/PrivacyControllerCest.php @@ -0,0 +1,19 @@ +amOnPage('/privacy'); + $I->see('Privacy'); + } +} diff --git a/tests/acceptance/controllers/ProfilesControllerCest.php b/tests/acceptance/controllers/ProfilesControllerCest.php new file mode 100644 index 00000000..597fb9ce --- /dev/null +++ b/tests/acceptance/controllers/ProfilesControllerCest.php @@ -0,0 +1,113 @@ +amOnPage('/session/login'); + $I->see('Log In'); + $I->fillField('email', 'bob@phalcon.io'); + $I->fillField('password', 'password1'); + $I->click('//form/*[@type="submit"]'); + $I->see('Search users'); + + $this->cookie = $I->grabCookie('PHPSESSID'); + } + + /** + * @param AcceptanceTester $I + */ + public function testIndexAsGuest(AcceptanceTester $I): void + { + $I->amOnPage('/profiles'); + $I->see('You don\'t have access to this module: private'); + } + + /** + * @depends login + * + * @param AcceptanceTester $I + */ + public function testIndex(AcceptanceTester $I): void + { + $I->setCookie('PHPSESSID', $this->cookie); + + $I->amOnPage('/profiles'); + $I->see('Search profiles'); + } + + /** + * @depends login + * + * @param AcceptanceTester $I + */ + public function testSearch(AcceptanceTester $I): void + { + $I->setCookie('PHPSESSID', $this->cookie); + + $I->amOnPage('/profiles'); + $I->click('Search'); + $I->see('Found profiles'); + } + + /** + * @depends login + * + * @param AcceptanceTester $I + */ + public function testCreate(AcceptanceTester $I): void + { + $I->setCookie('PHPSESSID', $this->cookie); + + $I->amOnPage('/profiles/create'); + $I->see('Create a Profile'); + } + + /** + * @depends login + * + * @param AcceptanceTester $I + */ + public function testEdit(AcceptanceTester $I): void + { + $I->setCookie('PHPSESSID', $this->cookie); + + $I->amOnPage('/profiles/edit/1'); + $I->see('Edit profile'); + } + + /** + * @depends login + * + * @param AcceptanceTester $I + */ + public function testDelete(AcceptanceTester $I): void + { + $I->setCookie('PHPSESSID', $this->cookie); + + $I->amOnPage('/profiles'); + $I->click('Search'); + $I->see('Found profiles'); + $I->see('Administrators'); + + $I->click('//a[@href="/profiles/delete/1"]'); + + $I->amOnPage('/profiles'); + $I->see('Search'); + $I->cantSee('Administrators'); + } +} diff --git a/tests/acceptance/controllers/SessionControllerCest.php b/tests/acceptance/controllers/SessionControllerCest.php new file mode 100644 index 00000000..447d1f96 --- /dev/null +++ b/tests/acceptance/controllers/SessionControllerCest.php @@ -0,0 +1,61 @@ +amOnPage('/session/login'); + $I->see('Log In'); + } + + /** + * @param AcceptanceTester $I + */ + public function testSignup(AcceptanceTester $I): void + { + $I->amOnPage('/session/signup'); + $I->see('Sign up'); + } + + /** + * @param AcceptanceTester $I + */ + public function testForgotPassword(AcceptanceTester $I): void + { + $I->amOnPage('/session/forgotPassword'); + $I->see('Forgot Password?'); + } + + /** + * @param AcceptanceTester $I + */ + public function testLogoutAsGuest(AcceptanceTester $I): void + { + $I->amOnPage('/session/logout'); + $I->see('Welcome!'); + } + + /** + * @param AcceptanceTester $I + */ + public function testLogoutAsUser(AcceptanceTester $I): void + { + $I->amOnPage('/session/login'); + $I->see('Log In'); + $I->fillField('email', 'bob@phalcon.io'); + $I->fillField('password', 'password1'); + $I->click('//form/*[@type="submit"]'); + $I->see('Search users'); + $I->amOnPage('/session/logout'); + $I->see('Welcome!'); + } +} diff --git a/tests/acceptance/controllers/TermsControllerCest.php b/tests/acceptance/controllers/TermsControllerCest.php new file mode 100644 index 00000000..d49847e3 --- /dev/null +++ b/tests/acceptance/controllers/TermsControllerCest.php @@ -0,0 +1,19 @@ +amOnPage('/terms'); + $I->see('Terms'); + } +} diff --git a/tests/acceptance/controllers/UsersControllerCest.php b/tests/acceptance/controllers/UsersControllerCest.php new file mode 100644 index 00000000..ed7860b3 --- /dev/null +++ b/tests/acceptance/controllers/UsersControllerCest.php @@ -0,0 +1,115 @@ +amOnPage('/session/login'); + $I->see('Log In'); + $I->fillField('email', 'bob@phalcon.io'); + $I->fillField('password', 'password1'); + $I->click('//form/*[@type="submit"]'); + $I->see('Search users'); + + $this->cookie = $I->grabCookie('PHPSESSID'); + } + + /** + * @param AcceptanceTester $I + */ + public function testIndexAsGuest(AcceptanceTester $I): void + { + $I->amOnPage('/users'); + $I->see('You don\'t have access to this module: private'); + } + + /** + * @depends login + * + * @param AcceptanceTester $I + */ + public function testIndex(AcceptanceTester $I): void + { + $I->setCookie('PHPSESSID', $this->cookie); + + $I->amOnPage('/users'); + $I->see('Search users'); + } + + /** + * @depends login + * + * @param AcceptanceTester $I + */ + public function testSearch(AcceptanceTester $I): void + { + $I->setCookie('PHPSESSID', $this->cookie); + + $I->amOnPage('/users/search'); + $I->see('Found users'); + } + + /** + * @depends login + * + * @param AcceptanceTester $I + */ + public function testCreate(AcceptanceTester $I): void + { + $I->setCookie('PHPSESSID', $this->cookie); + + $I->amOnPage('/users/create'); + $I->see('Create a User'); + } + + /** + * @depends login + * + * @param AcceptanceTester $I + */ + public function testEdit(AcceptanceTester $I): void + { + $I->setCookie('PHPSESSID', $this->cookie); + + $I->amOnPage('/users/edit/1'); + $I->see('Edit users'); + } + + /** + * @depends login + * + * @param AcceptanceTester $I + */ + public function testDelete(AcceptanceTester $I): void + { + $I->setCookie('PHPSESSID', $this->cookie); + + $I->amOnPage('/users/delete/4'); + $I->amOnPage('/users/search'); + $I->cantSee('Yukimi Nagano'); + } + + /** + * @depends login + * + * @param AcceptanceTester $I + */ + public function testChangePassword(AcceptanceTester $I): void + { + $I->setCookie('PHPSESSID', $this->cookie); + + $I->amOnPage('/users/changePassword'); + $I->see('Change Password'); + } +} diff --git a/tests/functional.suite.yml b/tests/functional.suite.yml new file mode 100644 index 00000000..31e19044 --- /dev/null +++ b/tests/functional.suite.yml @@ -0,0 +1,13 @@ +# Codeception Test Suite Configuration +# +# Suite for functional tests +# Emulate web requests and make application process them +# Include one of framework modules (Symfony2, Yii2, Laravel5) to use it +# Remove this suite if you don't use frameworks + +actor: FunctionalTester +modules: + enabled: + # add a framework module here + - \Helper\Functional + step_decorators: ~ diff --git a/tests/functional/forms/ChangePasswordFormTest.php b/tests/functional/forms/ChangePasswordFormTest.php new file mode 100644 index 00000000..eb5137b8 --- /dev/null +++ b/tests/functional/forms/ChangePasswordFormTest.php @@ -0,0 +1,77 @@ + '', + self::CONFIRM_PASS_KEY => '', + ]; + $shortPasswordData = [ + self::PASS_KEY => '123', + self::CONFIRM_PASS_KEY => '123', + ]; + $emptyConfirmPasswordData = [ + self::PASS_KEY => 'valid password empty config', + ]; + $missMatchConfigPasswordData = [ + self::PASS_KEY => '123456780', + self::CONFIRM_PASS_KEY => '123456789', + ]; + $correctData1 = [ + self::PASS_KEY => '12345678', + self::CONFIRM_PASS_KEY => '12345678', + ]; + $correctData2 = [ + self::PASS_KEY => 'valid password', + self::CONFIRM_PASS_KEY => 'valid password' + ]; + $correctData3 = [ + self::PASS_KEY => '(*%^%$#@#$%^', + self::CONFIRM_PASS_KEY => '(*%^%$#@#$%^', + ]; + + return [ + [$emptyData, 3, false], + [$emptyPasswordData, 3, false], + [$shortPasswordData, 1, false], + [$emptyConfirmPasswordData, 2, false], + [$missMatchConfigPasswordData, 1, false], + [$correctData1, 0, true], + [$correctData2, 0, true], + [$correctData3, 0, true], + ]; + } + + /** + * @dataProvider dataProvider + * + * @param array $data + * @param int $errorsCount + * @param bool $expected + */ + public function testValidations(array $data, int $errorsCount, bool $expected): void + { + $form = new ChangePasswordForm(); + $isValid = $form->isValid($data); + $messages = $form->getMessages(); + + $this->assertEquals($expected, $isValid); + $this->assertEquals($errorsCount, count($messages)); + } +} diff --git a/tests/functional/forms/ForgotPasswordFormTest.php b/tests/functional/forms/ForgotPasswordFormTest.php new file mode 100644 index 00000000..1a0c21e0 --- /dev/null +++ b/tests/functional/forms/ForgotPasswordFormTest.php @@ -0,0 +1,43 @@ + 'invalid email'], 1, false], + [[self::EMAIL_KEY => 'valid@email.com'], 0, true], + [[self::EMAIL_KEY => 'bob@phalcon.io'], 0, true], + ]; + } + + /** + * @dataProvider dataProvider + * + * @param array $data + * @param int $errorsCount + * @param bool $expected + */ + public function testValidations(array $data, int $errorsCount, bool $expected): void + { + $form = new ForgotPasswordForm(); + $isValid = $form->isValid($data); + $messages = $form->getMessages(); + + $this->assertEquals($expected, $isValid); + $this->assertEquals($errorsCount, count($messages)); + } +} diff --git a/tests/functional/forms/LoginFormTest.php b/tests/functional/forms/LoginFormTest.php new file mode 100644 index 00000000..d526e196 --- /dev/null +++ b/tests/functional/forms/LoginFormTest.php @@ -0,0 +1,56 @@ +register($di); + + $emptyData = []; + $incorrectCsrfData = [ + self::EMAIL_KEY => 'bob@phalcon.io', + self::PASS_KEY => 'password1', + self::CSRF_KEY => 'invalid', + ]; + + return [ + [$emptyData, 4, false], + [$incorrectCsrfData, 1, false], + ]; + } + + /** + * @dataProvider dataProvider + * + * @param array $data + * @param int $errorsCount + * @param bool $expected + */ + public function testValidations(array $data, int $errorsCount, bool $expected): void + { + $form = new LoginForm(); + $isValid = $form->isValid($data); + $messages = $form->getMessages(); + + $this->assertEquals($expected, $isValid); + $this->assertEquals($errorsCount, count($messages)); + } +} diff --git a/tests/functional/forms/ProfilesFormTest.php b/tests/functional/forms/ProfilesFormTest.php new file mode 100644 index 00000000..801ff55c --- /dev/null +++ b/tests/functional/forms/ProfilesFormTest.php @@ -0,0 +1,42 @@ + ''], 1, false], + [[self::NAME_KEY => 'valid name'], 0, true], + ]; + } + + /** + * @dataProvider dataProvider + * + * @param array $data + * @param int $errorsCount + * @param bool $expected + */ + public function testValidations(array $data, int $errorsCount, bool $expected): void + { + $form = new ProfilesForm(); + $isValid = $form->isValid($data); + $messages = $form->getMessages(); + + $this->assertEquals($expected, $isValid); + $this->assertEquals($errorsCount, count($messages)); + } +} diff --git a/tests/unit.suite.yml b/tests/unit.suite.yml new file mode 100644 index 00000000..a2f1803d --- /dev/null +++ b/tests/unit.suite.yml @@ -0,0 +1,10 @@ +# Codeception Test Suite Configuration +# +# Suite for unit or integration tests. + +actor: UnitTester +modules: + enabled: + - Asserts + - \Helper\Unit + step_decorators: ~ diff --git a/tests/unit/ApplicationTest.php b/tests/unit/ApplicationTest.php new file mode 100644 index 00000000..46296dd3 --- /dev/null +++ b/tests/unit/ApplicationTest.php @@ -0,0 +1,19 @@ +constructEmptyExcept(Application::class, 'getRootPath', ['rootPath' => $rootPath]); + + $this->assertEquals($rootPath, $class->getRootPath()); + } +} diff --git a/tests/unit/controllers/AboutControllerTest.php b/tests/unit/controllers/AboutControllerTest.php new file mode 100644 index 00000000..1f4accb1 --- /dev/null +++ b/tests/unit/controllers/AboutControllerTest.php @@ -0,0 +1,19 @@ +make(AboutController::class); + + $this->assertInstanceOf(Controller::class, $class); + } +} diff --git a/tests/unit/controllers/ControllerBaseTest.php b/tests/unit/controllers/ControllerBaseTest.php new file mode 100644 index 00000000..11a20091 --- /dev/null +++ b/tests/unit/controllers/ControllerBaseTest.php @@ -0,0 +1,19 @@ +make(ControllerBase::class); + + $this->assertInstanceOf(Controller::class, $class); + } +} diff --git a/tests/unit/controllers/IndexControllerTest.php b/tests/unit/controllers/IndexControllerTest.php new file mode 100644 index 00000000..4c3dc5fa --- /dev/null +++ b/tests/unit/controllers/IndexControllerTest.php @@ -0,0 +1,19 @@ +make(IndexController::class); + + $this->assertInstanceOf(Controller::class, $class); + } +} diff --git a/tests/unit/controllers/PermissionsControllerTest.php b/tests/unit/controllers/PermissionsControllerTest.php new file mode 100644 index 00000000..4cf3bffe --- /dev/null +++ b/tests/unit/controllers/PermissionsControllerTest.php @@ -0,0 +1,19 @@ +make(PermissionsController::class); + + $this->assertInstanceOf(Controller::class, $class); + } +} diff --git a/tests/unit/controllers/PrivacyControllerTest.php b/tests/unit/controllers/PrivacyControllerTest.php new file mode 100644 index 00000000..1fcd8d90 --- /dev/null +++ b/tests/unit/controllers/PrivacyControllerTest.php @@ -0,0 +1,19 @@ +make(PrivacyController::class); + + $this->assertInstanceOf(Controller::class, $class); + } +} diff --git a/tests/unit/controllers/ProfilesControllerTest.php b/tests/unit/controllers/ProfilesControllerTest.php new file mode 100644 index 00000000..ce962871 --- /dev/null +++ b/tests/unit/controllers/ProfilesControllerTest.php @@ -0,0 +1,19 @@ +make(ProfilesController::class); + + $this->assertInstanceOf(Controller::class, $class); + } +} diff --git a/tests/unit/controllers/SessionControllerTest.php b/tests/unit/controllers/SessionControllerTest.php new file mode 100644 index 00000000..be732ea9 --- /dev/null +++ b/tests/unit/controllers/SessionControllerTest.php @@ -0,0 +1,19 @@ +make(SessionController::class); + + $this->assertInstanceOf(Controller::class, $class); + } +} diff --git a/tests/unit/controllers/TermsControllerTest.php b/tests/unit/controllers/TermsControllerTest.php new file mode 100644 index 00000000..c7d6f3cd --- /dev/null +++ b/tests/unit/controllers/TermsControllerTest.php @@ -0,0 +1,19 @@ +make(TermsController::class); + + $this->assertInstanceOf(Controller::class, $class); + } +} diff --git a/tests/unit/controllers/UserControlControllerTest.php b/tests/unit/controllers/UserControlControllerTest.php new file mode 100644 index 00000000..b9175958 --- /dev/null +++ b/tests/unit/controllers/UserControlControllerTest.php @@ -0,0 +1,19 @@ +make(UserControlController::class); + + $this->assertInstanceOf(Controller::class, $class); + } +} diff --git a/tests/unit/controllers/UsersControllerTest.php b/tests/unit/controllers/UsersControllerTest.php new file mode 100644 index 00000000..98260779 --- /dev/null +++ b/tests/unit/controllers/UsersControllerTest.php @@ -0,0 +1,19 @@ +make(UsersController::class); + + $this->assertInstanceOf(Controller::class, $class); + } +} diff --git a/tests/unit/forms/ChangePasswordFormTest.php b/tests/unit/forms/ChangePasswordFormTest.php new file mode 100644 index 00000000..b3176d6c --- /dev/null +++ b/tests/unit/forms/ChangePasswordFormTest.php @@ -0,0 +1,19 @@ +make(ChangePasswordForm::class); + + $this->assertInstanceOf(Form::class, $class); + } +} diff --git a/tests/unit/forms/ForgotPasswordFormTest.php b/tests/unit/forms/ForgotPasswordFormTest.php new file mode 100644 index 00000000..473e3ee1 --- /dev/null +++ b/tests/unit/forms/ForgotPasswordFormTest.php @@ -0,0 +1,19 @@ +make(ForgotPasswordForm::class); + + $this->assertInstanceOf(Form::class, $class); + } +} diff --git a/tests/unit/forms/LoginFormTest.php b/tests/unit/forms/LoginFormTest.php new file mode 100644 index 00000000..fe280b35 --- /dev/null +++ b/tests/unit/forms/LoginFormTest.php @@ -0,0 +1,19 @@ +make(LoginForm::class); + + $this->assertInstanceOf(Form::class, $class); + } +} diff --git a/tests/unit/forms/ProfilesFormTest.php b/tests/unit/forms/ProfilesFormTest.php new file mode 100644 index 00000000..c24a45a9 --- /dev/null +++ b/tests/unit/forms/ProfilesFormTest.php @@ -0,0 +1,19 @@ +make(ProfilesForm::class); + + $this->assertInstanceOf(Form::class, $class); + } +} diff --git a/tests/unit/forms/SignUpFormTest.php b/tests/unit/forms/SignUpFormTest.php new file mode 100644 index 00000000..2b308de4 --- /dev/null +++ b/tests/unit/forms/SignUpFormTest.php @@ -0,0 +1,19 @@ +make(SignUpForm::class); + + $this->assertInstanceOf(Form::class, $class); + } +} diff --git a/tests/unit/forms/UsersFormTest.php b/tests/unit/forms/UsersFormTest.php new file mode 100644 index 00000000..0c0e8135 --- /dev/null +++ b/tests/unit/forms/UsersFormTest.php @@ -0,0 +1,19 @@ +make(UsersForm::class); + + $this->assertInstanceOf(Form::class, $class); + } +} diff --git a/tests/unit/models/EmailConfirmationsTest.php b/tests/unit/models/EmailConfirmationsTest.php new file mode 100644 index 00000000..935a95b7 --- /dev/null +++ b/tests/unit/models/EmailConfirmationsTest.php @@ -0,0 +1,19 @@ +make(EmailConfirmations::class); + + $this->assertInstanceOf(Model::class, $class); + } +} diff --git a/tests/unit/models/FailedLoginsTest.php b/tests/unit/models/FailedLoginsTest.php new file mode 100644 index 00000000..069fb9da --- /dev/null +++ b/tests/unit/models/FailedLoginsTest.php @@ -0,0 +1,19 @@ +make(FailedLogins::class); + + $this->assertInstanceOf(Model::class, $class); + } +} diff --git a/tests/unit/models/PasswordChangesTest.php b/tests/unit/models/PasswordChangesTest.php new file mode 100644 index 00000000..d00ee3d1 --- /dev/null +++ b/tests/unit/models/PasswordChangesTest.php @@ -0,0 +1,19 @@ +make(PasswordChanges::class); + + $this->assertInstanceOf(Model::class, $class); + } +} diff --git a/tests/unit/models/PermissionsTest.php b/tests/unit/models/PermissionsTest.php new file mode 100644 index 00000000..4867cf9a --- /dev/null +++ b/tests/unit/models/PermissionsTest.php @@ -0,0 +1,19 @@ +make(Permissions::class); + + $this->assertInstanceOf(Model::class, $class); + } +} diff --git a/tests/unit/models/ProfilesTest.php b/tests/unit/models/ProfilesTest.php new file mode 100644 index 00000000..5be8bec2 --- /dev/null +++ b/tests/unit/models/ProfilesTest.php @@ -0,0 +1,19 @@ +make(Profiles::class); + + $this->assertInstanceOf(Model::class, $class); + } +} diff --git a/tests/unit/models/RememberTokensTest.php b/tests/unit/models/RememberTokensTest.php new file mode 100644 index 00000000..f7af348a --- /dev/null +++ b/tests/unit/models/RememberTokensTest.php @@ -0,0 +1,19 @@ +make(RememberTokens::class); + + $this->assertInstanceOf(Model::class, $class); + } +} diff --git a/tests/unit/models/ResetPasswordsTest.php b/tests/unit/models/ResetPasswordsTest.php new file mode 100644 index 00000000..411038e2 --- /dev/null +++ b/tests/unit/models/ResetPasswordsTest.php @@ -0,0 +1,19 @@ +make(ResetPasswords::class); + + $this->assertInstanceOf(Model::class, $class); + } +} diff --git a/tests/unit/models/SuccessLoginsTest.php b/tests/unit/models/SuccessLoginsTest.php new file mode 100644 index 00000000..a3af1505 --- /dev/null +++ b/tests/unit/models/SuccessLoginsTest.php @@ -0,0 +1,19 @@ +make(SuccessLogins::class); + + $this->assertInstanceOf(Model::class, $class); + } +} diff --git a/tests/unit/models/UsersTest.php b/tests/unit/models/UsersTest.php new file mode 100644 index 00000000..083da073 --- /dev/null +++ b/tests/unit/models/UsersTest.php @@ -0,0 +1,19 @@ +make(Users::class); + + $this->assertInstanceOf(Model::class, $class); + } +} diff --git a/tests/unit/plugins/acl/AclTest.php b/tests/unit/plugins/acl/AclTest.php new file mode 100644 index 00000000..cc741d19 --- /dev/null +++ b/tests/unit/plugins/acl/AclTest.php @@ -0,0 +1,19 @@ +make(Acl::class); + + $this->assertInstanceOf(Injectable::class, $class); + } +} diff --git a/tests/unit/plugins/auth/AuthTest.php b/tests/unit/plugins/auth/AuthTest.php new file mode 100644 index 00000000..b4a98060 --- /dev/null +++ b/tests/unit/plugins/auth/AuthTest.php @@ -0,0 +1,19 @@ +make(Auth::class); + + $this->assertInstanceOf(Injectable::class, $class); + } +} diff --git a/tests/unit/plugins/mail/MailTest.php b/tests/unit/plugins/mail/MailTest.php new file mode 100644 index 00000000..19ccf8a6 --- /dev/null +++ b/tests/unit/plugins/mail/MailTest.php @@ -0,0 +1,19 @@ +make(Mail::class); + + $this->assertInstanceOf(Injectable::class, $class); + } +} diff --git a/tests/unit/providers/AclProviderTest.php b/tests/unit/providers/AclProviderTest.php new file mode 100644 index 00000000..de544080 --- /dev/null +++ b/tests/unit/providers/AclProviderTest.php @@ -0,0 +1,19 @@ +make(AclProvider::class); + + $this->assertInstanceOf(ServiceProviderInterface::class, $class); + } +} diff --git a/tests/unit/providers/AssetsProviderTest.php b/tests/unit/providers/AssetsProviderTest.php new file mode 100644 index 00000000..8dfc69c9 --- /dev/null +++ b/tests/unit/providers/AssetsProviderTest.php @@ -0,0 +1,19 @@ +make(AssetsProvider::class); + + $this->assertInstanceOf(ServiceProviderInterface::class, $class); + } +} diff --git a/tests/unit/providers/AuthProviderTest.php b/tests/unit/providers/AuthProviderTest.php new file mode 100644 index 00000000..f0f37bcc --- /dev/null +++ b/tests/unit/providers/AuthProviderTest.php @@ -0,0 +1,19 @@ +make(AuthProvider::class); + + $this->assertInstanceOf(ServiceProviderInterface::class, $class); + } +} diff --git a/tests/unit/providers/ConfigProviderTest.php b/tests/unit/providers/ConfigProviderTest.php new file mode 100644 index 00000000..51c876ba --- /dev/null +++ b/tests/unit/providers/ConfigProviderTest.php @@ -0,0 +1,19 @@ +make(ConfigProvider::class); + + $this->assertInstanceOf(ServiceProviderInterface::class, $class); + } +} diff --git a/tests/unit/providers/CryptProviderTest.php b/tests/unit/providers/CryptProviderTest.php new file mode 100644 index 00000000..e34c86d3 --- /dev/null +++ b/tests/unit/providers/CryptProviderTest.php @@ -0,0 +1,19 @@ +make(CryptProvider::class); + + $this->assertInstanceOf(ServiceProviderInterface::class, $class); + } +} diff --git a/tests/unit/providers/DbProviderTest.php b/tests/unit/providers/DbProviderTest.php new file mode 100644 index 00000000..f999d5f4 --- /dev/null +++ b/tests/unit/providers/DbProviderTest.php @@ -0,0 +1,19 @@ +make(DbProvider::class); + + $this->assertInstanceOf(ServiceProviderInterface::class, $class); + } +} diff --git a/tests/unit/providers/DispatcherProviderTest.php b/tests/unit/providers/DispatcherProviderTest.php new file mode 100644 index 00000000..8d6de987 --- /dev/null +++ b/tests/unit/providers/DispatcherProviderTest.php @@ -0,0 +1,19 @@ +make(DispatcherProvider::class); + + $this->assertInstanceOf(ServiceProviderInterface::class, $class); + } +} diff --git a/tests/unit/providers/FlashProviderTest.php b/tests/unit/providers/FlashProviderTest.php new file mode 100644 index 00000000..a0191908 --- /dev/null +++ b/tests/unit/providers/FlashProviderTest.php @@ -0,0 +1,19 @@ +make(FlashProvider::class); + + $this->assertInstanceOf(ServiceProviderInterface::class, $class); + } +} diff --git a/tests/unit/providers/LoggerProviderTest.php b/tests/unit/providers/LoggerProviderTest.php new file mode 100644 index 00000000..d94f5781 --- /dev/null +++ b/tests/unit/providers/LoggerProviderTest.php @@ -0,0 +1,19 @@ +make(LoggerProvider::class); + + $this->assertInstanceOf(ServiceProviderInterface::class, $class); + } +} diff --git a/tests/unit/providers/MailProviderTest.php b/tests/unit/providers/MailProviderTest.php new file mode 100644 index 00000000..e52a2b44 --- /dev/null +++ b/tests/unit/providers/MailProviderTest.php @@ -0,0 +1,19 @@ +make(MailProvider::class); + + $this->assertInstanceOf(ServiceProviderInterface::class, $class); + } +} diff --git a/tests/unit/providers/ModelsMetadataProviderTest.php b/tests/unit/providers/ModelsMetadataProviderTest.php new file mode 100644 index 00000000..ceb86436 --- /dev/null +++ b/tests/unit/providers/ModelsMetadataProviderTest.php @@ -0,0 +1,19 @@ +make(ModelsMetadataProvider::class); + + $this->assertInstanceOf(ServiceProviderInterface::class, $class); + } +} diff --git a/tests/unit/providers/RouterProviderTest.php b/tests/unit/providers/RouterProviderTest.php new file mode 100644 index 00000000..4773fa27 --- /dev/null +++ b/tests/unit/providers/RouterProviderTest.php @@ -0,0 +1,19 @@ +make(RouterProvider::class); + + $this->assertInstanceOf(ServiceProviderInterface::class, $class); + } +} diff --git a/tests/unit/providers/SecurityProviderTest.php b/tests/unit/providers/SecurityProviderTest.php new file mode 100644 index 00000000..c7389492 --- /dev/null +++ b/tests/unit/providers/SecurityProviderTest.php @@ -0,0 +1,19 @@ +make(SecurityProvider::class); + + $this->assertInstanceOf(ServiceProviderInterface::class, $class); + } +} diff --git a/tests/unit/providers/SessionBagProviderTest.php b/tests/unit/providers/SessionBagProviderTest.php new file mode 100644 index 00000000..af43316a --- /dev/null +++ b/tests/unit/providers/SessionBagProviderTest.php @@ -0,0 +1,19 @@ +make(SessionBagProvider::class); + + $this->assertInstanceOf(ServiceProviderInterface::class, $class); + } +} diff --git a/tests/unit/providers/SessionProviderTest.php b/tests/unit/providers/SessionProviderTest.php new file mode 100644 index 00000000..b2085d39 --- /dev/null +++ b/tests/unit/providers/SessionProviderTest.php @@ -0,0 +1,19 @@ +make(SessionProvider::class); + + $this->assertInstanceOf(ServiceProviderInterface::class, $class); + } +} diff --git a/tests/unit/providers/UrlProviderTest.php b/tests/unit/providers/UrlProviderTest.php new file mode 100644 index 00000000..a50381cd --- /dev/null +++ b/tests/unit/providers/UrlProviderTest.php @@ -0,0 +1,19 @@ +make(UrlProvider::class); + + $this->assertInstanceOf(ServiceProviderInterface::class, $class); + } +} diff --git a/tests/unit/providers/ViewProviderTest.php b/tests/unit/providers/ViewProviderTest.php new file mode 100644 index 00000000..c38eb3f1 --- /dev/null +++ b/tests/unit/providers/ViewProviderTest.php @@ -0,0 +1,19 @@ +make(ViewProvider::class); + + $this->assertInstanceOf(ServiceProviderInterface::class, $class); + } +} From 86afe281f87811e91d20a79a5ff5b1aa3af9365f Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 20:07:38 +0200 Subject: [PATCH 57/72] Delete db directory --- db/.gitignore | 3 - ...90825181051_create_email_confirmations.php | 24 --- .../20190825193313_create_failed_logins.php | 23 --- ...20190825193322_create_password_changes.php | 24 --- .../20190825193331_create_permissions.php | 23 --- .../20190825193340_create_profiles.php | 22 --- .../20190825193346_create_remember_tokens.php | 24 --- .../20190825193355_create_reset_passwords.php | 25 --- .../20190825193404_create_success_logins.php | 23 --- db/migrations/20190825193409_create_users.php | 28 ---- db/seeds/PermissionsSeeder.php | 151 ------------------ db/seeds/ProfilesSeeder.php | 34 ---- db/seeds/UsersSeeder.php | 63 -------- 13 files changed, 467 deletions(-) delete mode 100644 db/.gitignore delete mode 100644 db/migrations/20190825181051_create_email_confirmations.php delete mode 100644 db/migrations/20190825193313_create_failed_logins.php delete mode 100644 db/migrations/20190825193322_create_password_changes.php delete mode 100644 db/migrations/20190825193331_create_permissions.php delete mode 100644 db/migrations/20190825193340_create_profiles.php delete mode 100644 db/migrations/20190825193346_create_remember_tokens.php delete mode 100644 db/migrations/20190825193355_create_reset_passwords.php delete mode 100644 db/migrations/20190825193404_create_success_logins.php delete mode 100644 db/migrations/20190825193409_create_users.php delete mode 100644 db/seeds/PermissionsSeeder.php delete mode 100644 db/seeds/ProfilesSeeder.php delete mode 100644 db/seeds/UsersSeeder.php diff --git a/db/.gitignore b/db/.gitignore deleted file mode 100644 index 692ca563..00000000 --- a/db/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.sql -*.sqlite -*.sqlite3 diff --git a/db/migrations/20190825181051_create_email_confirmations.php b/db/migrations/20190825181051_create_email_confirmations.php deleted file mode 100644 index bf90c52c..00000000 --- a/db/migrations/20190825181051_create_email_confirmations.php +++ /dev/null @@ -1,24 +0,0 @@ -table('email_confirmations'); - if ($table->exists()) { - return; - } - - $table->addColumn('usersId', 'integer') - ->addColumn('code', 'char', ['limit' => 32]) - ->addColumn('createdAt', 'integer') - ->addColumn('modifiedAt', 'integer', ['null' => true]) - ->addColumn('confirmed', 'char', ['limit' => 1, 'default' => 'N']) - ->create(); - } -} diff --git a/db/migrations/20190825193313_create_failed_logins.php b/db/migrations/20190825193313_create_failed_logins.php deleted file mode 100644 index d76a07fb..00000000 --- a/db/migrations/20190825193313_create_failed_logins.php +++ /dev/null @@ -1,23 +0,0 @@ -table('failed_logins'); - if ($table->exists()) { - return; - } - - $table->addColumn('usersId', 'integer', ['null' => true]) - ->addColumn('ipAddress', 'char', ['limit' => 15]) - ->addColumn('attempted', 'integer') - ->addIndex(['usersId']) - ->create(); - } -} diff --git a/db/migrations/20190825193322_create_password_changes.php b/db/migrations/20190825193322_create_password_changes.php deleted file mode 100644 index 40212742..00000000 --- a/db/migrations/20190825193322_create_password_changes.php +++ /dev/null @@ -1,24 +0,0 @@ -table('password_changes'); - if ($table->exists()) { - return; - } - - $table->addColumn('usersId', 'integer') - ->addColumn('ipAddress', 'char', ['limit' => 15]) - ->addColumn('userAgent', 'text') - ->addColumn('createdAt', 'integer') - ->addIndex(['usersId']) - ->create(); - } -} diff --git a/db/migrations/20190825193331_create_permissions.php b/db/migrations/20190825193331_create_permissions.php deleted file mode 100644 index b8c2a267..00000000 --- a/db/migrations/20190825193331_create_permissions.php +++ /dev/null @@ -1,23 +0,0 @@ -table('permissions'); - if ($table->exists()) { - return; - } - - $table->addColumn('profilesId', 'integer') - ->addColumn('resource', 'string', ['limit' => 255]) - ->addColumn('action', 'string', ['limit' => 255]) - ->addIndex(['profilesId']) - ->create(); - } -} diff --git a/db/migrations/20190825193340_create_profiles.php b/db/migrations/20190825193340_create_profiles.php deleted file mode 100644 index ea605893..00000000 --- a/db/migrations/20190825193340_create_profiles.php +++ /dev/null @@ -1,22 +0,0 @@ -table('profiles'); - if ($table->exists()) { - return; - } - - $table->addColumn('name', 'string', ['limit' => 64]) - ->addColumn('active', 'char', ['limit' => 1]) - ->addIndex(['active']) - ->create(); - } -} diff --git a/db/migrations/20190825193346_create_remember_tokens.php b/db/migrations/20190825193346_create_remember_tokens.php deleted file mode 100644 index 3f39af8c..00000000 --- a/db/migrations/20190825193346_create_remember_tokens.php +++ /dev/null @@ -1,24 +0,0 @@ -table('remember_tokens'); - if ($table->exists()) { - return; - } - - $table->addColumn('usersId', 'integer') - ->addColumn('token', 'char', ['limit' => 32]) - ->addColumn('userAgent', 'text') - ->addColumn('createdAt', 'integer') - ->addIndex(['token']) - ->create(); - } -} diff --git a/db/migrations/20190825193355_create_reset_passwords.php b/db/migrations/20190825193355_create_reset_passwords.php deleted file mode 100644 index b3a8c5b8..00000000 --- a/db/migrations/20190825193355_create_reset_passwords.php +++ /dev/null @@ -1,25 +0,0 @@ -table('reset_passwords'); - if ($table->exists()) { - return; - } - - $table->addColumn('usersId', 'integer') - ->addColumn('code', 'integer') - ->addColumn('createdAt', 'integer') - ->addColumn('modifiedAt', 'integer') - ->addColumn('reset', 'char', ['limit' => 1]) - ->addIndex(['usersId']) - ->create(); - } -} diff --git a/db/migrations/20190825193404_create_success_logins.php b/db/migrations/20190825193404_create_success_logins.php deleted file mode 100644 index 705ff104..00000000 --- a/db/migrations/20190825193404_create_success_logins.php +++ /dev/null @@ -1,23 +0,0 @@ -table('success_logins'); - if ($table->exists()) { - return; - } - - $table->addColumn('usersId', 'integer') - ->addColumn('ipAddress', 'char', ['limit' => 15]) - ->addColumn('userAgent', 'text') - ->addIndex(['usersId']) - ->create(); - } -} diff --git a/db/migrations/20190825193409_create_users.php b/db/migrations/20190825193409_create_users.php deleted file mode 100644 index 8e751d72..00000000 --- a/db/migrations/20190825193409_create_users.php +++ /dev/null @@ -1,28 +0,0 @@ -table('users'); - if ($table->exists()) { - return; - } - - $table->addColumn('name', 'string', ['limit' => 255]) - ->addColumn('email', 'string', ['limit' => 255]) - ->addColumn('password', 'char', ['limit' => 60]) - ->addColumn('mustChangePassword', 'char', ['limit' => 1]) - ->addColumn('profilesId', 'integer') - ->addColumn('banned', 'char', ['limit' => 1]) - ->addColumn('suspended', 'char', ['limit' => 1]) - ->addColumn('active', 'char', ['limit' => 1, 'default' => null, 'null' => true]) - ->addIndex(['profilesId']) - ->create(); - } -} diff --git a/db/seeds/PermissionsSeeder.php b/db/seeds/PermissionsSeeder.php deleted file mode 100644 index 30840ed2..00000000 --- a/db/seeds/PermissionsSeeder.php +++ /dev/null @@ -1,151 +0,0 @@ - 1, - 'profilesId' => 3, - 'resource' => 'users', - 'action' => 'index', - ], - [ - 'id' => 2, - 'profilesId' => 3, - 'resource' => 'users', - 'action' => 'search', - ], - [ - 'id' => 3, - 'profilesId' => 3, - 'resource' => 'profiles', - 'action' => 'index', - ], - [ - 'id' => 4, - 'profilesId' => 3, - 'resource' => 'profiles', - 'action' => 'search', - ], - [ - 'id' => 5, - 'profilesId' => 1, - 'resource' => 'users', - 'action' => 'index', - ], - [ - 'id' => 6, - 'profilesId' => 1, - 'resource' => 'users', - 'action' => 'search', - ], - [ - 'id' => 7, - 'profilesId' => 1, - 'resource' => 'users', - 'action' => 'edit', - ], - [ - 'id' => 8, - 'profilesId' => 1, - 'resource' => 'users', - 'action' => 'create', - ], - [ - 'id' => 9, - 'profilesId' => 1, - 'resource' => 'users', - 'action' => 'delete', - ], - [ - 'id' => 10, - 'profilesId' => 1, - 'resource' => 'users', - 'action' => 'changePassword', - ], - [ - 'id' => 11, - 'profilesId' => 1, - 'resource' => 'profiles', - 'action' => 'index', - ], - [ - 'id' => 12, - 'profilesId' => 1, - 'resource' => 'profiles', - 'action' => 'search', - ], - [ - 'id' => 13, - 'profilesId' => 1, - 'resource' => 'profiles', - 'action' => 'edit', - ], - [ - 'id' => 14, - 'profilesId' => 1, - 'resource' => 'profiles', - 'action' => 'create', - ], - [ - 'id' => 15, - 'profilesId' => 1, - 'resource' => 'profiles', - 'action' => 'delete', - ], - [ - 'id' => 16, - 'profilesId' => 1, - 'resource' => 'permissions', - 'action' => 'index', - ], - [ - 'id' => 17, - 'profilesId' => 2, - 'resource' => 'users', - 'action' => 'index', - ], - [ - 'id' => 18, - 'profilesId' => 2, - 'resource' => 'users', - 'action' => 'search', - ], - [ - 'id' => 19, - 'profilesId' => 2, - 'resource' => 'users', - 'action' => 'edit', - ], - [ - 'id' => 20, - 'profilesId' => 2, - 'resource' => 'users', - 'action' => 'create', - ], - [ - 'id' => 21, - 'profilesId' => 2, - 'resource' => 'profiles', - 'action' => 'index', - ], - [ - 'id' => 22, - 'profilesId' => 2, - 'resource' => 'profiles', - 'action' => 'search', - ], - ]; - - $posts = $this->table('permissions'); - $posts->insert($data) - ->save(); - } -} diff --git a/db/seeds/ProfilesSeeder.php b/db/seeds/ProfilesSeeder.php deleted file mode 100644 index a9174d91..00000000 --- a/db/seeds/ProfilesSeeder.php +++ /dev/null @@ -1,34 +0,0 @@ - 1, - 'name' => 'Administrators', - 'active' => 'Y', - ], - [ - 'id' => 2, - 'name' => 'Users', - 'active' => 'Y', - ], - [ - 'id' => 3, - 'name' => 'Read-Only', - 'active' => 'Y', - ], - ]; - - $posts = $this->table('profiles'); - $posts->insert($data) - ->save(); - } -} diff --git a/db/seeds/UsersSeeder.php b/db/seeds/UsersSeeder.php deleted file mode 100644 index 6a4a9b91..00000000 --- a/db/seeds/UsersSeeder.php +++ /dev/null @@ -1,63 +0,0 @@ - 1, - 'name' => 'Bob Burnquist', - 'email' => 'bob@phalcon.io', - 'password' => '$2y$08$L3Vqdk9ydm9PZktqMWRQO.bjO.rV4a7GJACZKEeCskzxWbT570Z2a', // password1 - 'mustChangePassword' => 'N', - 'profilesId' => 1, - 'banned' => 'N', - 'suspended' => 'N', - 'active' => 'Y', - ], - [ - 'id' => 2, - 'name' => 'Erik', - 'email' => 'erik@phalcon.io', - 'password' => '$2y$08$YU16R3VJV2tVQ3ZhYkdPROaeb9Pvem5jvCPsb95/aB8B6T12wB6Qy', // password2 - 'mustChangePassword' => 'N', - 'profilesId' => 1, - 'banned' => 'N', - 'suspended' => 'N', - 'active' => 'Y', - ], - [ - 'id' => 3, - 'name' => 'Veronica', - 'email' => 'veronica@phalcon.io', - 'password' => '$2y$08$VHR0Q2FyMDIzUkdpQllrQeSXJUl.H91aLDm/tclX2VGvpqxpFog52', // password3 - 'mustChangePassword' => 'N', - 'profilesId' => 1, - 'banned' => 'N', - 'suspended' => 'N', - 'active' => 'Y', - ], - [ - 'id' => 4, - 'name' => 'Yukimi Nagano', - 'email' => 'yukimi@phalcon.io', - 'password' => '$2y$08$Ykw4b0ZNU3VYZUxWRlpEZ.2f0p3OPhjIEVJbh6CGHlYm8XtIeLRqy', // password4 - 'mustChangePassword' => 'N', - 'profilesId' => 2, - 'banned' => 'N', - 'suspended' => 'N', - 'active' => 'Y', - ], - ]; - - $posts = $this->table('users'); - $posts->insert($data) - ->save(); - } -} From 7ce13af385aa2c84d223ac1b3ed81bd8ec6f4cd9 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 20:08:02 +0200 Subject: [PATCH 58/72] Add files via upload --- ...90825181051_create_email_confirmations.php | 25 +++ .../20190825193313_create_failed_logins.php | 24 +++ ...20190825193322_create_password_changes.php | 25 +++ .../20190825193331_create_permissions.php | 24 +++ .../20190825193340_create_profiles.php | 23 +++ .../20190825193346_create_remember_tokens.php | 25 +++ .../20190825193355_create_reset_passwords.php | 26 +++ .../20190825193404_create_success_logins.php | 24 +++ db/migrations/20190825193409_create_users.php | 29 ++++ db/seeds/PermissionsSeeder.php | 152 ++++++++++++++++++ db/seeds/ProfilesSeeder.php | 35 ++++ db/seeds/UsersSeeder.php | 64 ++++++++ 12 files changed, 476 insertions(+) create mode 100644 db/migrations/20190825181051_create_email_confirmations.php create mode 100644 db/migrations/20190825193313_create_failed_logins.php create mode 100644 db/migrations/20190825193322_create_password_changes.php create mode 100644 db/migrations/20190825193331_create_permissions.php create mode 100644 db/migrations/20190825193340_create_profiles.php create mode 100644 db/migrations/20190825193346_create_remember_tokens.php create mode 100644 db/migrations/20190825193355_create_reset_passwords.php create mode 100644 db/migrations/20190825193404_create_success_logins.php create mode 100644 db/migrations/20190825193409_create_users.php create mode 100644 db/seeds/PermissionsSeeder.php create mode 100644 db/seeds/ProfilesSeeder.php create mode 100644 db/seeds/UsersSeeder.php diff --git a/db/migrations/20190825181051_create_email_confirmations.php b/db/migrations/20190825181051_create_email_confirmations.php new file mode 100644 index 00000000..7cde9270 --- /dev/null +++ b/db/migrations/20190825181051_create_email_confirmations.php @@ -0,0 +1,25 @@ +table('email_confirmations'); + if ($table->exists()) { + return; + } + + $table->addColumn('usersId', 'integer') + ->addColumn('code', 'char', ['limit' => 32]) + ->addColumn('createdAt', 'integer') + ->addColumn('modifiedAt', 'integer', ['null' => true]) + ->addColumn('confirmed', 'char', ['limit' => 1, 'default' => 'N']) + ->create(); + } +} diff --git a/db/migrations/20190825193313_create_failed_logins.php b/db/migrations/20190825193313_create_failed_logins.php new file mode 100644 index 00000000..0b307495 --- /dev/null +++ b/db/migrations/20190825193313_create_failed_logins.php @@ -0,0 +1,24 @@ +table('failed_logins'); + if ($table->exists()) { + return; + } + + $table->addColumn('usersId', 'integer', ['null' => true]) + ->addColumn('ipAddress', 'char', ['limit' => 15]) + ->addColumn('attempted', 'integer') + ->addIndex(['usersId']) + ->create(); + } +} diff --git a/db/migrations/20190825193322_create_password_changes.php b/db/migrations/20190825193322_create_password_changes.php new file mode 100644 index 00000000..fc0327a9 --- /dev/null +++ b/db/migrations/20190825193322_create_password_changes.php @@ -0,0 +1,25 @@ +table('password_changes'); + if ($table->exists()) { + return; + } + + $table->addColumn('usersId', 'integer') + ->addColumn('ipAddress', 'char', ['limit' => 15]) + ->addColumn('userAgent', 'text') + ->addColumn('createdAt', 'integer') + ->addIndex(['usersId']) + ->create(); + } +} diff --git a/db/migrations/20190825193331_create_permissions.php b/db/migrations/20190825193331_create_permissions.php new file mode 100644 index 00000000..9ceb748b --- /dev/null +++ b/db/migrations/20190825193331_create_permissions.php @@ -0,0 +1,24 @@ +table('permissions'); + if ($table->exists()) { + return; + } + + $table->addColumn('profilesId', 'integer') + ->addColumn('resource', 'string', ['limit' => 255]) + ->addColumn('action', 'string', ['limit' => 255]) + ->addIndex(['profilesId']) + ->create(); + } +} diff --git a/db/migrations/20190825193340_create_profiles.php b/db/migrations/20190825193340_create_profiles.php new file mode 100644 index 00000000..1464bf7f --- /dev/null +++ b/db/migrations/20190825193340_create_profiles.php @@ -0,0 +1,23 @@ +table('profiles'); + if ($table->exists()) { + return; + } + + $table->addColumn('name', 'string', ['limit' => 64]) + ->addColumn('active', 'char', ['limit' => 1]) + ->addIndex(['active']) + ->create(); + } +} diff --git a/db/migrations/20190825193346_create_remember_tokens.php b/db/migrations/20190825193346_create_remember_tokens.php new file mode 100644 index 00000000..4d954411 --- /dev/null +++ b/db/migrations/20190825193346_create_remember_tokens.php @@ -0,0 +1,25 @@ +table('remember_tokens'); + if ($table->exists()) { + return; + } + + $table->addColumn('usersId', 'integer') + ->addColumn('token', 'char', ['limit' => 32]) + ->addColumn('userAgent', 'text') + ->addColumn('createdAt', 'integer') + ->addIndex(['token']) + ->create(); + } +} diff --git a/db/migrations/20190825193355_create_reset_passwords.php b/db/migrations/20190825193355_create_reset_passwords.php new file mode 100644 index 00000000..acde2958 --- /dev/null +++ b/db/migrations/20190825193355_create_reset_passwords.php @@ -0,0 +1,26 @@ +table('reset_passwords'); + if ($table->exists()) { + return; + } + + $table->addColumn('usersId', 'integer') + ->addColumn('code', 'integer') + ->addColumn('createdAt', 'integer') + ->addColumn('modifiedAt', 'integer') + ->addColumn('reset', 'char', ['limit' => 1]) + ->addIndex(['usersId']) + ->create(); + } +} diff --git a/db/migrations/20190825193404_create_success_logins.php b/db/migrations/20190825193404_create_success_logins.php new file mode 100644 index 00000000..079cb6e0 --- /dev/null +++ b/db/migrations/20190825193404_create_success_logins.php @@ -0,0 +1,24 @@ +table('success_logins'); + if ($table->exists()) { + return; + } + + $table->addColumn('usersId', 'integer') + ->addColumn('ipAddress', 'char', ['limit' => 15]) + ->addColumn('userAgent', 'text') + ->addIndex(['usersId']) + ->create(); + } +} diff --git a/db/migrations/20190825193409_create_users.php b/db/migrations/20190825193409_create_users.php new file mode 100644 index 00000000..13af1d70 --- /dev/null +++ b/db/migrations/20190825193409_create_users.php @@ -0,0 +1,29 @@ +table('users'); + if ($table->exists()) { + return; + } + + $table->addColumn('name', 'string', ['limit' => 255]) + ->addColumn('email', 'string', ['limit' => 255]) + ->addColumn('password', 'char', ['limit' => 60]) + ->addColumn('mustChangePassword', 'char', ['limit' => 1]) + ->addColumn('profilesId', 'integer') + ->addColumn('banned', 'char', ['limit' => 1]) + ->addColumn('suspended', 'char', ['limit' => 1]) + ->addColumn('active', 'char', ['limit' => 1, 'default' => null, 'null' => true]) + ->addIndex(['profilesId']) + ->create(); + } +} diff --git a/db/seeds/PermissionsSeeder.php b/db/seeds/PermissionsSeeder.php new file mode 100644 index 00000000..aab90576 --- /dev/null +++ b/db/seeds/PermissionsSeeder.php @@ -0,0 +1,152 @@ + 1, + 'profilesId' => 3, + 'resource' => 'users', + 'action' => 'index', + ], + [ + 'id' => 2, + 'profilesId' => 3, + 'resource' => 'users', + 'action' => 'search', + ], + [ + 'id' => 3, + 'profilesId' => 3, + 'resource' => 'profiles', + 'action' => 'index', + ], + [ + 'id' => 4, + 'profilesId' => 3, + 'resource' => 'profiles', + 'action' => 'search', + ], + [ + 'id' => 5, + 'profilesId' => 1, + 'resource' => 'users', + 'action' => 'index', + ], + [ + 'id' => 6, + 'profilesId' => 1, + 'resource' => 'users', + 'action' => 'search', + ], + [ + 'id' => 7, + 'profilesId' => 1, + 'resource' => 'users', + 'action' => 'edit', + ], + [ + 'id' => 8, + 'profilesId' => 1, + 'resource' => 'users', + 'action' => 'create', + ], + [ + 'id' => 9, + 'profilesId' => 1, + 'resource' => 'users', + 'action' => 'delete', + ], + [ + 'id' => 10, + 'profilesId' => 1, + 'resource' => 'users', + 'action' => 'changePassword', + ], + [ + 'id' => 11, + 'profilesId' => 1, + 'resource' => 'profiles', + 'action' => 'index', + ], + [ + 'id' => 12, + 'profilesId' => 1, + 'resource' => 'profiles', + 'action' => 'search', + ], + [ + 'id' => 13, + 'profilesId' => 1, + 'resource' => 'profiles', + 'action' => 'edit', + ], + [ + 'id' => 14, + 'profilesId' => 1, + 'resource' => 'profiles', + 'action' => 'create', + ], + [ + 'id' => 15, + 'profilesId' => 1, + 'resource' => 'profiles', + 'action' => 'delete', + ], + [ + 'id' => 16, + 'profilesId' => 1, + 'resource' => 'permissions', + 'action' => 'index', + ], + [ + 'id' => 17, + 'profilesId' => 2, + 'resource' => 'users', + 'action' => 'index', + ], + [ + 'id' => 18, + 'profilesId' => 2, + 'resource' => 'users', + 'action' => 'search', + ], + [ + 'id' => 19, + 'profilesId' => 2, + 'resource' => 'users', + 'action' => 'edit', + ], + [ + 'id' => 20, + 'profilesId' => 2, + 'resource' => 'users', + 'action' => 'create', + ], + [ + 'id' => 21, + 'profilesId' => 2, + 'resource' => 'profiles', + 'action' => 'index', + ], + [ + 'id' => 22, + 'profilesId' => 2, + 'resource' => 'profiles', + 'action' => 'search', + ], + ]; + + $posts = $this->table('permissions'); + $posts->insert($data) + ->save(); + } +} diff --git a/db/seeds/ProfilesSeeder.php b/db/seeds/ProfilesSeeder.php new file mode 100644 index 00000000..c229cd91 --- /dev/null +++ b/db/seeds/ProfilesSeeder.php @@ -0,0 +1,35 @@ + 1, + 'name' => 'Administrators', + 'active' => 'Y', + ], + [ + 'id' => 2, + 'name' => 'Users', + 'active' => 'Y', + ], + [ + 'id' => 3, + 'name' => 'Read-Only', + 'active' => 'Y', + ], + ]; + + $posts = $this->table('profiles'); + $posts->insert($data) + ->save(); + } +} diff --git a/db/seeds/UsersSeeder.php b/db/seeds/UsersSeeder.php new file mode 100644 index 00000000..b1ecd653 --- /dev/null +++ b/db/seeds/UsersSeeder.php @@ -0,0 +1,64 @@ + 1, + 'name' => 'Bob Burnquist', + 'email' => 'bob@phalcon.io', + 'password' => '$2y$08$L3Vqdk9ydm9PZktqMWRQO.bjO.rV4a7GJACZKEeCskzxWbT570Z2a', // password1 + 'mustChangePassword' => 'N', + 'profilesId' => 1, + 'banned' => 'N', + 'suspended' => 'N', + 'active' => 'Y', + ], + [ + 'id' => 2, + 'name' => 'Erik', + 'email' => 'erik@phalcon.io', + 'password' => '$2y$08$YU16R3VJV2tVQ3ZhYkdPROaeb9Pvem5jvCPsb95/aB8B6T12wB6Qy', // password2 + 'mustChangePassword' => 'N', + 'profilesId' => 1, + 'banned' => 'N', + 'suspended' => 'N', + 'active' => 'Y', + ], + [ + 'id' => 3, + 'name' => 'Veronica', + 'email' => 'veronica@phalcon.io', + 'password' => '$2y$08$VHR0Q2FyMDIzUkdpQllrQeSXJUl.H91aLDm/tclX2VGvpqxpFog52', // password3 + 'mustChangePassword' => 'N', + 'profilesId' => 1, + 'banned' => 'N', + 'suspended' => 'N', + 'active' => 'Y', + ], + [ + 'id' => 4, + 'name' => 'Yukimi Nagano', + 'email' => 'yukimi@phalcon.io', + 'password' => '$2y$08$Ykw4b0ZNU3VYZUxWRlpEZ.2f0p3OPhjIEVJbh6CGHlYm8XtIeLRqy', // password4 + 'mustChangePassword' => 'N', + 'profilesId' => 2, + 'banned' => 'N', + 'suspended' => 'N', + 'active' => 'Y', + ], + ]; + + $posts = $this->table('users'); + $posts->insert($data) + ->save(); + } +} From 5e4a23c728fda5309920c5346af82b6267683ea8 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 20:28:17 +0200 Subject: [PATCH 59/72] Update Acl.php --- src/Plugins/Acl/Acl.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Plugins/Acl/Acl.php b/src/Plugins/Acl/Acl.php index ff30a59c..59d3fd25 100644 --- a/src/Plugins/Acl/Acl.php +++ b/src/Plugins/Acl/Acl.php @@ -234,23 +234,24 @@ protected function getFilePath() $this->filePath = rtrim($this->config->application->cacheDir, '\\/') . '/acl/data.txt'; - return $this->filePath; - } + return $this->filePath; + } /** * Adds an array of private resources to the ACL object. * * @param array $resources */ - public function addPrivateResources(array $resources) - { - if (empty($resources)) { - return; - } + public function addPrivateResources(array $resources) + { + if (empty($resources)) { + return; + } - $this->privateResources = array_merge($this->privateResources, $resources); - if (is_object($this->acl)) { - $this->acl = $this->rebuild(); + $this->privateResources = array_merge($this->privateResources, $resources); + if (is_object($this->acl)) { + $this->acl = $this->rebuild(); + } } } } From 94a5243fc0a6a4fccb1664c4b291c9c4fff75e78 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 21:05:40 +0200 Subject: [PATCH 60/72] Update AssetsProvider.php --- src/Providers/AssetsProvider.php | 87 ++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 37 deletions(-) diff --git a/src/Providers/AssetsProvider.php b/src/Providers/AssetsProvider.php index 5dd9129d..11e387e9 100644 --- a/src/Providers/AssetsProvider.php +++ b/src/Providers/AssetsProvider.php @@ -1,5 +1,4 @@ getShared('tag')); - - $di->setShared($this->providerName, function () use ($assetManager) { + /** @var TagFactory $tagFactory */ + $tagFactory = $di->getShared('tag'); - $assetManager->collection('css') - ->addCss( - '//stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css?dc=' . self::VERSION, - false, - false, - [ - "media" => "screen,projection", - "integrity" => "sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T", - "crossorigin" => "anonymous" - ] - ) - ->addCss('/css/style.css?dc=' . self::VERSION, true, true, [ - "media" => "screen,projection" - ]); + $di->setShared( + $this->providerName, + function () use ($tagFactory) { + $assetManager = new Manager($tagFactory); + $assetManager->collection('css') + ->addCss( + '//cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css?dc=' . self::VERSION, + false, + false, + [ + 'media' => 'screen,projection', + 'integrity' => 'sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N', + 'crossorigin' => 'anonymous' + ] + ) + ->addCss('/css/style.css?dc=' . self::VERSION, true, true, [ + 'media' => 'screen,projection' + ]) + ; - $assetManager->collection('js') - ->addJs('//code.jquery.com/jquery-3.3.1.slim.min.js?dc=' . self::VERSION, false, true, [ - "integrity" => "sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo", - "crossorigin" => "anonymous" - ]) - ->addJs( - '//stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js?dc=' . self::VERSION, - false, - true, - [ - "integrity" => "sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM", - "crossorigin" => "anonymous" - ] - ); + $assetManager->collection('js') + ->addJs( + '//code.jquery.com/jquery-3.6.1.slim.min.js?dc=' . self::VERSION, + false, + true, + [ + 'integrity' => 'sha256-w8CvhFs7iHNVUtnSP0YKEg00p9Ih13rlL9zGqvLdePA=', + 'crossorigin' => 'anonymous' + ] + ) + ->addJs( + '//cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.min.js?dc=' . self::VERSION, + false, + true, + [ + 'integrity' => 'sha384-+sLIOodYLS7CIrQpBjl+C7nPvqq+FbNUBDunl/OZv93DB7Ln/533i8e/mZXLi/P+', + 'crossorigin' => 'anonymous' + ] + ) + ; - return $assetManager; - }); + return $assetManager; + } + ); } } From 20635e26917731d14cdf5b7815215a5c56483f20 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 21:18:49 +0200 Subject: [PATCH 61/72] Update Acl.php --- src/Plugins/Acl/Acl.php | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/Plugins/Acl/Acl.php b/src/Plugins/Acl/Acl.php index 59d3fd25..90ba9e7f 100644 --- a/src/Plugins/Acl/Acl.php +++ b/src/Plugins/Acl/Acl.php @@ -1,5 +1,4 @@ @@ -88,7 +89,9 @@ public function isPrivate($controllerName): bool */ public function isAllowed($profile, $controller, $action): bool { - return $this->getAcl()->isAllowed($profile, $controller, $action); + return $this->getAcl() + ->isAllowed($profile, $controller, $action) + ; } /** @@ -232,26 +235,25 @@ protected function getFilePath() { if (true === empty($this->filePath)) { $this->filePath = rtrim($this->config->application->cacheDir, '\\/') . '/acl/data.txt'; - - - return $this->filePath; } + return $this->filePath; + } + /** * Adds an array of private resources to the ACL object. * * @param array $resources */ - public function addPrivateResources(array $resources) - { - if (empty($resources)) { - return; - } + public function addPrivateResources(array $resources) + { + if (empty($resources)) { + return; + } - $this->privateResources = array_merge($this->privateResources, $resources); - if (is_object($this->acl)) { - $this->acl = $this->rebuild(); - } + $this->privateResources = array_merge($this->privateResources, $resources); + if (is_object($this->acl)) { + $this->acl = $this->rebuild(); } } } From e923694708feba51fdeeeaef5909709d92a7aa7d Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 21:19:40 +0200 Subject: [PATCH 62/72] Update AclProvider.php --- src/Providers/AclProvider.php | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/Providers/AclProvider.php b/src/Providers/AclProvider.php index f4bbcf65..cc4431bf 100644 --- a/src/Providers/AclProvider.php +++ b/src/Providers/AclProvider.php @@ -1,5 +1,4 @@ getRootPath(); - $di->setShared($this->providerName, function () use ($rootPath) { - $filename = $rootPath . '/config/acl.php'; - $privateResources = []; - if (is_readable($filename)) { - $privateResources = include $filename; - if (!empty($privateResources['private'])) { - $privateResources = $privateResources['private']; + $di->setShared( + $this->providerName, + function () use ($rootPath) { + $filename = $rootPath . '/config/acl.php'; + $privateResources = []; + if (is_readable($filename)) { + $privateResources = include $filename; + if (!empty($privateResources['private'])) { + $privateResources = $privateResources['private']; + } } - } - $acl = new Acl(); - $acl->addPrivateResources($privateResources); + $acl = new Acl(); + $acl->addPrivateResources($privateResources); - return $acl; - }); + return $acl; + } + ); } } From 2ef3f9ca07cd21eb6b623db44191823be845f3f8 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 21:30:26 +0200 Subject: [PATCH 63/72] Update SessionBagProvider.php --- src/Providers/SessionBagProvider.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Providers/SessionBagProvider.php b/src/Providers/SessionBagProvider.php index 44217829..58b48e23 100644 --- a/src/Providers/SessionBagProvider.php +++ b/src/Providers/SessionBagProvider.php @@ -1,5 +1,4 @@ set($this->providerName, function () { - return new Bag($this->getShared('session'), 'conditions'); - }); + $session = $di->get('session'); + $di->set( + $this->providerName, + function () use ($session) { + return new Bag($session, 'conditions'); + } + ); } } From 53638a6eef53ac42455e135945d8b152984588fc Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 21:33:03 +0200 Subject: [PATCH 64/72] Update ModelsMetadataProvider.php --- src/Providers/ModelsMetadataProvider.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/Providers/ModelsMetadataProvider.php b/src/Providers/ModelsMetadataProvider.php index 57f1ae61..ea3ebb70 100644 --- a/src/Providers/ModelsMetadataProvider.php +++ b/src/Providers/ModelsMetadataProvider.php @@ -1,5 +1,4 @@ getShared('config')->path('application.cacheDir'); - $di->set($this->providerName, function () use ($cacheDir) { - return new MetaDataAdapter([ - 'metaDataDir' => $cacheDir . 'metaData/', - ]); - }); + $cacheDir = $di->getShared('config') + ->path('application.cacheDir') + ; + $di->set( + $this->providerName, + function () use ($cacheDir) { + return new MetaDataAdapter( + [ + 'metaDataDir' => $cacheDir . 'metaData/', + ] + ); + } + ); } } From cada1f040e0f2afad8311074966f624c2b7083fc Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 21:37:51 +0200 Subject: [PATCH 65/72] Update ModelsMetadataProvider.php --- src/Providers/ModelsMetadataProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Providers/ModelsMetadataProvider.php b/src/Providers/ModelsMetadataProvider.php index ea3ebb70..c0b09e05 100644 --- a/src/Providers/ModelsMetadataProvider.php +++ b/src/Providers/ModelsMetadataProvider.php @@ -15,7 +15,7 @@ use Phalcon\Di\DiInterface; use Phalcon\Di\ServiceProviderInterface; -use Phalcon\Mvc\Model\Metadata\Stream as MetaDataAdapter; +use Phalcon\Mvc\Model\MetaData\Stream as MetaDataAdapter; class ModelsMetadataProvider implements ServiceProviderInterface { From b64e891a380bfaf3475e5207ed70fab72bc0ef32 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sat, 28 Jan 2023 22:17:26 +0200 Subject: [PATCH 66/72] Update providers.php --- config/providers.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/providers.php b/config/providers.php index d590b024..4dd4eacd 100644 --- a/config/providers.php +++ b/config/providers.php @@ -23,8 +23,8 @@ use Vokuro\Providers\ModelsMetadataProvider; use Vokuro\Providers\RouterProvider; use Vokuro\Providers\SecurityProvider; -use Vokuro\Providers\SessionBagProvider; use Vokuro\Providers\SessionProvider; +use Vokuro\Providers\SessionBagProvider; use Vokuro\Providers\UrlProvider; use Vokuro\Providers\ViewProvider; use Vokuro\Providers\AssetsProvider; @@ -41,8 +41,8 @@ MailProvider::class, ModelsMetadataProvider::class, RouterProvider::class, - SessionBagProvider::class, SessionProvider::class, + SessionBagProvider::class, SecurityProvider::class, UrlProvider::class, ViewProvider::class, From 86dcad8bb5d626610e2daf8a4bf6ab7c8f489f5c Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sun, 29 Jan 2023 19:14:47 +0200 Subject: [PATCH 67/72] Update Application.php --- src/Application.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Application.php b/src/Application.php index 1f9dad88..4a060d5f 100644 --- a/src/Application.php +++ b/src/Application.php @@ -1,5 +1,4 @@ di = new FactoryDefault(); - $this->app = $this->createApplication(); + $this->di = new FactoryDefault(); + $this->app = $this->createApplication(); $this->rootPath = $rootPath; $this->di->setShared(self::APPLICATION_PROVIDER, $this); @@ -111,7 +112,7 @@ protected function initializeProviders(): void $providers = include_once $filename; foreach ($providers as $providerClass) { /** @var ServiceProviderInterface $provider */ - $provider = new $providerClass; + $provider = new $providerClass(); $provider->register($this->di); } } From 21b25f3fbdfa8787c0af4ec80a2ab087ac3b41fa Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sun, 29 Jan 2023 19:25:34 +0200 Subject: [PATCH 68/72] Update DbProvider.php --- src/Providers/DbProvider.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Providers/DbProvider.php b/src/Providers/DbProvider.php index fcd793ab..ede94768 100644 --- a/src/Providers/DbProvider.php +++ b/src/Providers/DbProvider.php @@ -1,5 +1,4 @@ Pdo\Mysql::class, 'pgsql' => Pdo\Postgresql::class, 'sqlite' => Pdo\Sqlite::class, @@ -47,13 +49,18 @@ class DbProvider implements ServiceProviderInterface public function register(DiInterface $di): void { /** @var Config $config */ - $config = $di->getShared('config')->get('database'); + $config = $di->getShared('config') + ->get('database') + ; $class = $this->getClass($config); $config = $this->createConfig($config); - $di->set($this->providerName, function () use ($class, $config) { - return new $class($config); - }); + $di->set( + $this->providerName, + function () use ($class, $config) { + return new $class($config); + } + ); } /** From 99da5b9388099b7926edb3e3c3ed35aae94a40d7 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Sun, 29 Jan 2023 19:27:39 +0200 Subject: [PATCH 69/72] Update FlashProvider.php --- src/Providers/FlashProvider.php | 35 +++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/Providers/FlashProvider.php b/src/Providers/FlashProvider.php index 9295f4d3..3e740781 100644 --- a/src/Providers/FlashProvider.php +++ b/src/Providers/FlashProvider.php @@ -1,5 +1,4 @@ set($this->providerName, function () { - $escaper = new Escaper(); - $flash = new Flash($escaper); - $flash->setImplicitFlush(false); - $flash->setCssClasses([ - 'error' => 'alert alert-danger', - 'success' => 'alert alert-success', - 'notice' => 'alert alert-info', - 'warning' => 'alert alert-warning', - ]); + $escaper = $di->getShared('escaper'); + $di->set( + $this->providerName, + function () use ($escaper) { + $flash = new Flash($escaper); + $flash->setImplicitFlush(false); + $flash->setCssClasses( + [ + 'error' => 'alert alert-danger', + 'success' => 'alert alert-success', + 'notice' => 'alert alert-info', + 'warning' => 'alert alert-warning', + ] + ); - return $flash; - }); + return $flash; + } + ); } } From 068be110ddd4672f2a94adc10e125f91866fbc38 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Mon, 30 Jan 2023 14:57:27 +0200 Subject: [PATCH 70/72] link_to -> tag.a with added url tag.a does not resolve the correct url as link_to added url --- themes/vokuro/layouts/private.volt | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/themes/vokuro/layouts/private.volt b/themes/vokuro/layouts/private.volt index 8f884334..b07615c9 100644 --- a/themes/vokuro/layouts/private.volt +++ b/themes/vokuro/layouts/private.volt @@ -1,14 +1,20 @@ {%- set menus = [ - 'Home': null, - 'Users': 'users', - 'Profiles': 'profiles', - 'Permissions': 'permissions' + 'Home': url('/'), + 'Users': url('users'), + 'Profiles': url('profiles'), + 'Permissions': url('permissions') ] -%} From 6ce9293215250b8bad6b9fb7175e7a2b586759a3 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Tue, 31 Jan 2023 11:21:22 +0200 Subject: [PATCH 71/72] Update private.volt --- themes/vokuro/layouts/private.volt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/vokuro/layouts/private.volt b/themes/vokuro/layouts/private.volt index b07615c9..329a5802 100644 --- a/themes/vokuro/layouts/private.volt +++ b/themes/vokuro/layouts/private.volt @@ -38,10 +38,10 @@ {{ auth.getName() }} - + From 7fd83be2648f2b0bb8a15e4dabb362966e322ac8 Mon Sep 17 00:00:00 2001 From: Sea man <31950816+shenyman@users.noreply.github.com> Date: Wed, 19 Jul 2023 10:08:50 +0300 Subject: [PATCH 72/72] Update composer.json edited ext-phalcon to ^5.0.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 02094539..99c3697b 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "require": { "php": ">=7.4", "ext-openssl": "*", - "ext-phalcon": "~5.0.0", + "ext-phalcon": "^5.0.0", "robmorgan/phinx": "^0.12.12", "symfony/mailer": "^6.0", "vlucas/phpdotenv": "^5.4"