Skip to content

Commit

Permalink
Merge pull request #41 from magento/develop
Browse files Browse the repository at this point in the history
Update 2.0 branch
  • Loading branch information
sidolov authored Apr 9, 2024
2 parents 20ac60b + ba35880 commit 8a133a9
Show file tree
Hide file tree
Showing 12 changed files with 132 additions and 15 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This is a basic workflow to help you get started with Actions

name: Integration Tests

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
pull_request:
types: [opened, reopened,synchronize]
branches:
- develop

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'

# Runs a single command using the runners shell
- name: Run composer install
run: composer install

# Runs a single command using the runners shell
- name: Run unit tests
run: php vendor/bin/phpunit tests/Integration
40 changes: 40 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This is a basic workflow to help you get started with Actions

name: Unit Tests

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
pull_request:
types: [opened, reopened,synchronize]
branches:
- develop

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'

# Runs a single command using the runners shell
- name: Run composer install
run: composer install

# Runs a single command using the runners shell
- name: Run unit tests
run: php vendor/bin/phpunit tests/Unit
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"AFL-3.0"
],
"require": {
"php": "~7.3.0||~7.4.0||~8.0.0||~8.1.0",
"composer/composer": "^1.0 || ^2.0",
"php": "~7.3.0||~7.4.0||~8.0.0||~8.1.0||~8.2.0||~8.3.0",
"composer/composer": "^2.0",
"composer-plugin-api": "^1.0 || ^2.0"
},
"require-dev": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class OverrideRequireCommand extends ExtendableRequireCommand
* @param Application|null $application
* @return void
*/
public function setApplication(Application $application = null)
public function setApplication(Application $application = null): void
{
// For Composer versions below 2.1.6:
// In order to trick Composer into overriding its native RequireCommand with this class, the name needs to be
Expand All @@ -86,7 +86,7 @@ public function setApplication(Application $application = null)
*
* @return void
*/
protected function configure()
protected function configure(): void
{
parent::configure();

Expand Down Expand Up @@ -170,7 +170,7 @@ protected function configure()
*
* @throws Exception
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->console = new Console($this->getIO(), $input->getOption(self::INTERACTIVE_OPT));
$this->pkgUtils = new PackageUtils($this->console);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,17 @@ class RequireCommerceCommand extends ExtendableRequireCommand
*/
protected $console;

/**
* @var array
*/
protected $repos;

/**
* Use the native RequireCommand config with options/doc additions for the root project composer.json update
*
* @return void
*/
protected function configure()
protected function configure(): void
{
parent::configure();

Expand Down Expand Up @@ -149,7 +154,7 @@ protected function getFormattedHelp(): string
*
* @throws Exception
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->console = new Console($this->getIO(), $input->getOption(self::INTERACTIVE_OPT));
$console = $this->console;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function getEditionLabel(string $packageEdition): ?string
public function findRequire(Composer $composer, string $packageMatcher)
{
$requires = array_values($composer->getPackage()->getRequires());
if (@preg_match($packageMatcher, null) === false) {
if (@preg_match($packageMatcher, '') === false) {
foreach ($requires as $link) {
if ($packageMatcher == $link->getTarget()) {
return $link;
Expand Down
4 changes: 2 additions & 2 deletions src/Magento/ComposerRootUpdatePlugin/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"name": "magento/composer-root-update-plugin",
"type": "composer-plugin",
"description": "Plugin to look ahead for Magento Open Source or Adobe Commerce project root changes when running composer update for new magento/product or magento/magento-cloud metapackage versions",
"version": "2.0.2",
"version": "2.0.4",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"require": {
"php": "~7.3.0||~7.4.0||~8.0.0||~8.1.0",
"php": "~7.3.0||~7.4.0||~8.0.0||~8.1.0||~8.2.0||~8.3.0",
"composer/composer": "^1.0 || ^2.0",
"composer-plugin-api": "^1.0 || ^2.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
"vendor1/different-conflicting2": "2.0.0",
"vendor1/different-conflicting3": "3.0.0"
},
"config": {
"allow-plugins": true
},
"extra": {
"extra-key1": "install1",
"extra-key2": "target2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
"Magento\\Sniffs\\": "dev/tests/framework/Magento/Sniffs/"
}
},
"config": {
"allow-plugins": true
},
"conflict": {
"vendor1/conflicting1": "1.0.0",
"vendor1/conflicting2": "2.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@
"sample-data": "Suggested Sample Data 1.0.0",
"vendor/suggested": "Another Suggested Package"
},
"config": {
"allow-plugins": true
},
"minimum-stability": "dev"
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Composer\Package\RootPackageInterface;
use Composer\Plugin\PluginInterface;
use Composer\Repository\ComposerRepository;
use Composer\Repository\RepositoryInterface;
use Composer\Repository\LockArrayRepository;
use Composer\Repository\RepositoryManager;
use Composer\Util\RemoteFilesystem;
use Magento\ComposerRootUpdatePlugin\Utils\Console;
Expand Down Expand Up @@ -153,7 +153,7 @@ public function testGetOriginalRootNotOnRepo_NoConfirm()

public function testGetTargetRootFromRepo()
{
$this->repo->expects($this->any())->method('loadPackages')->willReturn(
$this->repo->expects($this->atLeast(1))->method('loadPackages')->willReturn(
[
'namesFound' => [$this->originalRoot->getName()],
'packages' => [
Expand Down Expand Up @@ -210,7 +210,16 @@ protected function setUp(): void
'isLocked',
'getLockedRepository'
]);
$lockedRepo = $this->getMockForAbstractClass(RepositoryInterface::class);
$lockedRepo = $this->getMockForAbstractClass(
LockArrayRepository::class,
[],
'',
true,
true,
true,
['getPackages'],
false
);
$originalProduct = $this->getMockForAbstractClass(PackageInterface::class);
$originalProduct->method('getName')->willReturn('magento/product-enterprise-edition');
$originalProduct->method('getVersion')->willReturn('1.1.0.0');
Expand All @@ -232,11 +241,15 @@ protected function setUp(): void
$this->originalRoot->method('getVersion')->willReturn('1.1.0.0');
$this->originalRoot->method('getStabilityPriority')->willReturn(0);

$this->targetRoot = $this->createPartialMock(Package::class, ['getName', 'getVersion', 'getStabilityPriority']);
$this->targetRoot = $this->createPartialMock(
Package::class,
['getName', 'getVersion', 'getStabilityPriority', 'getPrettyVersion']
);
$this->targetRoot->id = 2;
$this->targetRoot->method('getName')->willReturn('magento/project-enterprise-edition');
$this->targetRoot->method('getVersion')->willReturn('2.0.0.0');
$this->targetRoot->method('getStabilityPriority')->willReturn(0);
$this->targetRoot->method('getPrettyVersion')->willReturn('');

$repoManager = $this->createPartialMock(RepositoryManager::class, ['getRepositories']);
if ($apiMajorVersion == '1') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Composer\Package\Package;
use Composer\Package\RootPackage;
use Composer\Repository\ComposerRepository;
use Composer\Repository\LockArrayRepository;
use Composer\Repository\RepositoryInterface;
use Composer\Repository\RepositoryManager;
use Composer\Semver\Constraint\Constraint;
Expand Down Expand Up @@ -273,7 +274,16 @@ public function setUp(): void
$repo = $this->createPartialMock(ComposerRepository::class, []);
$repoManager = $this->createPartialMock(RepositoryManager::class, ['getRepositories']);
$repoManager->method('getRepositories')->willReturn([$repo]);
$lockedRepo = $this->getMockForAbstractClass(RepositoryInterface::class);
$lockedRepo = $this->getMockForAbstractClass(
LockArrayRepository::class,
[],
'',
true,
true,
true,
['getPackages'],
false
);
$lockedRepo->method('getPackages')->willReturn([
new Package('magento/product-community-edition', '1.0.0.0', '1.0.0')
]);
Expand Down

0 comments on commit 8a133a9

Please sign in to comment.