Skip to content

Commit

Permalink
Merge pull request #30 from nanasess/scrutinizer-patch-4
Browse files Browse the repository at this point in the history
Scrutinizer Auto-Fixes
  • Loading branch information
nanasess committed Jul 25, 2018
2 parents a298555 + 2d14a35 commit 08b4c13
Show file tree
Hide file tree
Showing 35 changed files with 109 additions and 67 deletions.
8 changes: 4 additions & 4 deletions codeception/PageAccessCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ public function tryToTest(AcceptanceTester $I)
{
$I->wantTo('perform actions and see result');
$I->amOnPage('/');
$I->see('くらしを楽しむライフスタイルグッズ','.copy');
$I->see('くらしを楽しむライフスタイルグッズ', '.copy');

$shopName = $I->grabFromDatabase('dtb_base_info','shop_name');
$I->assertEquals('EC-CUBE3 SHOP',$shopName);
$shopName = $I->grabFromDatabase('dtb_base_info', 'shop_name');
$I->assertEquals('EC-CUBE3 SHOP', $shopName);

$products = $I->grabFromDatabase('dtb_product','status',array('product_id'=>1));
$products = $I->grabFromDatabase('dtb_product', 'status', array('product_id'=>1));
codecept_debug($products);

$bi = Fixtures::get('baseinfo');
Expand Down
20 changes: 10 additions & 10 deletions codeception/_support/AcceptanceTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function getScenario()

public function loginAsAdmin($user = '', $password = '', $dir = '')
{
if(!$user || !$password) {
if (!$user || !$password) {
$account = Fixtures::get('admin_account');
$user = $account['member'];
$password = $account['password'];
Expand Down Expand Up @@ -97,7 +97,7 @@ public function logoutAsMember()

public function setStock($pid, $stock = 0)
{
if(!$pid) {
if (!$pid) {
return;
}
$entityManager = Fixtures::get('entityManager');
Expand Down Expand Up @@ -152,15 +152,15 @@ public function makeEmptyCart()
*/
public function getLastDownloadFile($fileNameRegex, $retryCount = 3)
{
$downloadDir = __DIR__ . '/_downloads/';
$downloadDir = __DIR__.'/_downloads/';
$files = scandir($downloadDir);
$files = array_map(function($fileName) use ($downloadDir) {
$files = array_map(function ($fileName) use ($downloadDir) {
return $downloadDir.$fileName;
}, $files);
$files = array_filter($files, function($f) use ($fileNameRegex){
$files = array_filter($files, function ($f) use ($fileNameRegex){
return is_file($f) && preg_match($fileNameRegex, basename($f));
});
usort($files, function($l, $r) {
usort($files, function ($l, $r) {
return filemtime($l) - filemtime($r);
});

Expand All @@ -180,8 +180,8 @@ public function getLastDownloadFile($fileNameRegex, $retryCount = 3)
public function switchToNewWindow()
{
$this->wait(1);
$this->executeInSelenium(function($webdriver) {
$handles=$webdriver->getWindowHandles();
$this->executeInSelenium(function ($webdriver) {
$handles = $webdriver->getWindowHandles();
$last_window = end($handles);
$webdriver->switchTo()->window($last_window);
});
Expand All @@ -194,7 +194,7 @@ public function switchToNewWindow()
public function dontSeeElements($arrayOfSelector)
{
$self = $this;
$result = array_filter($arrayOfSelector, function($element) use ($self) {
$result = array_filter($arrayOfSelector, function ($element) use ($self) {
$id = $element['id'];
return $self->executeJS("return document.getElementById('${id}') != null;");
});
Expand All @@ -203,7 +203,7 @@ public function dontSeeElements($arrayOfSelector)

public function dragAndDropBy($selector, $x_offset, $y_offset)
{
$this->executeInSelenium(function(\Facebook\WebDriver\Remote\RemoteWebDriver $webDriver) use ($selector, $x_offset, $y_offset) {
$this->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webDriver) use ($selector, $x_offset, $y_offset) {
$node = $webDriver->findElement(WebDriverBy::cssSelector($selector));
$action = new DragAndDropBy($webDriver, $node, $x_offset, $y_offset);
$action->perform();
Expand Down
6 changes: 3 additions & 3 deletions codeception/_support/FunctionalTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class FunctionalTester extends \Codeception\Actor
{
use _generated\FunctionalTesterActions;

/**
* Define custom actions here
*/
/**
* Define custom actions here
*/
}
2 changes: 1 addition & 1 deletion codeception/_support/Helper/Acceptance.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function _initialize()

private function clearDownloadDir()
{
$downloadDir = dirname(__DIR__) . '/_downloads/';
$downloadDir = dirname(__DIR__).'/_downloads/';
if (file_exists($downloadDir)) {
$files = scandir($downloadDir);
$files = array_filter($files, function ($fileName) use ($downloadDir) {
Expand Down
3 changes: 3 additions & 0 deletions codeception/_support/Interactions/DragAndDropBy.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

class DragAndDropBy extends WebDriverActions
{
/**
* @param \Facebook\WebDriver\Remote\RemoteWebElement $source
*/
public function __construct(WebDriver $driver, $source, $x_offset, $y_offset)
{
parent::__construct($driver);
Expand Down
3 changes: 3 additions & 0 deletions codeception/_support/Interactions/WaitAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class WaitAction implements WebDriverAction
*/
private $timeout_in_second;

/**
* @param integer $timeout_in_second
*/
function __construct($timeout_in_second)
{
$this->timeout_in_second = $timeout_in_second;
Expand Down
2 changes: 1 addition & 1 deletion codeception/_support/Page/Admin/CategoryManagePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function 一覧_名称($rowNum)
return "body > div > div.c-contentsArea > div.c-contentsArea__cols > div.c-contentsArea__primaryCol > div > div > div > div > ul > li:nth-child($rowNum) > div > div.col.d-flex.align-items-center > a";
}

public static function XPathでタグを取得する($textEl){
public static function XPathでタグを取得する($textEl) {
return '//*[@id="page_admin_product_category"]/div[1]/div[3]/div[3]/div[1]/div/div/div/div/ul/li/div/div[2]/a[contains(text(), "'.$textEl.'")]';
}
}
12 changes: 12 additions & 0 deletions codeception/_support/Page/Admin/CustomerManagePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,18 @@ public function 詳細検索_電話番号($value = '')
return $this;
}

/**
* @param integer $rowNum
*/
public function 一覧_編集($rowNum)
{
$this->tester->click("#search_form > div.c-contentsArea__cols > div > div > div.card.rounded.border-0.mb-4 > div > table > tbody > tr:nth-child(${rowNum}) > td:nth-child(2) > a");
return $this;
}

/**
* @param integer $rowNum
*/
public function 一覧_削除($rowNum, $execute = true)
{
$this->tester->click("#search_form > div.c-contentsArea__cols > div > div > div.card.rounded.border-0.mb-4 > div > table > tbody > tr:nth-child(${rowNum}) > td.align-middle.pr-3 > div > div > a");
Expand All @@ -67,6 +73,9 @@ public function 一覧_削除($rowNum, $execute = true)
return $this;
}

/**
* @param integer $rowNum
*/
public function 一覧_仮会員メール再送($rowNum)
{
$this->tester->click(['xpath' => "//*[@id='search_form']//div/table/tbody/tr[${rowNum}]/td[6]/div/div[1]/a"]);
Expand All @@ -92,6 +101,9 @@ public function CSV出力項目設定()
$this->tester->click('#search_form > div.c-contentsArea__cols > div > div > div.row.justify-content-between.mb-2 > div.col-5.text-right > div:nth-child(2) > div > button:nth-child(2)');
}

/**
* @param integer $rowNum
*/
public function 一覧_会員ID($rowNum)
{
return $this->tester->grabTextFrom("#search_form > div.c-contentsArea__cols > div > div > div.card.rounded.border-0.mb-4 > div > table > tbody > tr:nth-child(${rowNum}) > td.align-middle.pl-3");
Expand Down
2 changes: 1 addition & 1 deletion codeception/_support/Page/Admin/OrderManagePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function 一覧_注文番号($rowNum)

public function 受注ステータス検索($value = '')
{
$this->tester->checkOption(['id' => 'admin_search_order_status_' . $value]);
$this->tester->checkOption(['id' => 'admin_search_order_status_'.$value]);
$this->tester->click('#search_form #search_submit');
return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion codeception/_support/Page/Admin/OwnersPluginPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function goInstall($I)

public function インストール($fileName)
{
$this->tester->attachFile(['id' => 'plugin_local_install_plugin_archive'], $fileName);
$this->tester->attachFile(['id' => 'plugin_local_install_plugin_archive'], $fileName);
$this->tester->click('#aside_column button');
return $this;
}
Expand Down
6 changes: 3 additions & 3 deletions codeception/_support/Page/Admin/ProductManagePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function 詳細検索_ステータス($value)
{
$this->tester->click(self::$詳細検索ボタン);
$this->tester->wait(1);
$this->tester->checkOption(['id' => 'admin_search_product_status_' . $value]);
$this->tester->checkOption(['id' => 'admin_search_product_status_'.$value]);
$this->tester->click(self::$検索ボタン);
$this->tester->see('商品一覧商品管理', '.c-pageTitle');
return $this;
Expand Down Expand Up @@ -150,8 +150,8 @@ public function 規格編集画面に遷移()
*/
public function 検索結果_削除($rowNum)
{
$this->tester->click("#page_admin_product > div.c-container > div.c-contentsArea > div.c-contentsArea__cols > div > div > form > div.card.rounded.border-0.mb-4 > div.card-body.p-0 > table > tbody > tr:nth-child(${rowNum}) > td.align-middle.pr-3 > div > div:nth-child(3) > a");
return $this;
$this->tester->click("#page_admin_product > div.c-container > div.c-contentsArea > div.c-contentsArea__cols > div > div > form > div.card.rounded.border-0.mb-4 > div.card-body.p-0 > table > tbody > tr:nth-child(${rowNum}) > td.align-middle.pr-3 > div > div:nth-child(3) > a");
return $this;
}

public function Accept_重複する($rowNum)
Expand Down
3 changes: 3 additions & 0 deletions codeception/_support/Page/Admin/ShippingCsvUploadPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public function __construct(\AcceptanceTester $I)
parent::__construct($I);
}

/**
* @param \AcceptanceTester $I
*/
public static function go($I)
{
$page = new ProductCsvUploadPage($I);
Expand Down
29 changes: 28 additions & 1 deletion codeception/_support/Page/Admin/ShippingEditPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public static function go($I)
return $page;
}

/**
* @param \AcceptanceTester $I
*/
public static function at($I)
{
$page = new self($I);
Expand All @@ -46,30 +49,45 @@ public function お届け先編集()
return $this;
}

/**
* @param string $value
*/
public function 入力_姓($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_name_name01'], $value);
return $this;
}

/**
* @param string $value
*/
public function 入力_名($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_name_name02'], $value);
return $this;
}

/**
* @param string $value
*/
public function 入力_セイ($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_kana_kana01'], $value);
return $this;
}

/**
* @param string $value
*/
public function 入力_メイ($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_kana_kana02'], $value);
return $this;
}

/**
* @param string $value
*/
public function 入力_郵便番号($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_postal_code'], $value);
Expand All @@ -83,18 +101,27 @@ public function 入力_都道府県($value, $num = 0)
return $this;
}

/**
* @param string $value
*/
public function 入力_市区町村名($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_address_addr01'], $value);
return $this;
}

/**
* @param string $value
*/
public function 入力_番地_ビル名($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_address_addr02'], $value);
return $this;
}

/**
* @param string $value
*/
public function 入力_電話番号($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_phone_number'], $value);
Expand Down Expand Up @@ -169,6 +196,6 @@ public function 出荷日を確認($num = 0)
{
$this->tester->scrollTo(['id' => 'shipmentOverview_'.$num], 0, 50);
$this->tester->see((new \DateTime())->format('Y/m/d'),
'#shipmentOverview_'.$num.' > div > div:nth-child(4) > div:nth-child(2) > div:nth-child(3) > div > span');
'#shipmentOverview_'.$num.' > div > div:nth-child(4) > div:nth-child(2) > div:nth-child(3) > div > span');
}
}
4 changes: 2 additions & 2 deletions codeception/_support/Page/Front/MultipleShippingPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ public function お届け先追加()

public function 入力_お届け先($productNo, $shippingNo, $text)
{
$id = 'form_shipping_multiple_' . $productNo . '_shipping_' . $shippingNo . '_customer_address';
$id = 'form_shipping_multiple_'.$productNo.'_shipping_'.$shippingNo.'_customer_address';
$this->tester->selectOption(['id' => $id], ['text' => $text]);
return $this;
}

public function 入力_数量($productNo, $shippingNo, $value)
{
$id = 'form_shipping_multiple_' . $productNo . '_shipping_' . $shippingNo . '_quantity';
$id = 'form_shipping_multiple_'.$productNo.'_shipping_'.$shippingNo.'_quantity';
$this->tester->fillField(['id' => $id], $value);
return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion codeception/_support/Page/Front/ProductDetailPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function サムネイル画像URL()
public function 規格選択($array)
{
foreach ($array as $index=>$option) {
$this->tester->selectOption(['id' => 'classcategory_id'.($index+1)], $option);
$this->tester->selectOption(['id' => 'classcategory_id'.($index + 1)], $option);
}
return $this;
}
Expand Down
3 changes: 3 additions & 0 deletions codeception/_support/Page/Front/ShoppingLoginPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
class ShoppingLoginPage extends AbstractFrontPage
{

/**
* @param \AcceptanceTester $I
*/
public static function at($I)
{
$page = new self($I);
Expand Down
6 changes: 3 additions & 3 deletions codeception/_support/UnitTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class UnitTester extends \Codeception\Actor
{
use _generated\UnitTesterActions;

/**
* Define custom actions here
*/
/**
* Define custom actions here
*/
}
1 change: 0 additions & 1 deletion codeception/acceptance/AA0PluginInstallerCest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

use Codeception\Util\Fixtures;
use Page\Admin\OwnersPluginPage;

/**
Expand Down
1 change: 0 additions & 1 deletion codeception/acceptance/EA01TopCest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

use Codeception\Util\Fixtures;
use Page\Admin\CustomerManagePage;
use Page\Admin\OrderManagePage;
use Page\Admin\TopPage;

Expand Down
2 changes: 0 additions & 2 deletions codeception/acceptance/EA02AuthenticationCest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

use Codeception\Util\Fixtures;

/**
* @group admin
* @group admin01
Expand Down
4 changes: 2 additions & 2 deletions codeception/acceptance/EA03ProductCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
use Codeception\Util\Fixtures;
use Page\Admin\CategoryCsvUploadPage;
use Page\Admin\CategoryManagePage;
use Page\Admin\CsvSettingsPage;
use Page\Admin\ClassCategoryManagePage;
use Page\Admin\ClassNameManagePage;
use Page\Admin\CsvSettingsPage;
use Page\Admin\ProductClassEditPage;
use Page\Admin\ProductCsvUploadPage;
use Page\Admin\ProductManagePage;
use Page\Admin\ProductEditPage;
use Page\Admin\ProductManagePage;

/**
* @group admin
Expand Down
Loading

0 comments on commit 08b4c13

Please sign in to comment.