-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #364 from nanasess/fix-template-currentfile
prefilterTransform の後方互換処理
- Loading branch information
Showing
7 changed files
with
136 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
76 changes: 76 additions & 0 deletions
76
ctests/acceptance/admin/ownersstore/AdminOwnersstorePluginInstallCept.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
|
||
$I = new AcceptanceTester($scenario); | ||
$I->wantTo('プラグインの prefilterTransform が正常に動作するかを確認する'); | ||
$I->amOnPage('/admin'); | ||
|
||
$I->fillField('input[name=login_id]', 'admin'); | ||
$I->fillField('input[name=password]', 'password'); | ||
$I->click(['css' => '.btn-tool-format']); | ||
|
||
$I->see('ログイン : 管理者 様'); | ||
|
||
$I->amGoingTo('オーナーズストア>プラグイン管理'); | ||
$I->amOnPage('/admin/ownersstore/'); | ||
|
||
$I->expect('プラグインを圧縮します'); | ||
|
||
$file = 'PrefilterTransformPlugin.tar.gz'; | ||
$dir = __DIR__.'/../../../../tests/class/fixtures/plugin/PrefilterTransformPlugin'; | ||
chdir($dir); | ||
$tar = new Archive_Tar($file, true); | ||
if ($tar->create(['PrefilterTransformPlugin.php', 'plugin_info.php'])) { | ||
rename($dir.'/'.$file, __DIR__.'/../../../_data/'.$file); | ||
$I->attachFile(['css' => '#system > table > tbody > tr > td > input'], $file); | ||
} | ||
$I->expect('プラグインをインストールします'); | ||
$I->click(['css' => '#system > table > tbody > tr > td > a']); // インストールボタン | ||
|
||
$I->wait(1); | ||
$I->seeInPopup('プラグインをインストールしても宜しいでしょうか?'); | ||
$I->acceptPopup(); | ||
|
||
$I->wait(1); | ||
$I->seeInPopup('プラグインをインストールしました'); | ||
$I->acceptPopup(); | ||
|
||
$I->amOnPage('/admin/ownersstore/'); | ||
|
||
$I->expect('プラグインを有効化します'); | ||
$I->click(['css' => '#system > table.system-plugin > tbody > tr:nth-child(2) > td.plugin_info > div > label > input[type=checkbox]']); // 有効化ボタン | ||
|
||
$I->wait(1); | ||
$I->seeInPopup('プラグインを有効にしても宜しいですか?'); | ||
$I->acceptPopup(); | ||
|
||
$I->wait(1); | ||
$I->seeInPopup('有効にしました。'); | ||
$I->acceptPopup(); | ||
|
||
$I->expect('prefilterTransform の動作を確認します'); | ||
$I->amOnPage('/products/list.php'); | ||
$I->seeInSource('<p>プラグイン仕様書の記述方法</p>'); | ||
$I->seeInSource('<p>一部のプラグインは完全一致が使用されている</p>'); | ||
|
||
$I->amOnPage('/admin/ownersstore/'); | ||
$I->expect('プラグインを無効化します'); | ||
$I->click(['css' => '#system > table.system-plugin > tbody > tr:nth-child(2) > td.plugin_info > div > label > input[type=checkbox]']); // 無効化ボタン | ||
|
||
$I->wait(1); | ||
$I->seeInPopup('プラグインを無効にしても宜しいですか?'); | ||
$I->acceptPopup(); | ||
|
||
$I->wait(1); | ||
$I->seeInPopup('無効にしました。'); | ||
$I->acceptPopup(); | ||
|
||
$I->expect('プラグインを削除します'); | ||
$I->click(['css' => '#system > table.system-plugin > tbody > tr:nth-child(2) > td.plugin_info > div > a:nth-child(6)']); // 削除ボタン | ||
|
||
$I->wait(1); | ||
$I->seeInPopup('プラグインを削除しても宜しいですか?'); | ||
$I->acceptPopup(); | ||
|
||
$I->wait(1); | ||
$I->seeInPopup('削除しました'); | ||
$I->acceptPopup(); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
tests/class/fixtures/plugin/PrefilterTransformPlugin/PrefilterTransformPlugin.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
class PrefilterTransformPlugin extends SC_Plugin_Base | ||
{ | ||
public function prefilterTransform(&$source, LC_Page_Ex $objPage, $filename) { | ||
$objTransform = new SC_Helper_Transform($source); | ||
switch($objPage->arrPageLayout['device_type_id']) { | ||
case DEVICE_TYPE_SMARTPHONE: | ||
case DEVICE_TYPE_PC: | ||
// 商品一覧画面 | ||
if (strpos($filename, 'products/list.tpl') !== false) { | ||
// see http://downloads.ec-cube.net/manual/12.0_plugin/plugin.pdf | ||
$objTransform->select('h2.title')->insertBefore('<p>プラグイン仕様書の記述方法</p>'); | ||
} | ||
if ('products/list.tpl' === $filename) { | ||
$objTransform->select('h2.title')->insertBefore('<p>一部のプラグインは完全一致が使用されている</p>'); | ||
} | ||
break; | ||
case DEVICE_TYPE_ADMIN: | ||
default: | ||
} | ||
$source = $objTransform->getHTML(); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/class/fixtures/plugin/PrefilterTransformPlugin/plugin_info.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
class plugin_info { | ||
static $PLUGIN_CODE = 'PrefilterTransformPlugin'; | ||
static $PLUGIN_NAME = 'PrefilterTransformPlugin'; | ||
static $CLASS_NAME = 'PrefilterTransformPlugin'; | ||
static $PLUGIN_VERSION = '0.0.0'; | ||
static $COMPLIANT_VERSION = '2.17'; | ||
static $AUTHOR = 'dummy'; | ||
static $DESCRIPTION = 'dummy'; | ||
static $HOOK_POINTS = [ | ||
['prefilterTransform', 'prefilterTransform'] | ||
]; | ||
} |