⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.45
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
shopware
/
custom
/
plugins
/
SwagPayPal
/
tests
/
View File Name :
ShopwarePluginClassTest.php
<?php declare(strict_types=1); /* * (c) shopware AG <info@shopware.com> * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ use PHPUnit\Framework\TestCase; use Shopware\Core\Framework\Plugin; use Shopware\Core\Framework\Test\TestCaseBase\IntegrationTestBehaviour; /** * @internal */ class ShopwarePluginClassTest extends TestCase { use IntegrationTestBehaviour; public function testHasComposerJson(): void { static::assertFileExists(__DIR__ . '/../composer.json'); } /** * @depends testHasComposerJson */ public function testClassExists(): void { $composer = json_decode((string) file_get_contents(__DIR__ . '/../composer.json'), true); static::assertArrayHasKey('extra', $composer); static::assertArrayHasKey('shopware-plugin-class', $composer['extra']); $class = $composer['extra']['shopware-plugin-class']; static::assertTrue(class_exists($class), 'shopware-plugin-class `' . $class . '` does not exist'); $parents = class_parents($class); static::assertNotFalse($parents); static::assertContains(Plugin::class, $parents, '`' . $class . '` should extend ' . Plugin::class); } /** * @depends testClassExists */ public function testPluginIsLoaded(): void { $composer = json_decode((string) file_get_contents(__DIR__ . '/../composer.json'), true); $class = $composer['extra']['shopware-plugin-class']; static::assertNotNull($this->getContainer()->get($class)); $pluginInfos = $this->getContainer()->getParameter('kernel.active_plugins'); static::assertIsArray($pluginInfos); static::assertArrayHasKey($class, $pluginInfos); } }