Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
SW-26913 - improve backend
- Loading branch information
1 parent
cc87efc
commit de92d3a
Showing
3 changed files
with
67 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| <?php | ||
| /** | ||
| * Shopware 5 | ||
| * Copyright (c) shopware AG | ||
| * | ||
| * According to our dual licensing model, this program can be used either | ||
| * under the terms of the GNU Affero General Public License, version 3, | ||
| * or under a proprietary license. | ||
| * | ||
| * The texts of the GNU Affero General Public License with an additional | ||
| * permission and of our proprietary license can be found at and | ||
| * in the LICENSE file you have received along with this program. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * "Shopware" is a registered trademark of shopware AG. | ||
| * The licensing of the program under the AGPLv3 does not imply a | ||
| * trademark license. Therefore any rights, title and interest in | ||
| * our trademarks remain entirely with us. | ||
| */ | ||
|
|
||
| namespace Shopware\Tests\Unit\Plugins\Backend\Auth; | ||
|
|
||
| use Enlight_Controller_Action; | ||
| use Enlight_Controller_ActionEventArgs; | ||
| use Enlight_Controller_Request_RequestTestCase; | ||
| use PHPUnit\Framework\TestCase; | ||
| use Shopware\Tests\Functional\Helper\Utils; | ||
| use Shopware_Plugins_Backend_Auth_Bootstrap; | ||
|
|
||
| class BootstrapTest extends TestCase | ||
| { | ||
| public function testValidatesAlsoSnakeCaseControllers(): void | ||
| { | ||
| /** @var Shopware_Plugins_Backend_Auth_Bootstrap $authPlugin */ | ||
| $authPlugin = $this->createPartialMock(Shopware_Plugins_Backend_Auth_Bootstrap::class, ['initLocale', 'checkAuth']); | ||
| $authPlugin->setNoAcl(true); | ||
|
|
||
| $action = $this->getMockBuilder(Enlight_Controller_Action::class)->disableOriginalConstructor()->getMock(); | ||
| $testRequest = new Enlight_Controller_Request_RequestTestCase(); | ||
| $testRequest->setControllerName('user_manager'); | ||
| $testRequest->setModuleName('Backend'); | ||
| $action->method('Request')->willReturn($testRequest); | ||
| $eventArgs = new Enlight_Controller_ActionEventArgs(); | ||
| $eventArgs->set('subject', $action); | ||
|
|
||
| $authPlugin->onPreDispatchBackend($eventArgs); | ||
|
|
||
| static::assertEquals('usermanager', Utils::hijackAndReadProperty($authPlugin, 'aclResource')); | ||
| } | ||
| } |