Skip to content

Commit

Permalink
E2Eテスト追加
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasess committed Apr 3, 2024
1 parent fc22eac commit 4f7b522
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/plugin-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
- test_install_remove_store
- test_bundle_install_enable_disable_remove_store
- test_bundle_install_update_enable_disable_remove_store
- test_master_entity_extension
include:
- db: pgsql
database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?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 Plugin\MasterEntityExtension\Entity;

use Doctrine\ORM\Mapping as ORM;
use Eccube\Annotation\EntityExtension;

/**
* @EntityExtension("Eccube\Entity\Master\DeviceType")
*/
trait DeviceTypeTrait
{
/**
* @ORM\Column(type="string", nullable=true)
*/
public $notes;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "ec-cube/masterentityextension",
"version": "1.0.0",
"description": "エンティティ拡張機能(Master)のサンプル",
"type": "eccube-plugin",
"extra": {
"code": "MasterEntityExtension"
}
}
31 changes: 31 additions & 0 deletions codeception/acceptance/EA10PluginCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Eccube\Entity\Plugin;
use Eccube\Repository\PluginRepository;
use Page\Admin\CacheManagePage;
use Page\Admin\MasterDataManagePage;
use Page\Admin\PluginLocalInstallPage;
use Page\Admin\PluginManagePage;
use Page\Admin\PluginSearchPage;
Expand Down Expand Up @@ -490,6 +491,22 @@ public function test_bundle_install_update_enable_disable_remove_store(Acceptanc
->無効化()
->削除();
}

public function test_master_entity_extension(AcceptanceTester $I)
{
$MasterEntityExtension = MasterEntityExtension_Local::start($I);

$MasterEntityExtension->インストール()
->有効化()
->検証();
$I->expect('Entity拡張したマスタデータが選択できることを確認します。');
MasterDataManagePage::go($I)->選択('mtb_device_type');
$I->see('保存しました', '.c-contentsArea .alert-success');

$MasterEntityExtension
->無効化()
->削除();
}
}

abstract class Abstract_Plugin
Expand Down Expand Up @@ -1074,3 +1091,17 @@ public static function start(AcceptanceTester $I)
return new self($I);
}
}

class MasterEntityExtension_Local extends Local_Plugin
{
public function __construct(AcceptanceTester $I, Store_Plugin $dependency = null)
{
parent::__construct($I, 'MasterEntityExtension', $dependency);
$this->traits['\Plugin\MasterEntityExtension\Entity\DeviceTypeTrait'] = 'src/Eccube/Entity/Master/DeviceType';
}

public static function start(AcceptanceTester $I, Store_Plugin $dependency = null)
{
return new self($I, $dependency);
}
}

0 comments on commit 4f7b522

Please sign in to comment.