nanasess /
ec-cube
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | use Codeception\Util\Fixtures; |
||
| 4 | use Page\Admin\BlockEditPage; |
||
| 5 | use Page\Admin\BlockManagePage; |
||
| 6 | use Page\Admin\FileManagePage; |
||
| 7 | use Page\Admin\LayoutEditPage; |
||
| 8 | use Page\Admin\LayoutManagePage; |
||
| 9 | use Page\Admin\NewsEditPage; |
||
| 10 | use Page\Admin\NewsManagePage; |
||
| 11 | use Page\Admin\PageEditPage; |
||
| 12 | use Page\Admin\PageManagePage; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @group admin |
||
| 16 | * @group admin02 |
||
| 17 | * @group contentsmanagement |
||
| 18 | * @group ea6 |
||
| 19 | */ |
||
| 20 | class EA06ContentsManagementCest |
||
| 21 | { |
||
| 22 | public function _before(\AcceptanceTester $I) |
||
| 23 | { |
||
| 24 | // すべてのテストケース実施前にログインしておく |
||
| 25 | // ログイン後は管理アプリのトップページに遷移している |
||
| 26 | $I->loginAsAdmin(); |
||
| 27 | } |
||
| 28 | |||
| 29 | public function _after(\AcceptanceTester $I) |
||
| 30 | { |
||
| 31 | } |
||
| 32 | |||
| 33 | public function contentsmanagement_新着情報管理(\AcceptanceTester $I) |
||
| 34 | { |
||
| 35 | $I->getScenario()->incomplete('未実装:新着情報管理は未実装'); |
||
| 36 | |||
| 37 | $I->wantTo('EA0601-UC01-T01(& UC02-T01/UC02-T02/UC03-T01) 新着情報管理(作成・編集・削除)'); |
||
| 38 | |||
| 39 | NewsManagePage::go($I)->新規登録(); |
||
| 40 | |||
| 41 | NewsEditPage::of($I) |
||
| 42 | ->入力_日付(date('Y-m-d')) |
||
| 43 | ->入力_タイトル('news_title1') |
||
| 44 | ->入力_本文('newsnewsnewsnewsnews') |
||
| 45 | ->登録(); |
||
| 46 | |||
| 47 | $NewsListPage = NewsManagePage::at($I); |
||
| 48 | $I->see('新着情報を保存しました。', NewsManagePage::$登録完了メッセージ); |
||
| 49 | |||
| 50 | $NewsListPage->一覧_編集(1); |
||
| 51 | |||
| 52 | NewsEditPage::of($I) |
||
| 53 | ->入力_タイトル('news_title2') |
||
| 54 | ->登録(); |
||
| 55 | |||
| 56 | $NewsListPage = NewsManagePage::at($I); |
||
| 57 | $I->see('新着情報を保存しました。', NewsManagePage::$登録完了メッセージ); |
||
| 58 | $I->assertEquals('news_title2', $NewsListPage->一覧_タイトル(1)); |
||
| 59 | |||
| 60 | $NewsListPage->一覧_下へ(1); |
||
| 61 | $I->assertEquals('news_title2', $NewsListPage->一覧_タイトル(2)); |
||
| 62 | |||
| 63 | $NewsListPage->一覧_上へ(1); |
||
| 64 | $I->assertEquals('news_title2', $NewsListPage->一覧_タイトル(1)); |
||
| 65 | |||
| 66 | $NewsListPage->一覧_削除(1); |
||
| 67 | $I->acceptPopup(); |
||
| 68 | |||
| 69 | $I->assertNotEquals('news_title2', $NewsListPage->一覧_タイトル(1)); |
||
| 70 | } |
||
| 71 | |||
| 72 | /** |
||
| 73 | * @env firefox |
||
| 74 | * @env chrome |
||
| 75 | */ |
||
| 76 | public function contentsmanagement_ファイル管理(\AcceptanceTester $I) |
||
| 77 | { |
||
| 78 | $I->wantTo('EA0602-UC01-T01(& UC01-T02/UC01-T03/UC01-T04/UC01-T05/UC01-T06/UC01-T07) ファイル管理'); |
||
| 79 | |||
| 80 | /** @var FileManagePage $FileManagePage */ |
||
| 81 | $FileManagePage = FileManagePage::go($I) |
||
| 82 | ->入力_ファイル('upload.txt') |
||
| 83 | ->アップロード(); |
||
| 84 | |||
| 85 | $I->see('upload.txt', $FileManagePage->ファイル名(2)); |
||
| 86 | |||
| 87 | $FileManagePage->一覧_ダウンロード(2); |
||
| 88 | $UploadedFile = $I->getLastDownloadFile('/^upload\.txt$/'); |
||
| 89 | $I->assertEquals('This is uploaded file.', file_get_contents($UploadedFile)); |
||
| 90 | |||
| 91 | $FileManagePage->一覧_表示(2); |
||
| 92 | $I->switchToNewWindow(); |
||
| 93 | $I->see('This is uploaded file.'); |
||
| 94 | |||
| 95 | FileManagePage::go($I) |
||
| 96 | ->一覧_削除(2) |
||
| 97 | ->一覧_削除_accept(2); |
||
| 98 | $I->dontSee('upload.txt', $FileManagePage->ファイル名(2)); |
||
| 99 | |||
| 100 | $FileManagePage = FileManagePage::go($I) |
||
| 101 | ->入力_フォルダ名('folder1') |
||
| 102 | ->フォルダ作成(); |
||
| 103 | |||
| 104 | $I->see('folder1', $FileManagePage->ファイル名(1)); |
||
| 105 | |||
| 106 | $FileManagePage->一覧_ファイル名_クリック(1); |
||
| 107 | $I->see('folder1', $FileManagePage->パンくず(2)); |
||
| 108 | |||
| 109 | $config = Fixtures::get('config'); |
||
| 110 | $I->amOnPage('/'.$config['eccube_admin_route'].'/content/file_manager'); |
||
| 111 | $I->see('ファイル管理コンテンツ管理', '.c-pageTitle'); |
||
| 112 | |||
| 113 | FileManagePage::go($I) |
||
| 114 | ->一覧_削除(1) |
||
| 115 | ->一覧_削除_accept(1); |
||
| 116 | } |
||
| 117 | |||
| 118 | public function contentsmanagement_ページ管理(\AcceptanceTester $I) |
||
| 119 | { |
||
| 120 | $I->wantTo('EA0603-UC01-T01(& UC01-T02/UC01-T03/UC01-T04/UC01-T05) ページ管理'); |
||
| 121 | $faker = Fixtures::get('faker'); |
||
| 122 | $page = 'page_'.$faker->word; |
||
| 123 | PageManagePage::go($I)->新規入力(); |
||
| 124 | |||
| 125 | /* 新規作成時の初期タグ */ |
||
| 126 | $I->assertEquals(PageEditPage::at($I)->出力_内容(), "{% extends 'default_frame.twig' %}\n\n{% block main %}\n\n{% endblock %}"); |
||
| 127 | |||
| 128 | /* 作成 */ |
||
| 129 | PageEditPage::at($I) |
||
| 130 | ->入力_名称($page) |
||
| 131 | ->入力_ファイル名($page) |
||
| 132 | ->入力_URL($page) |
||
| 133 | ->入力_内容($page) |
||
| 134 | ->入力_PC用レイアウト('下層ページ用レイアウト') |
||
| 135 | ->登録(); |
||
| 136 | $I->see('登録が完了しました。', PageEditPage::$登録完了メッセージ); |
||
| 137 | |||
| 138 | $I->amOnPage('/user_data/'.$page); |
||
| 139 | $I->see($page, 'body'); |
||
| 140 | |||
| 141 | /* 編集 */ |
||
| 142 | PageManagePage::go($I)->ページ編集($page); |
||
| 143 | PageEditPage::at($I) |
||
| 144 | ->入力_内容("{% extends 'default_frame.twig' %}") |
||
| 145 | ->登録(); |
||
| 146 | $I->see('登録が完了しました。', PageEditPage::$登録完了メッセージ); |
||
| 147 | |||
| 148 | $I->amOnPage('/user_data/'.$page); |
||
| 149 | $config = Fixtures::get('config'); |
||
| 150 | $I->seeElement('div.ec-layoutRole__footer'); |
||
| 151 | |||
| 152 | /* レイアウト編集 */ |
||
| 153 | LayoutManagePage::go($I)->レイアウト編集('下層ページ用レイアウト'); |
||
| 154 | LayoutEditPage::at($I) |
||
| 155 | ->ブロックを移動('新着情報', '#position_4') |
||
| 156 | ->登録(); |
||
| 157 | |||
| 158 | $I->see('登録が完了しました。', LayoutEditPage::$登録完了メッセージ); |
||
| 159 | $I->amOnPage('/user_data/'.$page); |
||
| 160 | $I->see('新着情報', '.ec-news'); |
||
| 161 | |||
| 162 | LayoutManagePage::go($I)->レイアウト編集('下層ページ用レイアウト'); |
||
| 163 | LayoutEditPage::at($I) |
||
| 164 | ->ブロックを移動('カゴの中', '#position_2') |
||
| 165 | ->登録(); |
||
| 166 | LayoutEditPage::at($I) |
||
| 167 | ->ブロックを移動('ログインナビ', '#position_2') |
||
| 168 | ->登録(); |
||
| 169 | LayoutEditPage::at($I) |
||
| 170 | ->ブロックを移動('商品検索', '#position_2') |
||
| 171 | ->コンテキストメニューで上に移動('商品検索') |
||
| 172 | ->登録(); |
||
| 173 | LayoutEditPage::at($I) |
||
| 174 | ->コンテキストメニューで下に移動('商品検索') |
||
| 175 | ->登録(); |
||
| 176 | LayoutEditPage::at($I) |
||
| 177 | ->コンテキストメニューでセクションに移動('商品検索') |
||
| 178 | ->登録(); |
||
| 179 | LayoutEditPage::at($I) |
||
| 180 | ->コンテキストメニューでコードプレビュー( |
||
| 181 | '商品検索', |
||
| 182 | ['xpath' => "//*[@id='block-source-code']//div[contains(text(), 'file that was distributed with this source code.')]"] |
||
| 183 | ); |
||
| 184 | |||
| 185 | $I->getScenario()->incomplete('未実装:プレビューは未実装'); |
||
| 186 | |||
| 187 | LayoutManagePage::go($I)->レイアウト編集('下層ページ用レイアウト'); |
||
| 188 | // LayoutEditPage::at($I) |
||
|
0 ignored issues
–
show
|
|||
| 189 | // ->ブロックを移動('新着情報', '#position_0') |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
67% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 190 | // ->プレビュー(); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
67% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 191 | |||
| 192 | $I->switchToNewWindow(); |
||
| 193 | |||
| 194 | /* 削除 */ |
||
| 195 | PageManagePage::go($I)->削除($page); |
||
| 196 | $I->see('削除が完了しました。', PageEditPage::$登録完了メッセージ); |
||
| 197 | } |
||
| 198 | |||
| 199 | public function contentsmanagement_検索未使用ブロック(\AcceptanceTester $I) |
||
| 200 | { |
||
| 201 | $I->wantTo('EA0603-UC01-T06 検索未使用ブロック'); |
||
| 202 | $layoutName = '下層ページ用レイアウト'; |
||
| 203 | /* レイアウト編集 */ |
||
| 204 | LayoutManagePage::go($I)->レイアウト編集($layoutName); |
||
| 205 | $items = $I->grabMultiple(LayoutEditPage::$未使用ブロックアイテム); |
||
| 206 | LayoutEditPage::at($I) |
||
| 207 | ->検索ブロック名('ギャラリー'); |
||
| 208 | |||
| 209 | $I->seeNumberOfElements(LayoutEditPage::$未使用ブロックアイテム, 1); |
||
| 210 | |||
| 211 | LayoutManagePage::go($I)->レイアウト編集($layoutName); |
||
| 212 | LayoutEditPage::at($I) |
||
| 213 | ->検索ブロック名(''); |
||
| 214 | |||
| 215 | $I->seeNumberOfElements(LayoutEditPage::$未使用ブロックアイテム, count($items)); |
||
| 216 | } |
||
| 217 | |||
| 218 | public function contentsmanagement_ブロック管理(\AcceptanceTester $I) |
||
| 219 | { |
||
| 220 | $I->wantTo('EA0603-UC01-T01(& UC01-T02/UC01-T03) ブロック管理'); |
||
| 221 | $faker = Fixtures::get('faker'); |
||
| 222 | $block = $faker->word.'_block'; |
||
| 223 | /* 作成 */ |
||
| 224 | BlockManagePage::go($I)->新規入力(); |
||
| 225 | BlockEditPage::at($I) |
||
| 226 | ->入力_ブロック名($block) |
||
| 227 | ->入力_ファイル名($block) |
||
| 228 | ->入力_データ("<div id=".$block.">block1</div>") |
||
| 229 | ->登録(); |
||
| 230 | $I->see('登録が完了しました。', BlockEditPage::$登録完了メッセージ); |
||
| 231 | |||
| 232 | // TOPページにブロックを配置 |
||
| 233 | LayoutManagePage::go($I)->レイアウト編集('トップページ用レイアウト'); |
||
| 234 | LayoutEditPage::at($I) |
||
| 235 | ->ブロックを移動($block, '#position_3') |
||
| 236 | ->登録(); |
||
| 237 | |||
| 238 | $I->getScenario()->incomplete('未実装:ブロックの更新は未実装'); |
||
| 239 | $I->amOnPage('/'); |
||
| 240 | $I->see('block1', ['id' => $block]); |
||
| 241 | |||
| 242 | /* 編集 */ |
||
| 243 | BlockManagePage::go($I)->編集(1); |
||
| 244 | BlockEditPage::at($I) |
||
| 245 | ->入力_データ("<div id=".$block.">welcome</div>") |
||
| 246 | ->登録(); |
||
| 247 | $I->see('登録が完了しました。', BlockEditPage::$登録完了メッセージ); |
||
| 248 | |||
| 249 | $I->amOnPage('/'); |
||
| 250 | $I->see('welcome', ['id' => $block]); |
||
| 251 | |||
| 252 | /* 削除 */ |
||
| 253 | BlockManagePage::go($I)->削除(1); |
||
| 254 | $I->acceptPopup(); |
||
| 255 | |||
| 256 | $I->amOnPage('/'); |
||
| 257 | $I->dontSeeElement(['id' => $block]); |
||
| 258 | } |
||
| 259 | } |
||
| 260 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.