From 1cee92766851bf4ce8dbd00c70ea10ae5dd35cd0 Mon Sep 17 00:00:00 2001 From: Daksh Mehta Date: Sun, 2 Aug 2020 15:47:32 +0530 Subject: [PATCH 01/10] Composer bumped --- .gitignore | 1 + Modules/.gitignore | 2 ++ Modules/Core/composer.json | 10 +++++----- Modules/Menu/composer.json | 6 +++--- composer.json | 24 ++++++++++++++++++------ phpunit.xml | 4 ++-- 6 files changed, 31 insertions(+), 16 deletions(-) create mode 100644 Modules/.gitignore diff --git a/.gitignore b/.gitignore index 0824827b9..bd6b26234 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /node_modules /public/hot /public/storage +/public/modules/* /storage/*.key /vendor Homestead.json diff --git a/Modules/.gitignore b/Modules/.gitignore new file mode 100644 index 000000000..c96a04f00 --- /dev/null +++ b/Modules/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/Modules/Core/composer.json b/Modules/Core/composer.json index 2a14725e7..98740aea8 100644 --- a/Modules/Core/composer.json +++ b/Modules/Core/composer.json @@ -22,14 +22,14 @@ "require": { "php": "^7.1.3", "composer/installers": "~1.0", - "nwidart/laravel-modules": "^4.0", - "laravelcollective/html": "5.7.*", + "nwidart/laravel-modules": "^5.0", + "laravelcollective/html": "5.8.*", "laracasts/presenter": "~0.2", - "dimsav/laravel-translatable": "~9.0", - "mcamara/laravel-localization": "~1.3", + "dimsav/laravel-translatable": "~10.0", + "mcamara/laravel-localization": "~1.5", "floatingpoint/stylist": "~0.5", "maatwebsite/laravel-sidebar": "~2.1", - "yajra/laravel-datatables-oracle": "~8.0", + "yajra/laravel-datatables-oracle": "~9.0", "tightenco/ziggy": "~0.4" }, "require-dev": { diff --git a/Modules/Menu/composer.json b/Modules/Menu/composer.json index 0d231826c..f16319d05 100644 --- a/Modules/Menu/composer.json +++ b/Modules/Menu/composer.json @@ -24,12 +24,12 @@ "require": { "php": "^7.1.3", "composer/installers": "~1.0", - "nwidart/laravel-menus": "^3.0", + "nwidart/laravel-menus": "^4.0", "typicms/nestablecollection": "1.1.12" }, "require-dev": { - "phpunit/phpunit": "~7.0", - "orchestra/testbench": "3.6.*", + "phpunit/phpunit": "~7.5", + "orchestra/testbench": "3.8.*", "fzaninotto/faker": "1.4.0", "doctrine/dbal": "~2.5", "idavoll/page-module": "4.0.x-dev" diff --git a/composer.json b/composer.json index 36cfe5941..1110e1fe3 100644 --- a/composer.json +++ b/composer.json @@ -10,12 +10,21 @@ ], "license": "MIT", "type": "project", + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/dakshhmehta/Menu.git" + }, + { + "type": "vcs", + "url": "https://github.com/dakshhmehta/Core.git" + } + ], "require": { "php": "^7.1.3", "fideloper/proxy": "^4.0", - "laravel/framework": "5.7.*", + "laravel/framework": "5.8.*", "laravel/tinker": "^1.0", - "nwidart/laravel-modules": "^4.0", "cartalyst/sentinel": "^2.0", "idavoll/adminlte-theme": "4.0.x-dev", "idavoll/core-module": "4.0.x-dev", @@ -38,11 +47,14 @@ "league/commonmark": "^0.18.3", "league/flysystem-aws-s3-v3": "^1.0", "mockery/mockery": "^1.0", - "nunomaduro/collision": "^2.0", - "orchestra/testbench": "3.7.*", - "phpunit/phpunit": "^7.0", + "nunomaduro/collision": "^3.0", + "orchestra/testbench": "3.8.*", + "phpunit/phpunit": "^7.5", "predis/predis": "^1.1", - "roave/security-advisories": "dev-master" + "roave/security-advisories": "dev-master", + + "tormjens/eventy": "^0.6", + "spatie/laravel-activitylog": "3.9.1" }, "autoload": { "classmap": [ diff --git a/phpunit.xml b/phpunit.xml index 372a2bc1d..55178116b 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -12,7 +12,7 @@ ./Modules/Core/Tests/ - + From 28c2aeae8ea172b2fea7f8e3179f6353e4d27c99 Mon Sep 17 00:00:00 2001 From: Daksh Mehta Date: Sun, 2 Aug 2020 15:54:03 +0530 Subject: [PATCH 02/10] Test refactor for testbench 3.8 compatibility --- Modules/.gitignore | 11 +++++++++-- Modules/Core/Tests/Asset/AsgardAssetManagerTest.php | 4 ++-- Modules/Core/Tests/Asset/AsgardAssetPipelineTest.php | 6 +++--- Modules/Core/Tests/Asset/AssetFactoryTest.php | 6 +++--- Modules/Core/Tests/BaseTestCase.php | 2 +- Modules/Core/Tests/TestBrowserTest.php | 2 +- Modules/Core/Tests/Theme/ThemeManagerTest.php | 2 +- Modules/Core/Tests/Theme/ThemeTest.php | 2 +- 8 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Modules/.gitignore b/Modules/.gitignore index c96a04f00..7585aeafb 100644 --- a/Modules/.gitignore +++ b/Modules/.gitignore @@ -1,2 +1,9 @@ -* -!.gitignore \ No newline at end of file +Activity/ +Contact/ +CourierTracking/ +Faq/ +Location/ +Rarv/ +StationaryPrint/ +Task/ +Transaction/ \ No newline at end of file diff --git a/Modules/Core/Tests/Asset/AsgardAssetManagerTest.php b/Modules/Core/Tests/Asset/AsgardAssetManagerTest.php index 3bbe19896..110ce97d7 100644 --- a/Modules/Core/Tests/Asset/AsgardAssetManagerTest.php +++ b/Modules/Core/Tests/Asset/AsgardAssetManagerTest.php @@ -12,9 +12,9 @@ class AsgardAssetManagerTest extends BaseTestCase */ private $assetManager; - public function setUp() + protected function setUp():void { - parent::__construct(); + parent::setUp(); $this->assetManager = new AsgardAssetManager(); } diff --git a/Modules/Core/Tests/Asset/AsgardAssetPipelineTest.php b/Modules/Core/Tests/Asset/AsgardAssetPipelineTest.php index d378a9b64..9aea79b4a 100644 --- a/Modules/Core/Tests/Asset/AsgardAssetPipelineTest.php +++ b/Modules/Core/Tests/Asset/AsgardAssetPipelineTest.php @@ -19,10 +19,10 @@ class AsgardAssetPipelineTest extends BaseTestCase /** * */ - public function setUp() + protected function setUp():void { - parent::__construct(); - $this->refreshApplication(); + parent::setUp(); + $this->assetPipeline = new AsgardAssetPipeline($this->app['Modules\Core\Foundation\Asset\Manager\AssetManager']); $this->assetManager = $this->app['Modules\Core\Foundation\Asset\Manager\AssetManager']; } diff --git a/Modules/Core/Tests/Asset/AssetFactoryTest.php b/Modules/Core/Tests/Asset/AssetFactoryTest.php index 34ea99295..6fbaa0133 100644 --- a/Modules/Core/Tests/Asset/AssetFactoryTest.php +++ b/Modules/Core/Tests/Asset/AssetFactoryTest.php @@ -13,10 +13,10 @@ class AssetFactoryTest extends BaseTestCase */ private $assetFactory; - public function setUp() + protected function setUp():void { - parent::__construct(); - $this->refreshApplication(); + parent::setUp(); + $this->assetFactory = app(AssetTypeFactory::class); } diff --git a/Modules/Core/Tests/BaseTestCase.php b/Modules/Core/Tests/BaseTestCase.php index e471c54ab..d1b18312f 100644 --- a/Modules/Core/Tests/BaseTestCase.php +++ b/Modules/Core/Tests/BaseTestCase.php @@ -8,7 +8,7 @@ abstract class BaseTestCase extends TestCase { protected $app; - public function setUp() + protected function setUp():void { parent::setUp(); $this->refreshApplication(); diff --git a/Modules/Core/Tests/TestBrowserTest.php b/Modules/Core/Tests/TestBrowserTest.php index 89c1a04ff..c63615f96 100644 --- a/Modules/Core/Tests/TestBrowserTest.php +++ b/Modules/Core/Tests/TestBrowserTest.php @@ -9,7 +9,7 @@ abstract class TestBrowserTest extends BaseTestCase { - public function setUp() + protected function setUp():void { parent::setUp(); diff --git a/Modules/Core/Tests/Theme/ThemeManagerTest.php b/Modules/Core/Tests/Theme/ThemeManagerTest.php index b1caacf7e..62bbab42b 100644 --- a/Modules/Core/Tests/Theme/ThemeManagerTest.php +++ b/Modules/Core/Tests/Theme/ThemeManagerTest.php @@ -15,7 +15,7 @@ class ThemeManagerTest extends BaseTestCase /** * */ - public function setUp() + protected function setUp():void { parent::setUp(); diff --git a/Modules/Core/Tests/Theme/ThemeTest.php b/Modules/Core/Tests/Theme/ThemeTest.php index 426f3e125..53f708100 100644 --- a/Modules/Core/Tests/Theme/ThemeTest.php +++ b/Modules/Core/Tests/Theme/ThemeTest.php @@ -12,7 +12,7 @@ class ThemeTest extends BaseTestCase */ protected $theme; - public function setUp() + protected function setUp():void { parent::setUp(); From f1c10837270a333409cc9056339a689ee8716c15 Mon Sep 17 00:00:00 2001 From: Daksh Mehta Date: Sun, 2 Aug 2020 16:01:29 +0530 Subject: [PATCH 03/10] Workshop module test refactor for testbench 3.8 compatibility --- Modules/Workshop/Tests/BaseTestCase.php | 2 +- Modules/Workshop/Tests/ModuleScaffoldTest.php | 4 ++-- Modules/Workshop/Tests/ThemeScaffoldTest.php | 4 ++-- phpunit.xml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Modules/Workshop/Tests/BaseTestCase.php b/Modules/Workshop/Tests/BaseTestCase.php index 02761b6f4..022700464 100644 --- a/Modules/Workshop/Tests/BaseTestCase.php +++ b/Modules/Workshop/Tests/BaseTestCase.php @@ -13,7 +13,7 @@ abstract class BaseTestCase extends TestCase { - public function setUp() + protected function setUp():void { parent::setUp(); } diff --git a/Modules/Workshop/Tests/ModuleScaffoldTest.php b/Modules/Workshop/Tests/ModuleScaffoldTest.php index 1707035fa..f7ea4f0c9 100644 --- a/Modules/Workshop/Tests/ModuleScaffoldTest.php +++ b/Modules/Workshop/Tests/ModuleScaffoldTest.php @@ -28,7 +28,7 @@ class ModuleScaffoldTest extends BaseTestCase */ protected $testModuleSanitizedName; - public function setUp() + protected function setUp():void { $this->testModuleName = 'Testing_The-TestModule'; $this->testModuleSanitizedName = 'TestingTheTestModule'; @@ -104,7 +104,7 @@ private function scaffoldModule($type, $entities, $valueObjects) ->scaffold(); } - public function tearDown() + protected function tearDown():void { if (file_exists(__DIR__ . '/../Modules/')) { self::delTree(__DIR__ . '/../Modules/'); diff --git a/Modules/Workshop/Tests/ThemeScaffoldTest.php b/Modules/Workshop/Tests/ThemeScaffoldTest.php index 046ad3454..374aa9110 100644 --- a/Modules/Workshop/Tests/ThemeScaffoldTest.php +++ b/Modules/Workshop/Tests/ThemeScaffoldTest.php @@ -28,7 +28,7 @@ class ThemeScaffoldTest extends BaseTestCase */ protected $testThemePath; - public function setUp() + protected function setUp():void { parent::setUp(); $this->finder = $this->app['files']; @@ -45,7 +45,7 @@ private function generateFrontendTheme() $this->scaffold->setName($this->testThemeName)->forType('frontend')->setVendor('asgardcms')->generate(); } - public function tearDown() + protected function tearDown():void { $this->finder->deleteDirectory($this->testThemePath); $this->finder->deleteDirectory(base_path("Themes")); diff --git a/phpunit.xml b/phpunit.xml index 55178116b..fe687b40c 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -35,10 +35,10 @@ ./Modules/User/Tests/ - + --> ./Modules/Workshop/Tests/ - --> + From 79fe0766526b5ab5e06b1c535321813756fea034 Mon Sep 17 00:00:00 2001 From: Daksh Mehta Date: Sun, 2 Aug 2020 16:08:44 +0530 Subject: [PATCH 04/10] User module test refactored for testbench 3.8 compatibility --- Modules/User/Tests/ApiUserControllerTest.php | 2 +- Modules/User/Tests/BaseUserTestCase.php | 2 +- Modules/User/Tests/Permissions/PermissionsAdderTest.php | 2 +- Modules/User/Tests/Permissions/PermissionsRemoverTest.php | 2 +- Modules/User/Tests/SentinelRoleRepositoryTest.php | 2 +- Modules/User/Tests/SentinelUserRepositoryTest.php | 2 +- Modules/User/Tests/UserRegistrationTest.php | 2 +- phpunit.xml | 4 ++-- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Modules/User/Tests/ApiUserControllerTest.php b/Modules/User/Tests/ApiUserControllerTest.php index 92f02675c..0373e093f 100644 --- a/Modules/User/Tests/ApiUserControllerTest.php +++ b/Modules/User/Tests/ApiUserControllerTest.php @@ -24,7 +24,7 @@ class ApiUserControllerTest extends BaseUserTestCase */ private $userToken; - public function setUp() + protected function setUp():void { parent::setUp(); $this->user = app(UserRepository::class); diff --git a/Modules/User/Tests/BaseUserTestCase.php b/Modules/User/Tests/BaseUserTestCase.php index ed5dee25d..cc45ea0c0 100644 --- a/Modules/User/Tests/BaseUserTestCase.php +++ b/Modules/User/Tests/BaseUserTestCase.php @@ -10,7 +10,7 @@ abstract class BaseUserTestCase extends TestCase { - public function setUp() + protected function setUp():void { parent::setUp(); diff --git a/Modules/User/Tests/Permissions/PermissionsAdderTest.php b/Modules/User/Tests/Permissions/PermissionsAdderTest.php index 6439e98cc..444ebd6d0 100644 --- a/Modules/User/Tests/Permissions/PermissionsAdderTest.php +++ b/Modules/User/Tests/Permissions/PermissionsAdderTest.php @@ -18,7 +18,7 @@ final class PermissionsAdderTest extends BaseUserTestCase */ private $user; - public function setUp() + protected function setUp():void { parent::setUp(); $this->role = app(RoleRepository::class); diff --git a/Modules/User/Tests/Permissions/PermissionsRemoverTest.php b/Modules/User/Tests/Permissions/PermissionsRemoverTest.php index 08571a52a..32c9e3351 100644 --- a/Modules/User/Tests/Permissions/PermissionsRemoverTest.php +++ b/Modules/User/Tests/Permissions/PermissionsRemoverTest.php @@ -18,7 +18,7 @@ class PermissionsRemoverTest extends BaseUserTestCase */ private $user; - public function setUp() + protected function setUp():void { parent::setUp(); $this->role = app(RoleRepository::class); diff --git a/Modules/User/Tests/SentinelRoleRepositoryTest.php b/Modules/User/Tests/SentinelRoleRepositoryTest.php index adedc387f..e596694f5 100644 --- a/Modules/User/Tests/SentinelRoleRepositoryTest.php +++ b/Modules/User/Tests/SentinelRoleRepositoryTest.php @@ -16,7 +16,7 @@ class SentinelRoleRepositoryTest extends BaseUserTestCase */ private $role; - public function setUp() + protected function setUp():void { parent::setUp(); $this->role = app(RoleRepository::class); diff --git a/Modules/User/Tests/SentinelUserRepositoryTest.php b/Modules/User/Tests/SentinelUserRepositoryTest.php index 777ba7ac2..ad58db9d8 100644 --- a/Modules/User/Tests/SentinelUserRepositoryTest.php +++ b/Modules/User/Tests/SentinelUserRepositoryTest.php @@ -24,7 +24,7 @@ class SentinelUserRepositoryTest extends BaseUserTestCase */ private $user; - public function setUp() + protected function setUp():void { parent::setUp(); $this->role = app(RoleRepository::class); diff --git a/Modules/User/Tests/UserRegistrationTest.php b/Modules/User/Tests/UserRegistrationTest.php index b905b3ff3..ddddf13e4 100644 --- a/Modules/User/Tests/UserRegistrationTest.php +++ b/Modules/User/Tests/UserRegistrationTest.php @@ -17,7 +17,7 @@ class UserRegistrationTest extends BaseUserTestCase */ private $user; - public function setUp() + protected function setUp():void { parent::setUp(); $this->role = app(RoleRepository::class); diff --git a/phpunit.xml b/phpunit.xml index fe687b40c..e6c20bdec 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -32,10 +32,10 @@ ./Modules/Translation/Tests/ - + --> ./Modules/User/Tests/ - --> + ./Modules/Workshop/Tests/ From c582ce2b217244d266af22a42d45e40ca38541a3 Mon Sep 17 00:00:00 2001 From: Daksh Mehta Date: Sun, 2 Aug 2020 16:14:45 +0530 Subject: [PATCH 05/10] Translation module test refactored for testbench 3.8 compatibility --- Modules/Translation/Tests/BaseTranslationTest.php | 2 +- .../Translation/Tests/EloquentTranslationRepositoryTest.php | 2 +- phpunit.xml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/Translation/Tests/BaseTranslationTest.php b/Modules/Translation/Tests/BaseTranslationTest.php index 4cca8c64f..0d8c23e02 100644 --- a/Modules/Translation/Tests/BaseTranslationTest.php +++ b/Modules/Translation/Tests/BaseTranslationTest.php @@ -11,7 +11,7 @@ abstract class BaseTranslationTest extends TestCase { - public function setUp() + protected function setUp():void { parent::setUp(); diff --git a/Modules/Translation/Tests/EloquentTranslationRepositoryTest.php b/Modules/Translation/Tests/EloquentTranslationRepositoryTest.php index dcd3bcde0..a7b253354 100644 --- a/Modules/Translation/Tests/EloquentTranslationRepositoryTest.php +++ b/Modules/Translation/Tests/EloquentTranslationRepositoryTest.php @@ -12,7 +12,7 @@ class EloquentTranslationRepositoryTest extends BaseTranslationTest */ private $translation; - public function setUp() + protected function setUp():void { parent::setUp(); $this->translation = app(TranslationRepository::class); diff --git a/phpunit.xml b/phpunit.xml index e6c20bdec..217758c2b 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -29,10 +29,10 @@ ./Modules/Tag/Tests/ - + --> ./Modules/Translation/Tests/ - --> + ./Modules/User/Tests/ From ec9dc369c860f3a9939480f82b96bf80136a4cd7 Mon Sep 17 00:00:00 2001 From: Daksh Mehta Date: Sun, 2 Aug 2020 16:18:35 +0530 Subject: [PATCH 06/10] Tag module test refactored to testbench 3.8 compatibility --- Modules/Tag/Tests/BaseTestCase.php | 2 +- Modules/Tag/Tests/Integration/EloquentTagRepositoryTest.php | 2 +- Modules/Tag/Tests/Integration/TaggableTraitTest.php | 2 +- Modules/Tag/Tests/TagManagerRepositoryTest.php | 2 +- phpunit.xml | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/Tag/Tests/BaseTestCase.php b/Modules/Tag/Tests/BaseTestCase.php index 94c842c78..16cd33c2b 100644 --- a/Modules/Tag/Tests/BaseTestCase.php +++ b/Modules/Tag/Tests/BaseTestCase.php @@ -12,7 +12,7 @@ abstract class BaseTestCase extends TestCase { - public function setUp() + protected function setUp():void { parent::setUp(); diff --git a/Modules/Tag/Tests/Integration/EloquentTagRepositoryTest.php b/Modules/Tag/Tests/Integration/EloquentTagRepositoryTest.php index 052930d6f..df138563b 100644 --- a/Modules/Tag/Tests/Integration/EloquentTagRepositoryTest.php +++ b/Modules/Tag/Tests/Integration/EloquentTagRepositoryTest.php @@ -17,7 +17,7 @@ class EloquentTagRepositoryTest extends BaseTestCase */ private $tag; - public function setUp() + protected function setUp():void { parent::setUp(); diff --git a/Modules/Tag/Tests/Integration/TaggableTraitTest.php b/Modules/Tag/Tests/Integration/TaggableTraitTest.php index ae219772e..7d0c8f178 100644 --- a/Modules/Tag/Tests/Integration/TaggableTraitTest.php +++ b/Modules/Tag/Tests/Integration/TaggableTraitTest.php @@ -20,7 +20,7 @@ class TaggableTraitTest extends BaseTestCase */ private $page; - public function setUp() + protected function setUp():void { parent::setUp(); diff --git a/Modules/Tag/Tests/TagManagerRepositoryTest.php b/Modules/Tag/Tests/TagManagerRepositoryTest.php index 170e40733..e2c1d4c23 100644 --- a/Modules/Tag/Tests/TagManagerRepositoryTest.php +++ b/Modules/Tag/Tests/TagManagerRepositoryTest.php @@ -13,7 +13,7 @@ class TagManagerRepositoryTest extends BaseTestCase */ private $tagManager; - public function setUp() + protected function setUp():void { parent::setUp(); diff --git a/phpunit.xml b/phpunit.xml index 217758c2b..66359dfdd 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -26,10 +26,10 @@ ./Modules/Setting/Tests/ - + --> ./Modules/Tag/Tests/ - --> + ./Modules/Translation/Tests/ From 170d76e80c94777a4225f704db561bdd5ac013ac Mon Sep 17 00:00:00 2001 From: Daksh Mehta Date: Sun, 2 Aug 2020 16:48:48 +0530 Subject: [PATCH 07/10] Page module test refactored for testbench 3.8 compatibility --- Modules/Page/Tests/BasePageTest.php | 2 +- phpunit.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/Page/Tests/BasePageTest.php b/Modules/Page/Tests/BasePageTest.php index 3e067b1cb..60946be43 100644 --- a/Modules/Page/Tests/BasePageTest.php +++ b/Modules/Page/Tests/BasePageTest.php @@ -21,7 +21,7 @@ abstract class BasePageTest extends TestCase */ protected $page; - public function setUp() + protected function setUp():void { parent::setUp(); diff --git a/phpunit.xml b/phpunit.xml index 66359dfdd..f21cb935f 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -20,11 +20,11 @@ ./Modules/Menu/Tests/ - + --> ./Modules/Page/Tests/ - + From 6ee8766748007ac077f0661fa8cd894df6045c32 Mon Sep 17 00:00:00 2001 From: Daksh Mehta Date: Sun, 2 Aug 2020 17:07:17 +0530 Subject: [PATCH 08/10] Setting/Menu test refactored for testbench 3.8 compatibility. But both module failing testcase due to translatable package issue --- .../Menu/Services/MenuItemUriGenerator.php | 2 +- Modules/Menu/Tests/BaseMenuTest.php | 2 +- .../Tests/EloquentMenuItemRepositoryTest.php | 2 +- .../Menu/Tests/MenuItemUriGeneratorTest.php | 8 +- Modules/Menu/Tests/MenuOrdenerTest.php | 2 +- Modules/Setting/Tests/BaseSettingTest.php | 2 +- .../Tests/EloquentSettingRepositoryTest.php | 2 +- Modules/Setting/Tests/SettingsTest.php | 2 +- config/translatable.php | 130 ++++++++++++++++++ phpunit.xml | 6 +- 10 files changed, 145 insertions(+), 13 deletions(-) create mode 100644 config/translatable.php diff --git a/Modules/Menu/Services/MenuItemUriGenerator.php b/Modules/Menu/Services/MenuItemUriGenerator.php index 2cf678a51..f452c407c 100644 --- a/Modules/Menu/Services/MenuItemUriGenerator.php +++ b/Modules/Menu/Services/MenuItemUriGenerator.php @@ -70,7 +70,7 @@ private function getPageSlug($id, $lang) $translation = $page->translate($lang); if ($translation === null) { - return $page->translate(config('app.fallback_locale'))->slug; + $translation = $page->translate(config('app.fallback_locale')); } return $translation->slug; diff --git a/Modules/Menu/Tests/BaseMenuTest.php b/Modules/Menu/Tests/BaseMenuTest.php index 3f125cda2..85b3da4f1 100644 --- a/Modules/Menu/Tests/BaseMenuTest.php +++ b/Modules/Menu/Tests/BaseMenuTest.php @@ -34,7 +34,7 @@ abstract class BaseMenuTest extends TestCase /** * */ - public function setUp() + protected function setUp():void { parent::setUp(); diff --git a/Modules/Menu/Tests/EloquentMenuItemRepositoryTest.php b/Modules/Menu/Tests/EloquentMenuItemRepositoryTest.php index d14b6f663..43e04a292 100644 --- a/Modules/Menu/Tests/EloquentMenuItemRepositoryTest.php +++ b/Modules/Menu/Tests/EloquentMenuItemRepositoryTest.php @@ -10,7 +10,7 @@ class EloquentMenuItemRepositoryTest extends BaseMenuTest { - public function setUp() + protected function setUp():void { parent::setUp(); } diff --git a/Modules/Menu/Tests/MenuItemUriGeneratorTest.php b/Modules/Menu/Tests/MenuItemUriGeneratorTest.php index 134f19f6a..8ffe1c115 100644 --- a/Modules/Menu/Tests/MenuItemUriGeneratorTest.php +++ b/Modules/Menu/Tests/MenuItemUriGeneratorTest.php @@ -17,7 +17,7 @@ class MenuItemUriGeneratorTest extends BaseMenuTest */ private $menuItemUriGenerator; - public function setUp() + protected function setUp():void { parent::setUp(); $this->page = app(PageRepository::class); @@ -45,6 +45,7 @@ public function it_generates_uri_with_the_parents_slug() { Event::fake(); $this->page->create([ + 'id' => 1, 'is_home' => 1, 'template' => 'default', 'en' => [ @@ -54,12 +55,13 @@ public function it_generates_uri_with_the_parents_slug() ], ]); $this->page->create([ + 'id' => 2, 'is_home' => 0, 'template' => 'default', 'en' => [ 'title' => 'About', - 'slug' => 'about', 'body' => 'My Page Body', + 'slug' => 'about', ], ]); $menu = $this->createMenu('main', 'Main'); @@ -76,7 +78,7 @@ public function it_generates_uri_with_the_parents_slug() ]; $this->menuItem->create($data); - self::assertEquals('awesome-page/about', $this->menuItemUriGenerator->generateUri(2, '1', 'en')); + self::assertEquals('awesome-page/about', $this->menuItemUriGenerator->generateUri(2, 1, 'en')); } /** @test */ diff --git a/Modules/Menu/Tests/MenuOrdenerTest.php b/Modules/Menu/Tests/MenuOrdenerTest.php index 1ec870ef7..170d510f8 100644 --- a/Modules/Menu/Tests/MenuOrdenerTest.php +++ b/Modules/Menu/Tests/MenuOrdenerTest.php @@ -9,7 +9,7 @@ class MenuOrdenerTest extends BaseMenuTest */ protected $menuOrdener; - public function setUp() + protected function setUp():void { parent::setUp(); $this->createMenu('main', 'Main Menu'); diff --git a/Modules/Setting/Tests/BaseSettingTest.php b/Modules/Setting/Tests/BaseSettingTest.php index 38d41642e..992a5cab7 100644 --- a/Modules/Setting/Tests/BaseSettingTest.php +++ b/Modules/Setting/Tests/BaseSettingTest.php @@ -15,7 +15,7 @@ abstract class BaseSettingTest extends TestCase */ protected $settingRepository; - public function setUp() + protected function setUp():void { parent::setUp(); diff --git a/Modules/Setting/Tests/EloquentSettingRepositoryTest.php b/Modules/Setting/Tests/EloquentSettingRepositoryTest.php index 84936ee50..fb3802ca0 100644 --- a/Modules/Setting/Tests/EloquentSettingRepositoryTest.php +++ b/Modules/Setting/Tests/EloquentSettingRepositoryTest.php @@ -10,7 +10,7 @@ class EloquentSettingRepositoryTest extends BaseSettingTest { - public function setUp() + protected function setUp():void { parent::setUp(); } diff --git a/Modules/Setting/Tests/SettingsTest.php b/Modules/Setting/Tests/SettingsTest.php index cf50d8586..71c865b7b 100644 --- a/Modules/Setting/Tests/SettingsTest.php +++ b/Modules/Setting/Tests/SettingsTest.php @@ -9,7 +9,7 @@ class SettingsTest extends BaseSettingTest */ protected $setting; - public function setUp() + protected function setUp():void { parent::setUp(); $this->setting = app('Modules\Setting\Support\Settings'); diff --git a/config/translatable.php b/config/translatable.php new file mode 100644 index 000000000..87f898b4e --- /dev/null +++ b/config/translatable.php @@ -0,0 +1,130 @@ + [ + 'en', + 'fr', + 'es' => [ + 'MX', // mexican spanish + 'CO', // colombian spanish + ], + ], + + /* + |-------------------------------------------------------------------------- + | Locale separator + |-------------------------------------------------------------------------- + | + | This is a string used to glue the language and the country when defining + | the available locales. Example: if set to '-', then the locale for + | colombian spanish will be saved as 'es-CO' into the database. + | + */ + 'locale_separator' => '-', + + /* + |-------------------------------------------------------------------------- + | Default locale + |-------------------------------------------------------------------------- + | + | As a default locale, Translatable takes the locale of Laravel's + | translator. If for some reason you want to override this, + | you can specify what default should be used here. + | If you set a value here it will only use the current config value + | and never fallback to the translator one. + | + */ + 'locale' => null, + + /* + |-------------------------------------------------------------------------- + | Use fallback + |-------------------------------------------------------------------------- + | + | Determine if fallback locales are returned by default or not. To add + | more flexibility and configure this option per "translatable" + | instance, this value will be overridden by the property + | $useTranslationFallback when defined + | + */ + 'use_fallback' => false, + + /* + |-------------------------------------------------------------------------- + | Use fallback per property + |-------------------------------------------------------------------------- + | + | The property fallback feature will return the translated value of + | the fallback locale if the property is empty for the selected + | locale. Note that 'use_fallback' must be enabled. + | + */ + 'use_property_fallback' => true, + + /* + |-------------------------------------------------------------------------- + | Fallback Locale + |-------------------------------------------------------------------------- + | + | A fallback locale is the locale being used to return a translation + | when the requested translation is not existing. To disable it + | set it to false. + | + */ + 'fallback_locale' => 'en', + + /* + |-------------------------------------------------------------------------- + | Translation Model Namespace + |-------------------------------------------------------------------------- + | + | Defines the default 'Translation' class namespace. For example, if + | you want to use App\Translations\CountryTranslation instead of App\CountryTranslation + | set this to 'App\Translations'. + | + */ + 'translation_model_namespace' => null, + + /* + |-------------------------------------------------------------------------- + | Translation Suffix + |-------------------------------------------------------------------------- + | + | Defines the default 'Translation' class suffix. For example, if + | you want to use CountryTrans instead of CountryTranslation + | application, set this to 'Trans'. + | + */ + 'translation_suffix' => 'Translation', + + /* + |-------------------------------------------------------------------------- + | Locale key + |-------------------------------------------------------------------------- + | + | Defines the 'locale' field name, which is used by the + | translation model. + | + */ + 'locale_key' => 'locale', + + /* + |-------------------------------------------------------------------------- + | Always load translations when converting to array + |-------------------------------------------------------------------------- + | Setting this to false will have a performance improvement but will + | not return the translations when using toArray(), unless the + | translations relationship is already loaded. + | + */ + 'to_array_always_loads_translations' => true, +]; diff --git a/phpunit.xml b/phpunit.xml index f21cb935f..9ac09ca35 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -17,16 +17,16 @@ ./Modules/Media/Tests/ - + --> ./Modules/Menu/Tests/ - --> + ./Modules/Page/Tests/ + --> ./Modules/Tag/Tests/ From d4ed8651d53b9d5d785dd5149b2b2458e19f61b4 Mon Sep 17 00:00:00 2001 From: Daksh Mehta Date: Sun, 2 Aug 2020 17:13:37 +0530 Subject: [PATCH 09/10] Media test refactored for testbench 3.8 compatibility. Failing lots of tests --- Modules/Media/Tests/EloquentFileRepositoryTest.php | 4 ++-- Modules/Media/Tests/EloquentFolderRepositoryTest.php | 4 ++-- Modules/Media/Tests/FileMoverTest.php | 4 ++-- Modules/Media/Tests/FileServiceTest.php | 4 ++-- Modules/Media/Tests/FileTest.php | 2 +- Modules/Media/Tests/FolderMoverTest.php | 4 ++-- Modules/Media/Tests/ImagyTest.php | 4 ++-- Modules/Media/Tests/MoverTest.php | 4 ++-- Modules/Media/Tests/ThumbnailsManagerTest.php | 2 +- phpunit.xml | 8 ++++---- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Modules/Media/Tests/EloquentFileRepositoryTest.php b/Modules/Media/Tests/EloquentFileRepositoryTest.php index a37a56c52..f362178e9 100644 --- a/Modules/Media/Tests/EloquentFileRepositoryTest.php +++ b/Modules/Media/Tests/EloquentFileRepositoryTest.php @@ -22,7 +22,7 @@ class EloquentFileRepositoryTest extends MediaTestCase */ private $file; - public function setUp() + protected function setUp():void { parent::setUp(); @@ -32,7 +32,7 @@ public function setUp() $this->app['config']->set('asgard.media.config.files-path', '/assets/media/'); } - public function tearDown() + protected function tearDown():void { if ($this->app['files']->isDirectory(public_path('assets')) === true) { $this->app['files']->deleteDirectory(public_path('assets')); diff --git a/Modules/Media/Tests/EloquentFolderRepositoryTest.php b/Modules/Media/Tests/EloquentFolderRepositoryTest.php index c72b829b5..0a1cb2969 100644 --- a/Modules/Media/Tests/EloquentFolderRepositoryTest.php +++ b/Modules/Media/Tests/EloquentFolderRepositoryTest.php @@ -20,7 +20,7 @@ final class EloquentFolderRepositoryTest extends MediaTestCase */ private $folder; - public function setUp() + protected function setUp():void { parent::setUp(); @@ -30,7 +30,7 @@ public function setUp() $this->app['config']->set('asgard.media.config.files-path', '/assets/media/'); } - public function tearDown() + protected function tearDown():void { if ($this->app['files']->isDirectory(public_path('assets')) === true) { $this->app['files']->deleteDirectory(public_path('assets')); diff --git a/Modules/Media/Tests/FileMoverTest.php b/Modules/Media/Tests/FileMoverTest.php index acb271f63..a90414a52 100644 --- a/Modules/Media/Tests/FileMoverTest.php +++ b/Modules/Media/Tests/FileMoverTest.php @@ -19,7 +19,7 @@ final class FileMoverTest extends MediaTestCase */ private $file; - protected function setUp() + protected function setUp():void { parent::setUp(); @@ -30,7 +30,7 @@ protected function setUp() $this->app['config']->set('asgard.media.config.files-path', '/assets/media/'); } - public function tearDown() + protected function tearDown():void { if ($this->app['files']->isDirectory(public_path('assets')) === true) { $this->app['files']->deleteDirectory(public_path('assets')); diff --git a/Modules/Media/Tests/FileServiceTest.php b/Modules/Media/Tests/FileServiceTest.php index 72330b4c4..e93a7a9dd 100644 --- a/Modules/Media/Tests/FileServiceTest.php +++ b/Modules/Media/Tests/FileServiceTest.php @@ -12,7 +12,7 @@ final class FileServiceTest extends MediaTestCase */ private $fileService; - public function setUp() + protected function setUp():void { parent::setUp(); $this->resetDatabase(); @@ -20,7 +20,7 @@ public function setUp() $this->app['config']->set('asgard.media.config.files-path', '/assets/media/'); } - public function tearDown() + protected function tearDown():void { if ($this->app['files']->isDirectory(public_path('assets')) === true) { $this->app['files']->deleteDirectory(public_path('assets')); diff --git a/Modules/Media/Tests/FileTest.php b/Modules/Media/Tests/FileTest.php index 3bfa72b59..b62f430a5 100644 --- a/Modules/Media/Tests/FileTest.php +++ b/Modules/Media/Tests/FileTest.php @@ -13,7 +13,7 @@ class FileTest extends MediaTestCase */ private $file; - public function setUp() + protected function setUp():void { parent::setUp(); diff --git a/Modules/Media/Tests/FolderMoverTest.php b/Modules/Media/Tests/FolderMoverTest.php index 591aad158..eb5b710f2 100644 --- a/Modules/Media/Tests/FolderMoverTest.php +++ b/Modules/Media/Tests/FolderMoverTest.php @@ -18,7 +18,7 @@ final class FolderMoverTest extends MediaTestCase */ private $folder; - protected function setUp() + protected function setUp():void { parent::setUp(); @@ -29,7 +29,7 @@ protected function setUp() $this->app['config']->set('asgard.media.config.files-path', '/assets/media/'); } - public function tearDown() + protected function tearDown():void { if ($this->app['files']->isDirectory(public_path('assets')) === true) { $this->app['files']->deleteDirectory(public_path('assets')); diff --git a/Modules/Media/Tests/ImagyTest.php b/Modules/Media/Tests/ImagyTest.php index 588b72ee9..1cb45f603 100644 --- a/Modules/Media/Tests/ImagyTest.php +++ b/Modules/Media/Tests/ImagyTest.php @@ -34,7 +34,7 @@ class ImagyTest extends MediaTestCase /** * */ - public function setUp() + protected function setUp():void { parent::setUp(); $this->app['config']->set('asgard.media.config.files-path', '/assets/media/'); @@ -47,7 +47,7 @@ public function setUp() $this->finder->copy("{$this->mediaPath}google-map.png", "{$this->testbenchPublicPath}google-map.png"); } - public function tearDown() + protected function tearDown():void { $this->finder->delete("{$this->testbenchPublicPath}google-map.png"); $this->finder->delete("{$this->testbenchPublicPath}google-map_smallThumb.png"); diff --git a/Modules/Media/Tests/MoverTest.php b/Modules/Media/Tests/MoverTest.php index 406f4a5dd..2c507696a 100644 --- a/Modules/Media/Tests/MoverTest.php +++ b/Modules/Media/Tests/MoverTest.php @@ -13,7 +13,7 @@ final class MoverTest extends MediaTestCase */ private $mover; - public function setUp() + protected function setUp():void { parent::setUp(); @@ -24,7 +24,7 @@ public function setUp() $this->app['config']->set('asgard.media.config.files-path', '/assets/media/'); } - public function tearDown() + protected function tearDown():void { if ($this->app['files']->isDirectory(public_path('assets')) === true) { $this->app['files']->deleteDirectory(public_path('assets')); diff --git a/Modules/Media/Tests/ThumbnailsManagerTest.php b/Modules/Media/Tests/ThumbnailsManagerTest.php index 2d4fa511d..8c8d7b420 100644 --- a/Modules/Media/Tests/ThumbnailsManagerTest.php +++ b/Modules/Media/Tests/ThumbnailsManagerTest.php @@ -12,7 +12,7 @@ class ThumbnailsManagerTest extends MediaTestCase */ private $thumbnailManager; - public function setUp() + protected function setUp():void { parent::setUp(); $this->thumbnailManager = app(ThumbnailManager::class); diff --git a/phpunit.xml b/phpunit.xml index 9ac09ca35..71094e215 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -14,19 +14,19 @@ ./Modules/Media/Tests/ - --> + ./Modules/Menu/Tests/ ./Modules/Page/Tests/ - + ./Modules/Tag/Tests/ From cfbbc20eb828a8c4d2c7da43409afefea8e83004 Mon Sep 17 00:00:00 2001 From: Daksh Mehta Date: Sun, 2 Aug 2020 17:16:46 +0530 Subject: [PATCH 10/10] Reverted composer.json and phpunit to its appropriate code --- composer.json | 15 +-------------- phpunit.xml | 4 ++-- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index 1110e1fe3..3f609dd71 100644 --- a/composer.json +++ b/composer.json @@ -10,16 +10,6 @@ ], "license": "MIT", "type": "project", - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/dakshhmehta/Menu.git" - }, - { - "type": "vcs", - "url": "https://github.com/dakshhmehta/Core.git" - } - ], "require": { "php": "^7.1.3", "fideloper/proxy": "^4.0", @@ -51,10 +41,7 @@ "orchestra/testbench": "3.8.*", "phpunit/phpunit": "^7.5", "predis/predis": "^1.1", - "roave/security-advisories": "dev-master", - - "tormjens/eventy": "^0.6", - "spatie/laravel-activitylog": "3.9.1" + "roave/security-advisories": "dev-master" }, "autoload": { "classmap": [ diff --git a/phpunit.xml b/phpunit.xml index 71094e215..372a2bc1d 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -12,9 +12,9 @@ ./Modules/Core/Tests/ - + ./Modules/Media/Tests/