Skip to content

Commit

Permalink
Merge pull request #4414 from nanasess/improve/php7.4
Browse files Browse the repository at this point in the history
PHP7.4対応
  • Loading branch information
okazy authored Mar 4, 2020
2 parents 875e82e + bf4cb0e commit 23d0ee7
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ ubuntu-18.04 ]
php: [ 7.1, 7.2, 7.3 ]
php: [ 7.1, 7.2, 7.3, 7.4 ]
db: [ mysql, pgsql, sqlite3 ]
include:
- db: mysql
Expand Down
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ php:
- 7.1
- 7.2
- 7.3
- 7.4snapshot
- 7.4

env:
global:
Expand All @@ -35,7 +35,6 @@ env:

matrix:
allow_failures:
- php: 7.4snapshot
- env: DATABASE_URL=sqlite:///var/eccube.db DATABASE_SERVER_VERSION=3 COVERAGE=1
- env: APP_ENV=codeception

Expand Down
2 changes: 1 addition & 1 deletion codeception/_support/Page/Admin/PluginManagePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function ストアプラグイン_無効化($pluginCode, $message = '無
public function ストアプラグイン_削除($pluginCode, $message = '削除が完了しました。')
{
$this->ストアプラグイン_ボタンクリック($pluginCode, '削除');
$this->tester->waitForElementVisible(['id' => 'officialPluginDeleteButton']);
$this->tester->waitForElementVisible(['id' => 'officialPluginDeleteButton'], 60);
$this->tester->click(['id' => 'officialPluginDeleteButton']);
$this->tester->waitForElementVisible(['css' => '#officialPluginDeleteModal > div > div > div.modal-footer > button:nth-child(3)'], 30);
$this->tester->see($message, ['css' => '#officialPluginDeleteModal > div > div > div.modal-body.text-left > p']);
Expand Down
2 changes: 1 addition & 1 deletion codeception/_support/Page/Admin/PluginStoreInstallPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function at($I)
public function インストール($message = 'インストールが完了しました。')
{
$this->tester->click(['css' => '#plugin-list > div.card-body > div:nth-child(2) > div > button.btn.btn-primary']);
$this->tester->waitForElementVisible(['id' => 'installBtn']);
$this->tester->waitForElementVisible(['id' => 'installBtn'], 60);
$this->tester->click(['id' => 'installBtn']);
$this->tester->waitForElementVisible(['css' => '#installModal > div > div > div.modal-footer > a'], 60);
$this->tester->see($message, ['css' => '#installModal > div > div > div.modal-body > p']);
Expand Down
10 changes: 1 addition & 9 deletions src/Eccube/Controller/Admin/Store/OwnerStoreController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Eccube\Form\Type\Admin\SearchPluginApiType;
use Eccube\Repository\BaseInfoRepository;
use Eccube\Repository\PluginRepository;
use Eccube\Service\Composer\ComposerProcessService;
use Eccube\Service\Composer\ComposerServiceInterface;
use Eccube\Service\PluginApiService;
use Eccube\Service\PluginService;
Expand Down Expand Up @@ -77,7 +76,6 @@ class OwnerStoreController extends AbstractController
*
* @param PluginRepository $pluginRepository
* @param PluginService $pluginService
* @param ComposerProcessService $composerProcessService
* @param ComposerServiceInterface $composerService
* @param SystemService $systemService
* @param PluginApiService $pluginApiService
Expand All @@ -90,7 +88,6 @@ class OwnerStoreController extends AbstractController
public function __construct(
PluginRepository $pluginRepository,
PluginService $pluginService,
ComposerProcessService $composerProcessService,
ComposerServiceInterface $composerService,
SystemService $systemService,
PluginApiService $pluginApiService,
Expand All @@ -105,12 +102,7 @@ public function __construct(
$this->cacheUtil = $cacheUtil;

// TODO: Check the flow of the composer service below
$memoryLimit = $this->systemService->getMemoryLimit();
if ($memoryLimit == -1 or $memoryLimit >= $this->eccubeConfig['eccube_composer_memory_limit']) {
$this->composerService = $composerService;
} else {
$this->composerService = $composerProcessService;
}
$this->composerService = $composerService;
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/Eccube/Form/Type/AddCartType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\ORM\EntityManager;
use Eccube\Common\EccubeConfig;
use Eccube\Entity\CartItem;
use Eccube\Entity\ProductClass;
use Eccube\Form\DataTransformer\EntityToIdTransformer;
Expand All @@ -35,7 +36,7 @@
class AddCartType extends AbstractType
{
/**
* @var array
* @var EccubeConfig
*/
protected $config;

Expand All @@ -56,9 +57,10 @@ class AddCartType extends AbstractType

protected $doctrine;

public function __construct(ManagerRegistry $doctrine)
public function __construct(ManagerRegistry $doctrine, EccubeConfig $config)
{
$this->doctrine = $doctrine;
$this->config = $config;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Eccube/Form/Type/Admin/PluginLocalInstallType.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'mapped' => false,
'required' => true,
'constraints' => [
new Assert\NotBlank(['message' => 'pluginlocalinstall.text.message.select_file']),
new Assert\NotBlank(),
new Assert\File([
'mimeTypes' => ['application/zip', 'application/x-tar', 'application/x-gzip'],
'mimeTypesMessage' => 'pluginlocalinstall.text.message.allowed_format',
'mimeTypes' => ['application/zip', 'application/x-tar', 'application/x-gzip', 'application/gzip'],
'mimeTypesMessage' => 'admin.store.template.invalid_upload_file',
]),
],
]);
Expand Down
2 changes: 1 addition & 1 deletion src/Eccube/Form/Type/Admin/PluginManagementType.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'constraints' => [
new Assert\NotBlank(['message' => 'ファイルを選択してください。']),
new Assert\File([
'mimeTypes' => ['application/zip', 'application/x-tar', 'application/x-gzip'],
'mimeTypes' => ['application/zip', 'application/x-tar', 'application/x-gzip', 'application/gzip'],
'mimeTypesMessage' => 'zipファイル、tarファイル、tar.gzファイルのいずれかをアップロードしてください。',
]),
],
Expand Down
2 changes: 1 addition & 1 deletion src/Eccube/Form/Type/Admin/TemplateType.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'constraints' => [
new Assert\NotBlank(['message' => trans('admin.common.select')]),
new Assert\File([
'mimeTypes' => ['application/zip', 'application/x-tar', 'application/x-gzip'],
'mimeTypes' => ['application/zip', 'application/x-tar', 'application/x-gzip', 'application/gzip'],
'mimeTypesMessage' => trans('admin.store.template.invalid_upload_file'),
]),
],
Expand Down
6 changes: 5 additions & 1 deletion src/Eccube/Repository/AbstractRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public function save($entity)

protected function getCacheLifetime()
{
return $this->eccubeConfig['eccube_result_cache_lifetime'];
if ($this->eccubeConfig !== null) {
return $this->eccubeConfig['eccube_result_cache_lifetime'];
}

return 0;
}
}
1 change: 1 addition & 0 deletions src/Eccube/Service/Composer/ComposerProcessService.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

/**
* Class ComposerProcessService
* @deprecated Not maintained
*/
class ComposerProcessService implements ComposerServiceInterface
{
Expand Down
3 changes: 3 additions & 0 deletions tests/Eccube/Tests/Util/StringUtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public function testRandomWithParams()

public function testRandomException()
{
if (PHP_VERSION_ID >= 70400) {
$this->markTestSkipped('Skip because it is fatal error in PHP7.4 or higher.');
}
$this->expected = 'Unable to generate random string.';
try {
StringUtil::random(0);
Expand Down

0 comments on commit 23d0ee7

Please sign in to comment.