├── .coveralls.yml ├── .editorconfig ├── .gitignore ├── .travis.yml ├── API.md ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── composer.json ├── config ├── cms-api.php ├── cms-core.php └── cms-modules.php ├── documentation ├── Development.md ├── Development │ ├── CreatingModules.md │ └── ViewsAndScripts.md ├── Menu.md ├── Modules.md ├── StandardInstallation.md └── Troubleshooting.md ├── phpunit.xml.dist ├── src ├── Api │ ├── ApiCore.php │ ├── Response │ │ ├── RestResponseBuilder.php │ │ └── TransformContainer.php │ └── Transformers │ │ ├── ModuleTransformer.php │ │ └── VersionTransformer.php ├── Auth │ └── AclRepository.php ├── Console │ └── Commands │ │ ├── CacheMenu.php │ │ ├── ClearMenuCache.php │ │ ├── CmsMigrationContextTrait.php │ │ ├── MigrateCommand.php │ │ ├── MigrateInstallCommand.php │ │ ├── MigrateRefreshCommand.php │ │ ├── MigrateResetCommand.php │ │ ├── MigrateRollbackCommand.php │ │ ├── MigrateStatusCommand.php │ │ ├── ShowMenu.php │ │ └── ShowModules.php ├── Contracts │ ├── Api │ │ ├── ApiCoreInterface.php │ │ └── Response │ │ │ ├── ResponseBuilderInterface.php │ │ │ └── TransformContainerInterface.php │ ├── Auth │ │ ├── AclRepositoryInterface.php │ │ ├── AuthApiRoutingInterface.php │ │ ├── AuthRepositoryInterface.php │ │ ├── AuthRoutingInterface.php │ │ ├── AuthenticatorInterface.php │ │ ├── RoleInterface.php │ │ ├── UserAuthenticationInterface.php │ │ ├── UserInterface.php │ │ └── UserManagementInterface.php │ ├── Core │ │ ├── BootCheckerInterface.php │ │ ├── CacheInterface.php │ │ ├── CoreInterface.php │ │ └── NotifierInterface.php │ ├── Menu │ │ ├── MenuConfigInterpreterInterface.php │ │ ├── MenuModulesInterpreterInterface.php │ │ ├── MenuPermissionsFilterInterface.php │ │ └── MenuRepositoryInterface.php │ ├── Modules │ │ ├── Data │ │ │ ├── AclPresenceInterface.php │ │ │ └── MenuPresenceInterface.php │ │ ├── ModuleGeneratorInterface.php │ │ ├── ModuleInterface.php │ │ └── ModuleManagerInterface.php │ └── Support │ │ ├── Data │ │ ├── DataClearInterface.php │ │ ├── MenuConfiguredModulesDataInterface.php │ │ ├── MenuLayoutDataInterface.php │ │ └── MenuPermissionsIndexDataInterface.php │ │ ├── Localization │ │ └── LocaleRepositoryInterface.php │ │ └── View │ │ └── AssetManagerInterface.php ├── Core │ ├── BasicNotifier.php │ ├── BootChecker.php │ ├── Cache.php │ └── Core.php ├── Events │ ├── AbstractCmsEvent.php │ ├── Auth │ │ ├── CmsRolesChanged.php │ │ ├── CmsUserCreated.php │ │ ├── CmsUserDeleted.php │ │ ├── CmsUserLoggedIn.php │ │ ├── CmsUserLoggedOut.php │ │ └── CmsUserPermissionsChanged.php │ ├── CmsHasBooted.php │ └── CmsHasRegistered.php ├── Exceptions │ ├── ExtendingHandler.php │ └── Handler.php ├── Facades │ ├── AuthenticatorFacade.php │ ├── CacheFacade.php │ └── CoreFacade.php ├── Http │ ├── Controllers │ │ ├── Api │ │ │ ├── MenuController.php │ │ │ ├── ModulesController.php │ │ │ └── VersionController.php │ │ ├── Controller.php │ │ ├── DefaultController.php │ │ └── LocaleController.php │ ├── Middleware │ │ ├── Api │ │ │ └── Authenticate.php │ │ ├── Authenticate.php │ │ ├── CheckPermission.php │ │ ├── InitializeMenu.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── SetLocale.php │ │ └── VerifyCsrfToken.php │ ├── Requests │ │ ├── Request.php │ │ └── SetLocaleRequest.php │ └── ViewComposers │ │ └── LocaleComposer.php ├── Menu │ ├── MenuConfigInterpreter.php │ ├── MenuModulesInterpreter.php │ ├── MenuPermissionsFilter.php │ └── MenuRepository.php ├── Modules │ └── ModuleManager.php ├── Providers │ ├── Api │ │ ├── ApiRouteServiceProvider.php │ │ └── CmsCoreApiServiceProvider.php │ ├── CmsCoreServiceProvider.php │ ├── EventServiceProvider.php │ ├── LogServiceProvider.php │ ├── MiddlewareServiceProvider.php │ ├── MigrationServiceProvider.php │ ├── ModuleManagerServiceProvider.php │ ├── RouteServiceProvider.php │ ├── TranslationServiceProvider.php │ └── ViewServiceProvider.php └── Support │ ├── Data │ ├── AbstractDataObject.php │ ├── AclPresence.php │ ├── Menu │ │ ├── ConfiguredModulesData.php │ │ ├── LayoutData.php │ │ ├── LayoutGroupData.php │ │ └── PermissionsIndexData.php │ └── MenuPresence.php │ ├── Database │ └── CmsMigration.php │ ├── Enums │ ├── AclPresenceType.php │ ├── CmsMiddleware.php │ ├── Component.php │ ├── FlashLevel.php │ ├── MenuPresenceMode.php │ ├── MenuPresenceType.php │ └── NamedRoute.php │ ├── Exception │ └── TraceParser.php │ ├── Localization │ └── LocaleRepository.php │ ├── Logging │ ├── CmsCustomizeFormatter.php │ ├── CmsFormatterDecorator.php │ └── CmsLogManager.php │ ├── Translation │ └── CmsTranslator.php │ ├── View │ └── AssetManager.php │ └── helpers.php └── tests ├── Api ├── MenuTest.php ├── ModulesTest.php ├── Response │ ├── RestResponseBuilderTest.php │ └── TransformContainerTest.php └── VersionsTest.php ├── ApiTestCase.php ├── Auth └── AclRepositoryTest.php ├── CmsBootTestCase.php ├── Console ├── CacheMenuTest.php ├── ClearMenuCacheTest.php ├── MigrateCommandTest.php ├── MigrateInstallCommandTest.php ├── MigrateRefreshCommandTest.php ├── MigrateResetCommandTest.php ├── MigrateRollbackCommandTest.php ├── MigrateStatusCommandTest.php ├── ShowMenuTest.php └── ShowModulesTest.php ├── Core ├── BasicNotifierTest.php ├── BootCheckerTest.php ├── CacheTest.php └── CoreTest.php ├── Helpers ├── Api │ └── TestTransformer.php ├── Core │ ├── MockApiBootChecker.php │ └── MockWebBootChecker.php ├── Exceptions │ ├── WithGetStatusCodeException.php │ └── WithStatusCodePropertyException.php ├── Http │ ├── KernelWithRemoveMiddlewareMethod.php │ ├── MockRequest.php │ └── NullMiddleware.php ├── Listeners │ └── TestEventListener.php ├── Modules │ ├── SimpleAssociatedTestModule.php │ ├── SimpleTestModule.php │ ├── SimpleTestModuleGenerator.php │ ├── SimpleTestModuleWithSameServiceProvider.php │ ├── SimpleTestModuleWithServiceProviders.php │ └── TestModuleWithRoutes.php ├── NonInstantiableClassWithDependency.php ├── NonInstantiableInterface.php ├── Providers │ └── TestViewsServiceProvider.php ├── Spies │ ├── CacheSpy.php │ └── SessionSpy.php ├── Support │ ├── AnotherTestDataObject.php │ ├── BasicDataObject.php │ └── TestDataObject.php ├── migrations │ ├── DatabaseSeeder.php │ ├── alt │ │ └── 2017_01_01_300000_create_test_alternative_records_table.php │ └── cms │ │ ├── 2017_01_01_100000_create_test_records_table.php │ │ └── 2017_01_01_200000_create_more_test_records_table.php └── resources │ └── views │ ├── blade_cms_script.blade.php │ ├── blade_cms_scriptasset.blade.php │ ├── blade_cms_scriptassethead.blade.php │ ├── blade_cms_scriptonce.blade.php │ └── blade_cms_style.blade.php ├── Http ├── Controllers │ ├── DefaultControllerTest.php │ └── LocaleControllerTest.php ├── Middleware │ ├── Api │ │ └── AuthenticateTest.php │ ├── AuthenticateTest.php │ ├── CheckPermissionTest.php │ ├── InitializeMenuTest.php │ ├── RedirectIfAuthenticatedTest.php │ └── SetLocaleTest.php └── ViewComposers │ └── LocaleComposerTest.php ├── Menu ├── MenuConfigInterpreterTest.php ├── MenuModulesInterpreterTest.php ├── MenuPermissionsFilterTest.php └── MenuRepositoryTest.php ├── Modules └── ModuleManagerTest.php ├── Providers ├── Api │ └── CmsCoreApiServiceProviderTest.php ├── BladeDirectivesTest.php ├── EventServiceProviderTest.php ├── MiddlewareServiceProviderTest.php ├── RouteServiceProviderTest.php └── TranslationServiceProviderTest.php ├── SimpleDbTestCase.php ├── Support ├── Data │ ├── AclPresenceTest.php │ ├── DataObjectTest.php │ ├── Menu │ │ ├── LayoutDataTest.php │ │ ├── LayoutGroupDataTest.php │ │ └── PermissionIndexDataTest.php │ └── MenuPresenceTest.php ├── HelpersTest.php ├── Localization │ └── LocaleRepositoryTest.php ├── Logging │ └── CmsFormatterDecoratorTest.php ├── Translation │ └── CmsTranslatorTest.php └── View │ └── AssetManagerTest.php ├── TestCase.php └── WebTestCase.php /.coveralls.yml: -------------------------------------------------------------------------------- 1 | coverage_clover: build/logs/clover.xml 2 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | ; This file is for unifying the coding style for different editors and IDEs. 2 | ; More information at http://editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | charset = utf-8 8 | indent_size = 4 9 | indent_style = space 10 | end_of_line = lf 11 | insert_final_newline = true 12 | trim_trailing_whitespace = true 13 | 14 | [*.md] 15 | trim_trailing_whitespace = true 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | composer.lock 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 7.2 5 | - 7.3 6 | 7 | install: composer install 8 | 9 | script: 10 | - mkdir -p build/logs 11 | - vendor/bin/phpunit --coverage-clover build/logs/clover.xml 12 | 13 | after_script: 14 | - vendor/bin/coveralls -v 15 | 16 | notifications: 17 | email: 18 | on_success: never 19 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## Laravel 6.0 and up 4 | 5 | ### [3.0.0] - 2020-05-14 6 | 7 | Support for Laravel 7.0 (only). 8 | 9 | ### [2.0.0] - 2019-09-22 10 | 11 | Support for Laravel 6.0 and PHP 7.2+ only. 12 | Added strict return types and scalar typehints. 13 | 14 | ## Laravel 5.8 and below 15 | 16 | [3.0.0]: https://github.com/czim/laravel-cms-core/compare/2.0.0...3.0.0 17 | 18 | [2.0.0]: https://github.com/czim/laravel-cms-core/compare/1.8.0...2.0.0 19 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are **welcome** and will be fully **credited**. 4 | 5 | We accept contributions via Pull Requests on [Github](https://github.com/czim/laravel-cms-core). 6 | 7 | 8 | ## Pull Requests 9 | 10 | - **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)**. 11 | 12 | - **Add tests!** - Your patch won't be accepted if it doesn't have tests. 13 | 14 | - **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. 15 | 16 | - **Create feature branches** - Don't ask us to pull from your master branch. 17 | 18 | - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. 19 | 20 | - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. 21 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Coen Zimmerman 4 | 5 | > Permission is hereby granted, free of charge, to any person obtaining a copy 6 | > of this software and associated documentation files (the "Software"), to deal 7 | > in the Software without restriction, including without limitation the rights 8 | > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | > copies of the Software, and to permit persons to whom the Software is 10 | > furnished to do so, subject to the following conditions: 11 | > 12 | > The above copyright notice and this permission notice shall be included in 13 | > all copies or substantial portions of the Software. 14 | > 15 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | > THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "czim/laravel-cms-core", 3 | "description": "Laravel CMS - Core", 4 | "authors": [ 5 | { 6 | "name": "Coen Zimmerman", 7 | "email": "coen@pxlwidgets.com", 8 | "homepage": "https://github.com/czim" 9 | } 10 | ], 11 | "keywords": [ "cms", "laravel" ], 12 | "require": { 13 | "php": ">=7.2", 14 | "czim/laravel-dataobject": "~2.0", 15 | "laravel/framework": "^7.0", 16 | "league/fractal": ">=0.13", 17 | "myclabs/php-enum": "^1.4" 18 | }, 19 | "require-dev": { 20 | "phpunit/phpunit": "^8.0|^9.0", 21 | "mockery/mockery": "^1.0", 22 | "orchestra/testbench": "^5.0", 23 | "orchestra/database": "^5.0", 24 | "php-coveralls/php-coveralls": "^2.1" 25 | }, 26 | "autoload": { 27 | "psr-4": { 28 | "Czim\\CmsCore\\": "src" 29 | }, 30 | "files": [ 31 | "src/Support/helpers.php" 32 | ] 33 | }, 34 | "autoload-dev": { 35 | "psr-4": { 36 | "Czim\\CmsCore\\Test\\": "tests" 37 | }, 38 | "files": [ 39 | "tests/Helpers/migrations/DatabaseSeeder.php", 40 | "tests/Helpers/migrations/cms/2017_01_01_100000_create_test_records_table.php", 41 | "tests/Helpers/migrations/cms/2017_01_01_200000_create_more_test_records_table.php" 42 | ] 43 | }, 44 | "scripts": { 45 | "test": "phpunit" 46 | }, 47 | "minimum-stability": "dev", 48 | "prefer-stable": true 49 | } 50 | -------------------------------------------------------------------------------- /config/cms-modules.php: -------------------------------------------------------------------------------- 1 | [ 21 | ], 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Service Providers 26 | |-------------------------------------------------------------------------- 27 | | 28 | | For those loaded modules that have their own service providers, they 29 | | may be added here. The CMS will automatically register them. 30 | | 31 | */ 32 | 33 | 'providers' => [ 34 | ], 35 | 36 | /* 37 | |-------------------------------------------------------------------------- 38 | | Menu 39 | |-------------------------------------------------------------------------- 40 | | 41 | | The menu is composed of module presences, which may be configured, 42 | | ordered, or even assigned in a specific nested, grouped layout. 43 | | 44 | */ 45 | 46 | 'menu' => [ 47 | 48 | // A menu layout with groups may be defined here, along with the order in which they appear. 49 | // Groups are represented by arrays. Menu items for modules are referenced by module key. 50 | // 51 | // Example: 52 | // 53 | // 'layout' => [ 54 | // [ 55 | // 'label' => 'Group label for display', 56 | // 'children' => [ 57 | // 'another.module-key', 58 | // 'yet-another.module-key', 59 | // ] 60 | // ], 61 | // 'some.module-key', 62 | // ] 63 | 64 | 'layout' => [ 65 | ], 66 | 67 | // Module menu presence configuration and default order of appearance. 68 | // 69 | // Entries in this array may be either module keys, or key value pairs with 70 | // further configuration for a module's menu presence. 71 | // 72 | // Note that the order of appearance defined in the layout key above overrules 73 | // the order of the module keys below. 74 | // 75 | // Example: 76 | // 77 | // 'modules' => [ 78 | // 'first-module-key', 79 | // 'second-module-key', 80 | // 'third-module-key' => [ 81 | // 'label' => 'Custom Label', 82 | // 'icon' => 'home', 83 | // ], 84 | // 'some.module-key', 85 | // ] 86 | 87 | 'modules' => [ 88 | ], 89 | 90 | ], 91 | 92 | ]; 93 | -------------------------------------------------------------------------------- /documentation/Development.md: -------------------------------------------------------------------------------- 1 | # For Developers 2 | 3 | This CMS was made to be extensible and manipulable by developers. This documentation should help you get started. 4 | 5 | - Information about [creating custom modules](Development/CreatingModules.md) for the CMS. 6 | - Writing custom [views and scripts](Development/ViewsAndScripts.md) for modules and strategies. 7 | -------------------------------------------------------------------------------- /documentation/Development/CreatingModules.md: -------------------------------------------------------------------------------- 1 | # Creating Custom Modules 2 | 3 | ## Modules 4 | 5 | A single module class may be registered with the CMS. 6 | 7 | 8 | ### Creating Modules 9 | 10 | 1. Create a new module class. 11 | This must implement `Czim\CmsCore\Contracts\Modules\ModuleInterface`. 12 | It is advisable to set a key that is unlikely to cause conflicts with other modules or generators. 13 | 14 | 2. Create service providers as needed. 15 | This is not required, but is highly recommended if your module requires provision that is not needed for non-CMS requests. 16 | 17 | ### Installing Modules 18 | 19 | 3. Register the module in the `cms-modules.php` config. 20 | Add the fully qualified namespace for the module class to the `cms-modules.modules` array. 21 | 22 | 4. If relevant, add service providers to the `cms-modules.php` config. 23 | Add the fully qualified namespaces for any service providers to the `cms-modules.providers` array. 24 | 25 | 26 | ## Module Generators 27 | 28 | Instead of coding concrete module classes, it is possible to register a module generator with the CMS. 29 | This may generate any number of modules procedurally, which will then each be registered with the CMS. 30 | 31 | For an example of a module generator, see the [models module generator](https://github.com/czim/laravel-cms-models/blob/master/src/Modules/ModelModuleGenerator.php). 32 | 33 | ### Creating Module Generators 34 | 35 | 1. Create a new module generator class. 36 | This must implement `Czim\CmsCore\Contracts\Modules\ModuleGeneratorInterface`. 37 | It is advisable to set a key that is unlikely to cause conflicts with other modules or generators. 38 | 39 | 2. Create service providers as needed. 40 | This is not required, but is highly recommended if your module requires provision that is not needed for non-CMS requests. 41 | 42 | ### Installing Module Generators 43 | 44 | The proces is the same as for installing modules as described above. 45 | The only difference is that the generator FQN is registered in `cms-modules.modules` instead of a module class. 46 | 47 | 48 | ## A Warning About Using `associatedClass` 49 | 50 | If you're using the [models module](https://github.com/czim/laravel-cms-models), 51 | avoid setting the `associatedClass` module property to an Eloquent model. 52 | This package relies on looking up (generated) modules by their Eloquent model classname. 53 | As long as there are duplicates, you should be fine. 54 | -------------------------------------------------------------------------------- /documentation/Development/ViewsAndScripts.md: -------------------------------------------------------------------------------- 1 | # Writing Views and Scripts 2 | 3 | The CMS theme includes most scripts and shared stylesheets. Modules that provide their own styles must publish them, preferrably to a subdirectory of the `public/_cms` directory. 4 | 5 | The blade directives described below may be used to include style and script assets. 6 | 7 | 8 | ## Blade Directives 9 | 10 | The following blade directives are available in CMS templates: 11 | 12 | - `@cms_script` / `@cms_endscript` 13 | A block directive that will add content at the end of the HTML page. Does not auto-wrap in `', $manager->renderScriptAssets()); 46 | } 47 | 48 | /** 49 | * @test 50 | */ 51 | function it_registers_script_header_assets() 52 | { 53 | $manager = new AssetManager(); 54 | 55 | static::assertSame($manager, $manager->registerScriptAsset('/path/to/asset', true)); 56 | $manager->registerScriptAsset('/not/footer'); 57 | 58 | static::assertEquals('', $manager->renderScriptHeadAssets()); 59 | } 60 | 61 | /** 62 | * @test 63 | */ 64 | function it_registers_script_bodies() 65 | { 66 | $manager = new AssetManager(); 67 | 68 | static::assertSame($manager, $manager->registerScript('', false)); 69 | $manager->registerScript('', false); 70 | 71 | static::assertEquals("\n", $manager->renderScripts()); 72 | } 73 | 74 | /** 75 | * @test 76 | */ 77 | function it_registers_script_bodies_such_that_duplicates_are_not_rendered() 78 | { 79 | $manager = new AssetManager(); 80 | 81 | static::assertSame($manager, $manager->registerScript('')); 82 | $manager->registerScript(''); 83 | 84 | static::assertEquals('', $manager->renderScripts()); 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | set('cms-modules.modules', []); 26 | } 27 | 28 | protected function getTestBootCheckerBinding(): string 29 | { 30 | return BootChecker::class; 31 | } 32 | 33 | /** 34 | * Mocks components that should not be part of any core test. 35 | * 36 | * @param Application $app 37 | * @return $this 38 | */ 39 | protected function mockBoundCoreExternalComponents(Application $app): TestCase 40 | { 41 | $app->bind('mock-cms-auth', function () { 42 | 43 | $mock = $this->getMockAuthenticator(); 44 | 45 | $mock->shouldReceive('version')->andReturn('1.2.3'); 46 | 47 | $mock->shouldReceive('admin')->andReturn(false); 48 | $mock->shouldReceive('user')->andReturn(null); 49 | 50 | $mock->shouldReceive('getRouteLoginAction')->andReturn('MockController@index'); 51 | $mock->shouldReceive('getRouteLoginPostAction')->andReturn('MockController@index'); 52 | $mock->shouldReceive('getRouteLogoutAction')->andReturn('MockController@index'); 53 | 54 | $mock->shouldReceive('getApiRouteLoginAction')->andReturn('MockController@index'); 55 | $mock->shouldReceive('getApiRouteLogoutAction')->andReturn('MockController@index'); 56 | 57 | $mock->shouldReceive('getRoutePasswordEmailGetAction')->andReturn('MockController@index'); 58 | $mock->shouldReceive('getRoutePasswordEmailPostAction')->andReturn('MockController@index'); 59 | $mock->shouldReceive('getRoutePasswordResetGetAction')->andReturn('MockController@index'); 60 | $mock->shouldReceive('getRoutePasswordResetPostAction')->andReturn('MockController@index'); 61 | 62 | return $mock; 63 | }); 64 | 65 | return $this; 66 | } 67 | 68 | /** 69 | * Returns most recent artisan command output. 70 | * 71 | * @return string 72 | */ 73 | protected function getArtisanOutput(): string 74 | { 75 | return $this->app[ConsoleKernelContract::class]->output(); 76 | } 77 | 78 | /** 79 | * @return \Mockery\MockInterface|\Mockery\Mock|AuthenticatorInterface 80 | */ 81 | protected function getMockAuthenticator() 82 | { 83 | return Mockery::mock(AuthenticatorInterface::class); 84 | } 85 | 86 | 87 | } 88 | -------------------------------------------------------------------------------- /tests/WebTestCase.php: -------------------------------------------------------------------------------- 1 |