Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatible 4.3 #61

Merged
merged 8 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ on:
jobs:
run-on-linux:
name: Run on Linux
runs-on: ${{ matrix.operating-system }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
operating-system: [ ubuntu-18.04 ]
php: [ '7.4', '8.0', '8.1' ]
eccube_version: [ '4.2', '4.3-symfony6' ]
dotani1111 marked this conversation as resolved.
Show resolved Hide resolved
php: [ '7.4', '8.0', '8.1', '8.2', '8.3']
db: [ 'mysql', 'mysql8', 'pgsql' ]
eccube_version: [ '4.2' ]
plugin_code: [ 'Maker42' ]
include:
- db: mysql
Expand All @@ -39,6 +38,15 @@ jobs:
database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db
database_server_version: 14
database_charset: utf8
exclude:
- eccube_version: 4.2
php: 8.2
- eccube_version: 4.2
php: 8.3
- eccube_version: 4.3-symfony6
dotani1111 marked this conversation as resolved.
Show resolved Hide resolved
php: 7.4
- eccube_version: 4.3-symfony6
dotani1111 marked this conversation as resolved.
Show resolved Hide resolved
php: 8.0
services:
mysql:
image: mysql:5.7
Expand Down Expand Up @@ -72,7 +80,6 @@ jobs:
- 1080:1080
- 1025:1025
steps:
- run: sudo apt-get purge -y hhvm
- name: Checkout
uses: actions/checkout@v2

Expand Down Expand Up @@ -143,7 +150,7 @@ jobs:
working-directory: 'ec-cube'
run: |
bin/console cache:clear --no-warmup
bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist app/Plugin/${PLUGIN_CODE}/Tests
./vendor/bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist app/Plugin/${PLUGIN_CODE}/Tests

- name: Disable Plugin
working-directory: 'ec-cube'
Expand Down
2 changes: 1 addition & 1 deletion Controller/MakerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function delete(Request $request, Maker $Maker)
} catch (\Exception $e) {
log_info('メーカー削除エラー', ['Maker id' => $Maker->getId(), $e]);

$message = trans('admin.delete.failed.foreign_key', ['%name%' => $Maker->getName()]);
$message = trans('admin.common.delete_error_foreign_key', ['%name%' => $Maker->getName()]);
$this->addError($message, 'admin');
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/Web/Admin/MakerControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function setUp(): void
parent::setUp();
$this->deleteAllRows(['plg_maker']);

$this->makerRepository = self::$container->get(MakerRepository::class);
$this->makerRepository = self::getContainer()->get(MakerRepository::class);
}

/**
Expand Down
28 changes: 23 additions & 5 deletions Tests/Web/Admin/ProductMakerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
namespace Plugin\Maker42\Tests\Web\Admin;

use Faker\Generator;
use Eccube\Common\Constant;
use Plugin\Maker42\Tests\Web\MakerWebCommon;
use Symfony\Component\HttpKernel\Client;
use Symfony\Component\DomCrawler\Crawler;
use Eccube\Repository\ProductRepository;

/**
Expand Down Expand Up @@ -44,7 +46,7 @@ protected function setUp() :void
parent::setUp();
$this->deleteAllRows(['plg_maker']);

$this->productRepository = self::$container->get(ProductRepository::class);
$this->productRepository = self::getContainer()->get(ProductRepository::class);
}

/**
Expand Down Expand Up @@ -142,7 +144,12 @@ public function testProductNewWithAddMakerInvalid()
);

// Check message
$this->assertStringContainsString('有効な値ではありません。', $crawler->filter('.form-error-message')->html());
$errorMessages = $crawler->filter('.form-error-message')->each(function (Crawler $node): string {
return $node->text();
});
$versionParts = explode('-', Constant::VERSION);
$expectedMessage = version_compare(reset($versionParts), '4.3.0', '<') ? '有効な値ではありません。' : '選択した値は無効です。';
$this->assertStringContainsString($expectedMessage, implode("\n", $errorMessages));

// Check database
$Product = $this->productRepository->findOneBy([], ['id' => 'DESC']);
Expand Down Expand Up @@ -220,7 +227,10 @@ public function testProductNewWithAddMakerAndMakerUrlInValid()
);

// Check message
$this->assertStringContainsString('有効なURLではありません。', $crawler->filter('.form-error-message')->html());
$errorMessages = $crawler->filter('.form-error-message')->each(function (Crawler $node): string {
return $node->text();
});
$this->assertStringContainsString('有効なURLではありません。', implode("\n", $errorMessages));

// Check database
$Product = $this->productRepository->findOneBy([], ['id' => 'DESC']);
Expand Down Expand Up @@ -407,7 +417,12 @@ public function testProductEditWithAddMakerInvalid()
);

// Check message
$this->assertStringContainsString('有効な値ではありません。', $crawler->filter('.form-error-message')->html());
$errorMessages = $crawler->filter('.form-error-message')->each(function (Crawler $node): string {
return $node->text();
});
$versionParts = explode('-', Constant::VERSION);
$expectedMessage = version_compare(reset($versionParts), '4.3.0', '<') ? '有効な値ではありません。' : '選択した値は無効です。';
$this->assertStringContainsString($expectedMessage, implode("\n", $errorMessages));

// Check database
$Product = $this->productRepository->findOneBy([], ['id' => 'DESC']);
Expand Down Expand Up @@ -520,7 +535,10 @@ public function testProductEditWithAddMakerAndMakerUrlInValid()
);

// Check message
$this->assertStringContainsString('有効なURLではありません。', $crawler->filter('.form-error-message')->html());
$errorMessages = $crawler->filter('.form-error-message')->each(function (Crawler $node): string {
return $node->text();
});
$this->assertStringContainsString('有効なURLではありません。', implode("\n", $errorMessages));

// Check database
$Product = $this->productRepository->findOneBy([], ['id' => 'DESC']);
Expand Down
4 changes: 2 additions & 2 deletions Tests/Web/ProductDetailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected function setUp(): void

$this->Maker = $this->createMaker();
$this->Product = $this->createProductMaker($this->Maker);
$this->productRepository = self::$container->get(ProductRepository::class);
$this->productRepository = self::getContainer()->get(ProductRepository::class);
}

/**
Expand Down Expand Up @@ -145,7 +145,7 @@ protected function createProductMaker(Maker $Maker, $Product = null)

$client->followRedirect();

$this->productRepository = self::$container->get(ProductRepository::class);
$this->productRepository = self::getContainer()->get(ProductRepository::class);
$Product = $this->productRepository->find($productId);
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ec-cube/maker42",
"version": "4.2.2",
"version": "4.3.0",
"description": "メーカー管理プラグイン",
"type": "eccube-plugin",
"require": {
Expand Down
Loading