Skip to content

Commit

Permalink
Merge branch 'NEXT-36153/move-administration-suite' into 'trunk'
Browse files Browse the repository at this point in the history
NEXT-36153 - terminate suite administration

Closes NEXT-36153

See merge request shopware/6/product/platform!13857
  • Loading branch information
keulinho committed May 16, 2024
2 parents a4e24ec + 8333256 commit b4acddd
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 76 deletions.
10 changes: 5 additions & 5 deletions .gitlab/stages/20-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ PHP legacy:
- php vendor/bin/phpunit
--configuration phpunit.xml.dist
--log-junit phpunit.junit.xml
--testsuite administration,storefront,content,framework,migration,system
--testsuite storefront,content,framework,migration,system
--order-by default

PHP bench:
Expand Down Expand Up @@ -327,7 +327,7 @@ PHP Full:
- name: redis:7.0
alias: redis
variables:
TEST_SUITES: "administration storefront content devops framework profiling system unit integration migration migration-tests"
TEST_SUITES: "integration storefront content devops framework system unit migration migration-tests"
APP_ENV: test
GIT_DEPTH: 0 # we need all commits for composer to detect the version which is then checked in a unit test
ALLOW_FAILURE: "false"
Expand Down Expand Up @@ -363,15 +363,15 @@ PHP Full:
PREFER_LOWEST: "prefer lowest"
# Don't run devops tests with lowest dependencies, as phpstan has known issues with mismatched in installed package versions: https://github.com/phpstan/phpdoc-parser/issues/188
# Also running devops tests don't provide value with prefer lowest, as the scripts are always executed with the latest dependencies
TEST_SUITES: "administration storefront content framework profiling system unit integration migration migration-tests"
TEST_SUITES: "integration storefront content framework system unit migration migration-tests"
- MYSQL_IMAGE: mariadb:10.11
ONLY_CORE: "only core"
TEST_SUITES: "content framework profiling system integration migration"
TEST_SUITES: "integration content framework system migration"
- MYSQL_IMAGE: mariadb:11.0
DEPENDENCY_DEV: "dev dependencies"
ALLOW_FAILURE: "true"
MYSQL_CMD: "mariadbd"
TEST_SUITES: "content framework profiling system integration migration"
TEST_SUITES: "integration content framework system migration"
before_script:
- >
if [ -n "$FAKE_PHP_VERSION" ]; then
Expand Down
55 changes: 0 additions & 55 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -40,61 +40,6 @@ parameters:
count: 1
path: src/Administration/Service/AdminSearcher.php

-
message: "#^Method Shopware\\\\Administration\\\\Test\\\\Migration\\\\Migration1636121186CopySalesChannelIdsIntoUserConfigTest\\:\\:fetchConfigs\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Administration/Test/Migration/Migration1636121186CopySalesChannelIdsIntoUserConfigTest.php

-
message: "#^Method Shopware\\\\Administration\\\\Test\\\\Migration\\\\Migration1636121186CopySalesChannelIdsIntoUserConfigTest\\:\\:fetchExpectedSalesChannelIds\\(\\) has parameter \\$languages with no value type specified in iterable type array\\.$#"
count: 1
path: src/Administration/Test/Migration/Migration1636121186CopySalesChannelIdsIntoUserConfigTest.php

-
message: "#^Method Shopware\\\\Administration\\\\Test\\\\Migration\\\\Migration1636121186CopySalesChannelIdsIntoUserConfigTest\\:\\:fetchExpectedSalesChannelIds\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Administration/Test/Migration/Migration1636121186CopySalesChannelIdsIntoUserConfigTest.php

-
message: "#^Method Shopware\\\\Administration\\\\Test\\\\Migration\\\\Migration1636121186CopySalesChannelIdsIntoUserConfigTest\\:\\:fetchLanguages\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Administration/Test/Migration/Migration1636121186CopySalesChannelIdsIntoUserConfigTest.php

-
message: "#^Method Shopware\\\\Administration\\\\Test\\\\Migration\\\\Migration1636121186CopySalesChannelIdsIntoUserConfigTest\\:\\:fetchSalesChannelNames\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Administration/Test/Migration/Migration1636121186CopySalesChannelIdsIntoUserConfigTest.php

-
message: "#^Method Shopware\\\\Administration\\\\Test\\\\Migration\\\\Migration1636121186CopySalesChannelIdsIntoUserConfigTest\\:\\:getSalesChannelFixture\\(\\) has parameter \\$merge with no value type specified in iterable type array\\.$#"
count: 1
path: src/Administration/Test/Migration/Migration1636121186CopySalesChannelIdsIntoUserConfigTest.php

-
message: "#^Method Shopware\\\\Administration\\\\Test\\\\Migration\\\\Migration1636121186CopySalesChannelIdsIntoUserConfigTest\\:\\:getSalesChannelFixture\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Administration/Test/Migration/Migration1636121186CopySalesChannelIdsIntoUserConfigTest.php

-
message: "#^Method Shopware\\\\Administration\\\\Test\\\\Migration\\\\Migration1636121186CopySalesChannelIdsIntoUserConfigTest\\:\\:getUserFixture\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Administration/Test/Migration/Migration1636121186CopySalesChannelIdsIntoUserConfigTest.php

-
message: "#^Property Shopware\\\\Administration\\\\Test\\\\Migration\\\\Migration1636121186CopySalesChannelIdsIntoUserConfigTest\\:\\:\\$languages type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Administration/Test/Migration/Migration1636121186CopySalesChannelIdsIntoUserConfigTest.php

-
message: "#^Method Shopware\\\\Administration\\\\Test\\\\Notification\\\\Repository\\\\NotificationRepositoryTest\\:\\:notificationProvider\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Administration/Test/Notification/Repository/NotificationRepositoryTest.php

-
message: "#^Cannot call method getValue\\(\\) on Shopware\\\\Core\\\\Framework\\\\DataAbstractionLayer\\\\Entity\\|null\\.$#"
count: 2
path: src/Administration/Test/System/SalesChannel/Subscriber/SalesChannelUserConfigSubscriberTest.php

-
message: "#^Cannot call method getDeliveryDate\\(\\) on Shopware\\\\Core\\\\Checkout\\\\Cart\\\\Delivery\\\\Struct\\\\DeliveryPosition\\|null\\.$#"
count: 1
Expand Down
4 changes: 0 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
<directory suffix=".php">src/Core/Migration/Test</directory>
<directory suffix=".php">src/Core/System/Test</directory>
<directory suffix=".php">src/Elasticsearch/Test</directory>
<directory suffix=".php">src/Administration/Test</directory>
<directory suffix=".php">src/Storefront/Test</directory>
<directory suffix=".php">./vendor</directory>
<directory suffix=".php">./var</directory>
Expand Down Expand Up @@ -90,9 +89,6 @@
</php>
<testsuites>
<!-- Legacy -->
<testsuite name="administration">
<directory>src/Administration/Test</directory>
</testsuite>
<testsuite name="storefront">
<directory>src/Storefront/Test</directory>
</testsuite>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

namespace Shopware\Administration\Test\Migration;
namespace Shopware\Core\Migration\Test;

use Doctrine\DBAL\Connection;
use PHPUnit\Framework\TestCase;
Expand All @@ -17,7 +17,7 @@ class Migration1632281097NotificationTest extends TestCase
public function testNoNotificationTable(): void
{
$conn = $this->getContainer()->get(Connection::class);
$conn->executeStatement('DROP TABLE `notification`');
$conn->executeStatement('DROP TABLE IF EXISTS `notification`');

$migration = new Migration1632281097Notification();
$migration->update($conn);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

namespace Shopware\Administration\Test\Migration;
namespace Shopware\Core\Migration\Test;

use Doctrine\DBAL\ArrayParameterType;
use Doctrine\DBAL\Connection;
Expand Down Expand Up @@ -32,6 +32,9 @@ class Migration1636121186CopySalesChannelIdsIntoUserConfigTest extends TestCase

private Connection $connection;

/**
* @var array<string, string>
*/
private array $languages;

protected function setUp(): void
Expand Down Expand Up @@ -109,6 +112,8 @@ public function testMigrationCopiesAlphabeticallyCorrect(): void

/**
* @param string[] $salesChannelIds
*
* @return list<mixed>
*/
private function fetchSalesChannelNames(array $salesChannelIds, string $languageId): array
{
Expand Down Expand Up @@ -137,6 +142,9 @@ private function createUserForEachLanguage(): void
->create($insert, Context::createDefaultContext());
}

/**
* @return array<string, string|bool>
*/
private function getUserFixture(string $username, string $localeId): array
{
return [
Expand All @@ -151,6 +159,9 @@ private function getUserFixture(string $username, string $localeId): array
];
}

/**
* @return array<string, string>
*/
private function fetchLanguages(): array
{
$all = $this->connection->createQueryBuilder()
Expand All @@ -171,6 +182,9 @@ private function fetchLanguages(): array
return FetchModeHelper::keyPair($all);
}

/**
* @return array<string, string>
*/
private function fetchConfigs(): array
{
$all = $this->connection->createQueryBuilder()
Expand All @@ -190,6 +204,11 @@ private function fetchConfigs(): array
return FetchModeHelper::keyPair($all);
}

/**
* @param array<string> $languages
*
* @return array<int|string, array<int, mixed>>
*/
private function fetchExpectedSalesChannelIds(array $languages): array
{
$all = $this->connection->createQueryBuilder()
Expand Down Expand Up @@ -255,6 +274,11 @@ private function createSalesChannels(): void
->create($insert, Context::createDefaultContext());
}

/**
* @param array<mixed> $merge
*
* @return array<string, string>
*/
private function getSalesChannelFixture(array $merge): array
{
$data = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

namespace Shopware\Administration\Test\DependencyInjection;
namespace Shopware\Tests\Integration\Administration\DependencyInjection;

use PHPUnit\Framework\TestCase;
use Shopware\Administration\DependencyInjection\AdministrationMigrationCompilerPass;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

namespace Shopware\Administration\Test\Elasticsearch;
namespace Shopware\Tests\Integration\Administration\Elasticsearch;

use PHPUnit\Framework\TestCase;
use Shopware\Core\Content\Product\DataAbstractionLayer\CheapestPrice\CheapestPriceField;
Expand Down Expand Up @@ -36,7 +36,7 @@ public function testMappingHasConditionField(): void
static::fail('EsProductDefinition is not defined');
}

$js = file_get_contents(__DIR__ . '/../../Resources/app/administration/src/app/service/product-stream-condition.service.js');
$js = file_get_contents(__DIR__ . '/../../../../src/Administration/Resources/app/administration/src/app/service/product-stream-condition.service.js');

if (!$js) {
static::fail('product-stream-condition.service.js not found');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

namespace Shopware\Administration\Test\Notification\Repository;
namespace Shopware\Tests\Integration\Administration\Notification\Repository;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -77,6 +77,9 @@ public function testNotificationCreateNotification(string $scope, string $behavi
static::assertSame($data['message'], $notification->getMessage());
}

/**
* @return array<int, array<int, string>>
*/
public static function notificationProvider(): array
{
return [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

namespace Shopware\Administration\Test\RateLimiter;
namespace Shopware\Tests\Integration\Administration\RateLimiter;

use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);

namespace Shopware\Administration\Test\Service;
namespace Shopware\Tests\Integration\Administration\Service;

use Doctrine\DBAL\Connection;
use PHPUnit\Framework\TestCase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<?php declare(strict_types=1);

namespace Shopware\Administration\Test\System\SalesChannel\Subscriber;
namespace Shopware\Tests\Integration\Administration\System\SalesChannel\Subscriber;

use Doctrine\DBAL\Connection;
use PHPUnit\Framework\TestCase;
use Shopware\Administration\System\SalesChannel\Subscriber\SalesChannelUserConfigSubscriber;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\Framework\Test\TestCaseBase\SalesChannelFunctionalTestBehaviour;
use Shopware\Core\Framework\Test\TestCaseHelper\TestUser;
use Shopware\Core\Framework\Uuid\Uuid;
use Shopware\Core\System\User\Aggregate\UserConfig\UserConfigCollection;

/**
* @internal
Expand All @@ -26,6 +28,7 @@ public function testDeleteWillRemoveUserConfigs(): void
$salesChannelId1 = Uuid::randomHex();
$salesChannelId2 = Uuid::randomHex();

/** @var EntityRepository<UserConfigCollection> $userConfigRepository */
$userConfigRepository = $this->getContainer()->get('user_config.repository');
$userConfigId = Uuid::randomHex();
$userConfigRepository->create([
Expand All @@ -38,14 +41,26 @@ public function testDeleteWillRemoveUserConfigs(): void
],
], $context);

static::assertCount(2, $userConfigRepository->search(new Criteria([$userConfigId]), $context)->first()->getValue());
$search = $userConfigRepository->search(new Criteria([$userConfigId]), $context)
->getEntities()
->first();

static::assertNotNull($search);
static::assertIsArray($search->getValue());
static::assertCount(2, $search->getValue());

$this->createSalesChannel(['id' => $salesChannelId1]);
$this->createSalesChannel(['id' => $salesChannelId2]);

$salesChannelRepository = $this->getContainer()->get('sales_channel.repository');
$salesChannelRepository->delete([['id' => $salesChannelId1], ['id' => $salesChannelId2]], $context);

static::assertCount(0, $userConfigRepository->search(new Criteria([$userConfigId]), $context)->first()->getValue());
$search = $userConfigRepository->search(new Criteria([$userConfigId]), $context)
->getEntities()
->first();

static::assertNotNull($search);
static::assertIsArray($search->getValue());
static::assertCount(0, $search->getValue());
}
}

0 comments on commit b4acddd

Please sign in to comment.