Skip to content

Commit

Permalink
Merge pull request #5 from EC-CUBE/4.1-feature
Browse files Browse the repository at this point in the history
Merge from upstream
  • Loading branch information
tao-s authored Apr 21, 2021
2 parents 3ef6055 + 60f8669 commit 4ba47e1
Show file tree
Hide file tree
Showing 110 changed files with 2,174 additions and 625 deletions.
1 change: 1 addition & 0 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ MAILER_URL=null://localhost
#ECCUBE_ADMIN_ROUTE=admin
#ECCUBE_USER_DATA_ROUTE=user_data
#ECCUBE_ADMIN_ALLOW_HOSTS=[]
#ECCUBE_ADMIN_DENY_HOSTS=[]
#ECCUBE_FORCE_SSL=false
#ECCUBE_TEMPLATE_CODE=default
#ECCUBE_AUTH_MAGIC=<change.me>
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,13 @@ jobs:
rm -rf $GITHUB_WORKSPACE/.gitignore
rm -rf $GITHUB_WORKSPACE/.buildpath
rm -rf $GITHUB_WORKSPACE/.gitmodules
rm -rf $GITHUB_WORKSPACE/.scrutinizer.yml
rm -rf $GITHUB_WORKSPACE/.travis.yml
rm -rf $GITHUB_WORKSPACE/appveyor.yml
rm -rf $GITHUB_WORKSPACE/.coveralls.yml
rm -rf $GITHUB_WORKSPACE/.php_cs.dist
rm -rf $GITHUB_WORKSPACE/phpunit.xml.dist
rm -rf $GITHUB_WORKSPACE/phpstan.neon.dist
rm -rf $GITHUB_WORKSPACE/app.json
rm -rf $GITHUB_WORKSPACE/Procfile
rm -rf $GITHUB_WORKSPACE/LICENSE.txt
rm -rf $GITHUB_WORKSPACE/README.md
rm -rf $GITHUB_WORKSPACE/codeception.sh
rm -rf $GITHUB_WORKSPACE/codeception.yml
rm -rf $GITHUB_WORKSPACE/app/Plugin/*
rm -rf $GITHUB_WORKSPACE/codeception
Expand Down
426 changes: 0 additions & 426 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ EXPOSE 443
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
# Override with custom configuration settings
COPY dockerbuild/php.ini $PHP_INI_DIR/conf.d/
COPY dockerbuild/docker-php-entrypoint /usr/local/bin/

RUN chown www-data:www-data /var/www \
&& mkdir -p ${APACHE_DOCUMENT_ROOT}/vendor \
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# EC-CUBE 4.0

[![Build Status](https://travis-ci.com/EC-CUBE/ec-cube.svg?branch=4.0)](https://travis-ci.com/EC-CUBE/ec-cube)
[![Unit test for EC-CUBE](https://github.com/EC-CUBE/ec-cube/actions/workflows/unit-test.yml/badge.svg?branch=4.0)](https://github.com/EC-CUBE/ec-cube/actions/workflows/unit-test.yml)
[![E2E test for EC-CUBE](https://github.com/EC-CUBE/ec-cube/actions/workflows/e2e-test.yml/badge.svg?branch=4.0)](https://github.com/EC-CUBE/ec-cube/actions/workflows/e2e-test.yml)
[![Plugin test for EC-CUBE](https://github.com/EC-CUBE/ec-cube/actions/workflows/plugin-test.yml/badge.svg?branch=4.0)](https://github.com/EC-CUBE/ec-cube/actions/workflows/plugin-test.yml)
[![PHPStan](https://github.com/EC-CUBE/ec-cube/actions/workflows/phpstan.yml/badge.svg?branch=4.0)](https://github.com/EC-CUBE/ec-cube/actions/workflows/phpstan.yml)
[![codecov](https://codecov.io/gh/EC-CUBE/ec-cube/branch/4.0/graph/badge.svg?token=BhnPjjvfwd)](https://codecov.io/gh/EC-CUBE/ec-cube)

[![Slack](https://img.shields.io/badge/slack-join%5fchat-brightgreen.svg?style=flat)](https://join.slack.com/t/ec-cube/shared_invite/enQtNDA1MDYzNDQxMTIzLTY5MTRhOGQ2MmZhMjQxYTAwMmVlMDc5MDU2NjJlZmFiM2E3M2Q0M2Y3OTRlMGY4NTQzN2JiZDBkNmQwNTUzYzc)
Expand Down
59 changes: 59 additions & 0 deletions app/DoctrineMigrations/Version20210319122142.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

declare(strict_types=1);

/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Eccube\Entity\Master\LoginHistoryStatus;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20210319122142 extends AbstractMigration
{
public function up(Schema $schema): void
{
$lang = env('ECCUBE_LOCALE');
$statuses = [
LoginHistoryStatus::FAILURE => $lang === 'en' ? 'Failure' : '失敗',
LoginHistoryStatus::SUCCESS => $lang === 'en' ? 'Success' : '成功',
];

$sortNo = $this->connection->fetchColumn('SELECT MAX(sort_no) + 1 FROM mtb_login_history_status');
if (is_null($sortNo)) {
$sortNo = 0;
}

foreach ($statuses as $id => $name) {
$statusExists = $this->connection->fetchColumn(
'SELECT COUNT(*) FROM mtb_login_history_status WHERE id = :id',
[':id' => $id]
);

if ($statusExists == 0) {
$this->addSql(
"INSERT INTO mtb_login_history_status (id, name, sort_no, discriminator_type) VALUES (?, ?, ?, 'loginhistorystatus')",
[$id, $name, $sortNo++]
);
}
}
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
}
}
6 changes: 3 additions & 3 deletions app/Plugin/HogePlugin/composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "ec-cube/Hoge",
"name": "ec-cube/HogePlugin",
"version": "1.0.0",
"description": "プラグインサンプル",
"type": "eccube-plugin",
"extra": {
"code": "Hoge"
"code": "HogePlugin"
}
}
}
2 changes: 2 additions & 0 deletions app/config/eccube/packages/eccube.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ parameters:
env(ECCUBE_ADMIN_ROUTE): 'admin'
env(ECCUBE_USER_DATA_ROUTE): 'user_data'
env(ECCUBE_ADMIN_ALLOW_HOSTS): '[]'
env(ECCUBE_ADMIN_DENY_HOSTS): '[]'
env(ECCUBE_FORCE_SSL): false
env(ECCUBE_TEMPLATE_CODE): 'default'
env(ECCUBE_AUTH_MAGIC): '<change.me>'
Expand All @@ -20,6 +21,7 @@ parameters:
eccube_admin_route: '%env(ECCUBE_ADMIN_ROUTE)%'
eccube_user_data_route: '%env(ECCUBE_USER_DATA_ROUTE)%'
eccube_admin_allow_hosts: '%env(json:ECCUBE_ADMIN_ALLOW_HOSTS)%'
eccube_admin_deny_hosts: '%env(json:ECCUBE_ADMIN_DENY_HOSTS)%'
eccube_force_ssl: '%env(bool:ECCUBE_FORCE_SSL)%'
eccube.theme: '%env(ECCUBE_TEMPLATE_CODE)%'
eccube_theme_code: '%eccube.theme%'
Expand Down
3 changes: 3 additions & 0 deletions app/config/eccube/packages/eccube_nav.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ parameters:
security:
name: admin.setting.system.security_management
url: admin_setting_system_security
login_history:
name: admin.setting.system.login_history
url: admin_setting_system_login_history
log:
name: admin.setting.system.log_display
url: admin_setting_system_log
Expand Down
26 changes: 0 additions & 26 deletions codeception.sh

This file was deleted.

2 changes: 1 addition & 1 deletion codeception/_support/AcceptanceTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function logoutAsAdmin()
$isLogin = $I->grabTextFrom('header.c-headerBar div.c-headerBar__container a.c-headerBar__userMenu span');
if ($isLogin == '管理者 様') {
$I->click('header.c-headerBar div.c-headerBar__container a.c-headerBar__userMenu');
$I->click('#page_admin_homepage div.popover .popover-body a:last-child');
$I->click('body div.popover .popover-body a:last-child');
$config = Fixtures::get('config');
$I->amOnPage('/'.$config['eccube_admin_route'].'/logout');
$I->see('ログイン', '#form1 > button');
Expand Down
63 changes: 63 additions & 0 deletions codeception/_support/Page/Admin/LoginHistoryPage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Page\Admin;

class LoginHistoryPage extends AbstractAdminPageStyleGuide
{
public static $URL = '/setting/system/login_history';

public static $検索条件 = ['id' => 'admin_search_login_history_multi'];
public static $検索ボタン = '#search_form .c-outsideBlock__contents button';
public static $詳細検索ボタン = '//*[@id="search_form"]/div[1]/div[1]/div/div/div[2]/a/span';
public static $検索結果_メッセージ = '//*[@id="search_form"]/div[2]/span';

public function __construct(\AcceptanceTester $I)
{
parent::__construct($I);
}

public static function go(\AcceptanceTester $I)
{
$page = new self($I);

return $page->goPage(self::$URL, 'ログイン履歴システム設定');
}

/**
* 指定したログインID/IPアドレスで検索する。
*
* @param string $multi ログインID/IPアドレス
*
* @return $this
*/
public function 検索($multi = '')
{
$this->tester->fillField(self::$検索条件, $multi);
$this->tester->click(self::$検索ボタン);
$this->tester->see('ログイン履歴システム設定', '.c-pageTitle');

return $this;
}

public function 詳細検索_ステータス($value)
{
$this->tester->click(self::$詳細検索ボタン);
$this->tester->wait(1);
$this->tester->checkOption(['id' => 'admin_search_login_history_Status_'.$value]);
$this->tester->click(self::$検索ボタン);
$this->tester->see('ログイン履歴システム設定', '.c-pageTitle');

return $this;
}
}
4 changes: 2 additions & 2 deletions codeception/acceptance/EA01TopCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ public function top_001(\AcceptanceTester $I)
// お知らせの記事をクリックすると設定されたURLに遷移することを確認
$I->switchToIFrame('information');
$selector = '.news_area .link_list .tableish a:nth-child(1)';
$url = $I->grabAttributeFrom($selector, 'href');
$url = $I->executeJS('return location.href');
$I->click(['css' => $selector]);
$I->switchToNewWindow();
$I->assertEquals($url, $I->executeJS('return location.href'), $url.' が一致しません');
$I->assertNotEquals($url, $I->executeJS('return location.href'), $url.' から遷移していません。');
$I->switchToWindow();

// ショップ情報の在庫切れ商品をクリックすると商品管理ページに遷移することを確認
Expand Down
67 changes: 65 additions & 2 deletions codeception/acceptance/EA08SysteminfoCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Codeception\Util\Fixtures;
use Page\Admin\AuthorityManagePage;
use Page\Admin\LoginHistoryPage;

/**
* @group admin
Expand Down Expand Up @@ -308,6 +309,24 @@ public function systeminfo_セキュリティ管理SSL(\AcceptanceTester $I)
$I->click('#page_admin_setting_system_security form div.c-contentsArea__cols > div.c-conversionArea > div > div > div:nth-child(2) > div > div > button');
}

/**
* GitHub Actions は IPv6で実行されており、アクセス拒否のテストはできない
*/
public function systeminfo_セキュリティ管理IP制限_拒否リスト(\AcceptanceTester $I)
{
$I->wantTo('EA0804-UC01-T05 セキュリティ管理 - IP制限(拒否リスト)');

// 表示
$config = Fixtures::get('config');
$I->amOnPage('/'.$config['eccube_admin_route'].'/setting/system/security');
$I->see('セキュリティ管理システム設定', '#page_admin_setting_system_security .c-pageTitle__titles');

$I->fillField(['id' => 'admin_security_admin_deny_hosts'], '1.1.1.1');
$I->click('#page_admin_setting_system_security form div.c-contentsArea__cols > div.c-conversionArea > div > div > div:nth-child(2) > div > div > button');

$I->see('保存しました', AuthorityManagePage::$完了メッセージ);
}

public function systeminfo_権限管理追加(\AcceptanceTester $I)
{
$I->wantTo('EA0805-UC01-T01 権限管理 - 追加');
Expand Down Expand Up @@ -377,12 +396,56 @@ public function systeminfo_マスターデータ管理(\AcceptanceTester $I)
$I->see('無回答', '#customer_form #admin_customer_sex');
}

public function systeminfo_ログイン履歴検索(\AcceptanceTester $I)
{
$I->wantTo('EA0808-UC01-T01 ログイン履歴 - 検索');

LoginHistoryPage::go($I)->検索('admin');

// 1項目目をチェック
$I->see('admin', '//*[@id="search_form"]/div[4]/div/div/div[2]/div/table/tbody/tr[1]/td[2]');
$I->see('成功', '//*[@id="search_form"]/div[4]/div/div/div[2]/div/table/tbody/tr[1]/td[5]/span');

LoginHistoryPage::go($I)->検索('admin-failure');

$I->see('検索結果:0件が該当しました', LoginHistoryPage::$検索結果_メッセージ);

$I->logoutAsAdmin();

// ログインに失敗する
$I->submitForm('#form1', [
'login_id' => 'admin-failure',
'password' => 'password',
]);

$I->loginAsAdmin();

LoginHistoryPage::go($I)->検索('admin-failure');

// 1項目目をチェック
$I->see('admin-failure', '//*[@id="search_form"]/div[4]/div/div/div[2]/div/table/tbody/tr[1]/td[2]');
$I->see('失敗', '//*[@id="search_form"]/div[4]/div/div/div[2]/div/table/tbody/tr[1]/td[5]/span');


// ステータスで詳細検索

LoginHistoryPage::go($I)->検索();

$I->see('失敗', '//*[@id="search_form"]/div[4]/div/div/div[2]/div/table/tbody');
$I->see('成功', '//*[@id="search_form"]/div[4]/div/div/div[2]/div/table/tbody');

LoginHistoryPage::go($I)->詳細検索_ステータス('0');

$I->see('失敗', '//*[@id="search_form"]/div[4]/div/div/div[2]/div/table/tbody');
$I->dontSee('成功', '//*[@id="search_form"]/div[4]/div/div/div[2]/div/table/tbody');
}

/**
* ATTENTION 後続のテストが失敗するため、最後に実行する必要がある
*/
public function systeminfo_セキュリティ管理IP制限(\AcceptanceTester $I)
public function systeminfo_セキュリティ管理IP制限_許可リスト(\AcceptanceTester $I)
{
$I->wantTo('EA0804-UC01-T03 セキュリティ管理 - IP制限');
$I->wantTo('EA0804-UC01-T03 セキュリティ管理 - IP制限(許可リスト)');

$findPlugins = Fixtures::get('findPlugins');
$Plugins = $findPlugins();
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '3'

services:
ec-cube:
volumes:
- ".:/var/www/html:cached"
27 changes: 27 additions & 0 deletions docker-compose.mysql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: '3'

volumes:
mysql-database:
driver: local

services:
ec-cube:
depends_on:
- mysql
environment:
DATABASE_URL: "mysql://dbuser:secret@mysql/eccubedb"
DATABASE_SERVER_VERSION: 10

mysql:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: eccubedb
MYSQL_USER: dbuser
MYSQL_PASSWORD: secret
volumes:
- mysql-database:/var/lib/mysql
ports:
- 13306:3306
networks:
- backend
File renamed without changes.
Loading

0 comments on commit 4ba47e1

Please sign in to comment.