From 357a3ba61ed0f1f13e934c30cf42d44ebf7e2ad3 Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Tue, 17 Dec 2024 17:43:44 +0900 Subject: [PATCH 1/7] =?UTF-8?q?php-cs-fixer=20=E3=81=AE=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=A2=E3=83=83=E3=83=97=E3=81=AB?= =?UTF-8?q?=E4=BC=B4=E3=81=84=E3=83=AB=E3=83=BC=E3=83=AB=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .php-cs-fixer.dist.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index a329eff1c3..fad0872e3b 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -16,6 +16,8 @@ 'no_superfluous_phpdoc_tags' => false, // 副作用があるため 'increment_style' => false, // 強制しなくて良い 'yoda_style' => false, // 強制しなくて良い + 'blank_line_after_opening_tag' => false, // 強制しなくて良い + 'fully_qualified_strict_types' => false, // 強制しなくて良い // @Symfony:risky のうち、以下のルールを無効化 'psr_autoloading' => false, // PSR-4 に準拠していないため @@ -23,6 +25,7 @@ 'native_constant_invocation' => false, // namespace を使用していないため不要 'string_length_to_empty' => false, // 副作用があるため 'ternary_to_elvis_operator' => false, // 副作用があるため + 'get_class_to_class_keyword' => false, // 副作用があるため ]; $finder = \PhpCsFixer\Finder::create() @@ -31,6 +34,7 @@ ->in(__DIR__.'/data/module') ->in(__DIR__.'/data/smarty_extends') ->in(__DIR__.'/tests') + ->exclude('SOAP') ->name('*.php') ; $config = new \PhpCsFixer\Config(); From f19cc18b608b03a18b79eebdf5ea1a560475b45d Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Tue, 17 Dec 2024 18:02:08 +0900 Subject: [PATCH 2/7] Apply PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer --allow-risky=yes fix . --- data/class/SC_CartSession.php | 3 +- data/class/SC_CheckError.php | 4 +- data/class/SC_ClassAutoloader.php | 4 +- data/class/SC_Customer.php | 4 +- data/class/SC_CustomerList.php | 8 +- data/class/SC_Date.php | 4 +- data/class/SC_FormParam.php | 2 +- data/class/SC_Fpdf.php | 8 +- data/class/SC_Initial.php | 4 +- data/class/SC_Product.php | 1 + data/class/SC_Response.php | 5 +- data/class/SC_SelectSql.php | 2 +- data/class/SC_SendMail.php | 8 +- data/class/SC_SmartphoneUserAgent.php | 1 + data/class/api/SC_Api_Operation.php | 16 +- data/class/api/SC_Api_Utils.php | 3 +- data/class/api/operations/AddrFromZip.php | 8 +- .../class/api/operations/BrowseNodeLookup.php | 2 +- data/class/api/operations/ItemSearch.php | 2 +- data/class/db/SC_DB_DBFactory.php | 14 +- .../db/dbfactory/SC_DB_DBFactory_MYSQL.php | 2 +- data/class/graph/SC_Graph_Pie.php | 2 +- data/class/helper/SC_Helper_Bloc.php | 2 +- data/class/helper/SC_Helper_CSV.php | 818 +++++++++--------- data/class/helper/SC_Helper_DB.php | 2 + data/class/helper/SC_Helper_FileManager.php | 4 +- data/class/helper/SC_Helper_Mobile.php | 72 +- data/class/helper/SC_Helper_Purchase.php | 7 +- data/class/helper/SC_Helper_TaxRule.php | 2 +- data/class/helper/SC_Helper_Transform.php | 2 +- data/class/pages/LC_Page_Sitemap.php | 1 + .../admin/basis/LC_Page_Admin_Basis_Tax.php | 2 +- .../LC_Page_Admin_Contents_CsvSql.php | 2 +- ...LC_Page_Admin_Contents_RecommendSearch.php | 5 +- .../admin/order/LC_Page_Admin_Order_Edit.php | 21 +- .../admin/order/LC_Page_Admin_Order_Mail.php | 1 + .../LC_Page_Admin_Order_ProductSelect.php | 4 +- .../ownersstore/LC_Page_Admin_OwnersStore.php | 2 +- .../LC_Page_Admin_Products_ProductClass.php | 8 +- .../LC_Page_Admin_Products_UploadCSV.php | 2 +- ..._Page_Admin_Products_UploadCSVCategory.php | 6 +- .../system/LC_Page_Admin_System_AdminArea.php | 10 +- .../system/LC_Page_Admin_System_Editdb.php | 6 +- .../system/LC_Page_Admin_System_Parameter.php | 2 +- data/class/pages/api/LC_Page_Api.php | 2 +- data/class/pages/api/LC_Page_Api_Json.php | 2 +- data/class/pages/api/LC_Page_Api_Php.php | 2 +- data/class/pages/api/LC_Page_Api_Xml.php | 2 +- data/class/pages/forgot/LC_Page_Forgot.php | 2 +- .../mypage/LC_Page_Mypage_DeliveryAddr.php | 4 +- .../pages/mypage/LC_Page_Mypage_DownLoad.php | 4 +- .../products/LC_Page_Products_Detail.php | 1 + .../LC_Page_Shopping_LoadPaymentModule.php | 2 +- data/class/plugin/SC_Plugin_Util.php | 8 +- .../SC_SessionFactory_UseCookie.php | 2 +- .../SC_SessionFactory_UseRequest.php | 2 +- data/class/util/GC_Utils.php | 2 +- data/class/util/SC_Utils.php | 14 +- data/module/Calendar/Calendar.php | 10 +- data/module/Calendar/Decorator.php | 5 +- data/module/Calendar/Decorator/Textual.php | 2 + data/module/Calendar/Decorator/Weekday.php | 2 +- data/module/Calendar/Engine/UnixTS.php | 2 +- data/module/Calendar/Factory.php | 2 + data/module/Calendar/Table/Helper.php | 9 +- data/module/Calendar/Util/Textual.php | 9 + data/module/Calendar/Week.php | 6 +- data/module/HTTP/Request.php | 50 +- data/module/HTTP/Request/Listener.php | 1 + data/module/Net/SMTP.php | 14 +- data/module/Net/Socket.php | 6 +- data/module/Net/URL.php | 8 +- data/module/gdthumb.php | 10 +- .../SC_CheckError_createParamTest.php | 2 +- .../SC_Date/SC_Date_getZeroMonthTest.php | 2 +- tests/class/SC_Date/SC_Date_isHolidayTest.php | 6 +- tests/class/SC_FpdfTest.php | 1 + .../class/SC_Product/SC_Product_TestBase.php | 28 +- ..._Product_getDetailAndProductsClassTest.php | 2 +- .../SC_Product/SC_Product_getDetailTest.php | 2 +- .../SC_Product_getProductsClassTest.php | 2 +- tests/class/SC_Query_Test.php | 48 +- tests/class/SC_SendMailTest.php | 1 + tests/class/SC_SessionFactoryTest.php | 2 +- .../PrefilterTransformPlugin.php | 4 +- .../SC_Helper_Address_TestBase.php | 6 +- .../SC_Helper_Address_getAddressTest.php | 42 +- .../SC_Helper_Address_getListTest.php | 12 +- .../SC_Helper_DB/SC_Helper_DB_TestBase.php | 36 +- .../SC_Helper_DB_sfGetAddPointTest.php | 2 + .../SC_Helper_DB_sfGetBasisCountTest.php | 2 +- .../SC_Helper_Kiyaku_TestBase.php | 8 +- .../SC_Helper_Kiyaku_getKiyakuTest.php | 20 +- .../SC_Helper_Kiyaku_getListTest.php | 14 +- .../SC_Helper_News_TestBase.php | 56 +- .../SC_Helper_News_getListTest.php | 108 +-- .../SC_Helper_News_getNewsTest.php | 10 +- .../SC_Helper_News_saveNewsTest.php | 20 +- .../SC_Helper_Purchase_TestBase.php | 122 +-- .../SC_Helper_Purchase_cancelOrderTest.php | 126 +-- .../SC_Helper_Purchase_cleanupSessionTest.php | 12 +- .../SC_Helper_Purchase_completeOrderTest.php | 140 +-- ...C_Helper_Purchase_copyFromCustomerTest.php | 70 +- .../SC_Helper_Purchase_copyFromOrderTest.php | 82 +- ...SC_Helper_Purchase_extractShippingTest.php | 18 +- .../SC_Helper_Purchase_getOrderDetailTest.php | 16 +- .../SC_Helper_Purchase_getOrderTempTest.php | 8 +- .../SC_Helper_Purchase_getOrderTest.php | 16 +- ...C_Helper_Purchase_getShipmentItemsTest.php | 64 +- ...SC_Helper_Purchase_getShippingTempTest.php | 18 +- .../SC_Helper_Purchase_getShippingsTest.php | 24 +- ...per_Purchase_registerOrderCompleteTest.php | 130 +-- ...elper_Purchase_registerOrderDetailTest.php | 56 +- .../SC_Helper_Purchase_registerOrderTest.php | 40 +- ...lper_Purchase_registerShipmentItemTest.php | 120 +-- ...C_Helper_Purchase_registerShippingTest.php | 96 +- .../SC_Helper_Purchase_rollbackOrderTest.php | 114 +-- .../SC_Helper_Purchase_saveOrderTempTest.php | 50 +- ...C_Helper_Purchase_saveShippingTempTest.php | 20 +- ...lper_Purchase_setDownloadableFlgToTest.php | 20 +- ...urchase_setShipmentItemTempForSoleTest.php | 20 +- ...elper_Purchase_sfUpdateOrderStatusTest.php | 173 ++-- ...C_Helper_Purchase_unsetOneShippingTest.php | 18 +- .../SC_Helper_TaxRule_getTaxDetailTest.php | 6 + .../SC_Helper_TaxRule_getTaxRuleTest.php | 4 + ...le_getTaxRule_OptionProductTaxRuleTest.php | 5 + .../LoadClassFileChangeCustomDirTest.php | 1 + .../class/plugin/LoadClassFileChangeTest.php | 1 + .../SC_Utils_arrayDefineIndexesTest.php | 12 +- .../SC_Utils_isAbsoluteRealPathTest.php | 4 +- .../SC_Utils/SC_Utils_isAppInnerUrlTest.php | 70 +- .../SC_Utils/SC_Utils_sfArrCombineTest.php | 18 +- .../SC_Utils/SC_Utils_sfArrKeyValueTest.php | 38 +- .../util/SC_Utils/SC_Utils_sfCopyDirtest.php | 40 +- .../SC_Utils/SC_Utils_sfEncodeFileTest.php | 8 +- .../SC_Utils/SC_Utils_sfGetAddressTest.php | 170 ++-- .../SC_Utils_sfGetClassCatCountTest.php | 120 +-- ...tils_sfGetHashString_authTypePlainTest.php | 18 +- .../SC_Utils_sfGetProductClassIdTest.php | 54 +- .../SC_Utils_sfGetUnderChildrenArrayTest.php | 12 +- .../util/SC_Utils/SC_Utils_sfIsIntTest.php | 32 +- ...fIsMatchHashPassword_authTypePlainTest.php | 42 +- .../SC_Utils_sfMakeHiddenArrayTest.php | 40 +- .../util/SC_Utils/SC_Utils_sfPrePointTest.php | 6 +- .../util/SC_Utils/SC_Utils_sfPrintRTest.php | 20 +- .../SC_Utils/SC_Utils_sfSwapArrayTest.php | 24 +- tests/require.php | 2 +- 147 files changed, 2041 insertions(+), 1988 deletions(-) diff --git a/data/class/SC_CartSession.php b/data/class/SC_CartSession.php index 645d997646..a81447b066 100644 --- a/data/class/SC_CartSession.php +++ b/data/class/SC_CartSession.php @@ -598,6 +598,7 @@ public function getQuantity($cart_no, $product_type_id) * @param int $quantity 設定する数量 * @param int $cart_no カート番号 * @param int $product_type_id 商品種別ID + * * @retrun void */ public function setQuantity($quantity, $cart_no, $product_type_id) @@ -768,7 +769,7 @@ public function calculate( $discount = 0, $deliv_id = 0, $order_pref = 0, - $order_country_id = 0 + $order_country_id = 0, ) { $results = []; $total_point = $this->getAllProductsPoint($product_type_id); diff --git a/data/class/SC_CheckError.php b/data/class/SC_CheckError.php index 184a7256ea..78e9036afb 100644 --- a/data/class/SC_CheckError.php +++ b/data/class/SC_CheckError.php @@ -1109,7 +1109,7 @@ public function IP_CHECK($value) // 改行コードが含まれている場合には配列に変換 $params = str_replace("\r", '', $this->arrParam[$keyname]); if (!empty($params)) { - if (strpos($params, "\n") === false) { + if (!str_contains($params, "\n")) { $params .= "\n"; } $params = explode("\n", $params); @@ -1224,7 +1224,7 @@ public function FILE_SIZE_CHECK($value) if ($_FILES[$keyname]['size'] > $max_file_size * 1024) { $byte = 'KB'; if ($max_file_size >= 1000) { - $max_file_size = $max_file_size / 1000; + $max_file_size /= 1000; $byte = 'MB'; } $this->arrErr[$keyname] = sprintf( diff --git a/data/class/SC_ClassAutoloader.php b/data/class/SC_ClassAutoloader.php index 73addec178..ec0c2007ea 100644 --- a/data/class/SC_ClassAutoloader.php +++ b/data/class/SC_ClassAutoloader.php @@ -47,7 +47,7 @@ public static function autoload($class, $plugin_upload_realdir = PLUGIN_UPLOAD_R } elseif (($arrClassNamePart[0] === 'SC' || $arrClassNamePart[0] === 'LC') && $is_ex === true && $count >= 4) { $arrClassNamePartTemp = $arrClassNamePart; // FIXME クラスファイルのディレクトリ命名が変。変な現状に合わせて強引な処理をしてる。 - $arrClassNamePartTemp[1] = $arrClassNamePartTemp[1].'_extends'; + $arrClassNamePartTemp[1] .= '_extends'; if ($count <= 5 && $arrClassNamePart[2] === 'Admin' && !in_array($arrClassNamePart[3], ['Home', 'Index', 'Logout'])) { $classpath .= strtolower(implode('/', array_slice($arrClassNamePartTemp, 1, -1))).'/'; } else { @@ -136,7 +136,7 @@ public static function autoload($class, $plugin_upload_realdir = PLUGIN_UPLOAD_R if ($is_ex) { // *_Ex ファイルが存在しない場合は、元クラスのエイリアスとする - if (!file_exists($classpath) && strpos($class, '_Ex') !== false) { + if (!file_exists($classpath) && str_contains($class, '_Ex')) { class_alias(preg_replace('/_Ex$/', '', $class), $class); } } diff --git a/data/class/SC_Customer.php b/data/class/SC_Customer.php index 1855dd6e46..02035b7930 100644 --- a/data/class/SC_Customer.php +++ b/data/class/SC_Customer.php @@ -386,8 +386,8 @@ public function doLogin($login_email, $login_pass) { switch (SC_Display_Ex::detectDevice()) { case DEVICE_TYPE_MOBILE: - if (!$this->getCustomerDataFromMobilePhoneIdPass($login_pass) && - !$this->getCustomerDataFromEmailPass($login_pass, $login_email, true) + if (!$this->getCustomerDataFromMobilePhoneIdPass($login_pass) + && !$this->getCustomerDataFromEmailPass($login_pass, $login_email, true) ) { return false; } else { diff --git a/data/class/SC_CustomerList.php b/data/class/SC_CustomerList.php index 21d536c9da..eca6bd8bdf 100644 --- a/data/class/SC_CustomerList.php +++ b/data/class/SC_CustomerList.php @@ -319,8 +319,8 @@ public function __construct($array, $mode = '') if (!isset($this->arrSql['search_end_day'])) { $this->arrSql['search_end_day'] = ''; } - if ((strlen($this->arrSql['search_start_year']) > 0 && strlen($this->arrSql['search_start_month']) > 0 && strlen($this->arrSql['search_start_day']) > 0) || - (strlen($this->arrSql['search_end_year']) > 0 && strlen($this->arrSql['search_end_month']) > 0 && strlen($this->arrSql['search_end_day']) > 0)) { + if ((strlen($this->arrSql['search_start_year']) > 0 && strlen($this->arrSql['search_start_month']) > 0 && strlen($this->arrSql['search_start_day']) > 0) + || (strlen($this->arrSql['search_end_year']) > 0 && strlen($this->arrSql['search_end_month']) > 0 && strlen($this->arrSql['search_end_day']) > 0)) { $arrRegistTime = $this->selectTermRange($this->arrSql['search_start_year'], $this->arrSql['search_start_month'], $this->arrSql['search_start_day'], $this->arrSql['search_end_year'], $this->arrSql['search_end_month'], $this->arrSql['search_end_day'], $regdate_col); foreach ($arrRegistTime as $data) { @@ -348,8 +348,8 @@ public function __construct($array, $mode = '') $this->arrSql['search_buy_end_day'] = ''; } - if ((strlen($this->arrSql['search_buy_start_year']) > 0 && strlen($this->arrSql['search_buy_start_month']) > 0 && strlen($this->arrSql['search_buy_start_day']) > 0) || - (strlen($this->arrSql['search_buy_end_year']) > 0 && strlen($this->arrSql['search_buy_end_month']) > 0 && strlen($this->arrSql['search_buy_end_day']) > 0)) { + if ((strlen($this->arrSql['search_buy_start_year']) > 0 && strlen($this->arrSql['search_buy_start_month']) > 0 && strlen($this->arrSql['search_buy_start_day']) > 0) + || (strlen($this->arrSql['search_buy_end_year']) > 0 && strlen($this->arrSql['search_buy_end_month']) > 0 && strlen($this->arrSql['search_buy_end_day']) > 0)) { $arrRegistTime = $this->selectTermRange($this->arrSql['search_buy_start_year'], $this->arrSql['search_buy_start_month'], $this->arrSql['search_buy_start_day'], $this->arrSql['search_buy_end_year'], $this->arrSql['search_buy_end_month'], $this->arrSql['search_buy_end_day'], 'last_buy_date'); foreach ($arrRegistTime as $data) { diff --git a/data/class/SC_Date.php b/data/class/SC_Date.php index 77a66f076e..68acaaf892 100644 --- a/data/class/SC_Date.php +++ b/data/class/SC_Date.php @@ -29,8 +29,8 @@ class SC_Date public $day; public $end_year; - public static $arrHoliday = null; - public static $arrRegularHoliday = null; + public static $arrHoliday; + public static $arrRegularHoliday; // コンストラクタ public function __construct($start_year = '', $end_year = '') diff --git a/data/class/SC_FormParam.php b/data/class/SC_FormParam.php index 8d197669cf..bbea1d2f21 100644 --- a/data/class/SC_FormParam.php +++ b/data/class/SC_FormParam.php @@ -285,7 +285,7 @@ public function checkError($br = true) * @return void */ public function recursionCheck($disp_name, $func, $value, &$arrErr, - $length = 0 + $length = 0, ) { // 配列の場合は、再帰実行 if (is_array($value)) { diff --git a/data/class/SC_Fpdf.php b/data/class/SC_Fpdf.php index f3094b468b..ca2b5bb3a7 100644 --- a/data/class/SC_Fpdf.php +++ b/data/class/SC_Fpdf.php @@ -192,11 +192,11 @@ private function setOrderData() $this->lfText(27, $y, $line, 8); $cut = strlen($line); $text = substr($text, $cut, strlen($text) - $cut); - $y = $y + 3; + $y += 3; } if ($text != '') { $this->lfText(27, $y, $text, 8); - $y = $y + 3; + $y += 3; } $text = $this->arrDisp['order_addr02']; // 購入者住所2 @@ -206,11 +206,11 @@ private function setOrderData() $this->lfText(27, $y, $line, 8); $cut = strlen($line); $text = substr($text, $cut, strlen($text) - $cut); - $y = $y + 3; + $y += 3; } if ($text != '') { $this->lfText(27, $y, $text, 8); - $y = $y + 3; + $y += 3; } $text = $this->arrDisp['order_name01'].' '.$this->arrDisp['order_name02'].' 様'; diff --git a/data/class/SC_Initial.php b/data/class/SC_Initial.php index bc50ded1fc..493ba81caa 100644 --- a/data/class/SC_Initial.php +++ b/data/class/SC_Initial.php @@ -195,8 +195,8 @@ public function defineDirectoryIndex() $useFilenameDirIndex = USE_FILENAME_DIR_INDEX; } else { if (isset($_SERVER['SERVER_SOFTWARE'])) { - if (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false - || strpos($_SERVER['SERVER_SOFTWARE'], 'Symfony') !== false) { + if (str_contains($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') + || str_contains($_SERVER['SERVER_SOFTWARE'], 'Symfony')) { $useFilenameDirIndex = true; } } diff --git a/data/class/SC_Product.php b/data/class/SC_Product.php index 1b48868562..d8a9a7e387 100644 --- a/data/class/SC_Product.php +++ b/data/class/SC_Product.php @@ -616,6 +616,7 @@ public static function setPriceTaxTo(&$arrProducts) $arrProduct['price02_min_tax_format'] = &$arrProduct['price02_min_inctax_format']; $arrProduct['price02_max_tax_format'] = &$arrProduct['price02_max_inctax_format']; } + // @deprecated 2.12.4 // 旧バージョン互換用 // 現在は参照渡しで戻せる diff --git a/data/class/SC_Response.php b/data/class/SC_Response.php index 331edd818b..47a49e88d3 100644 --- a/data/class/SC_Response.php +++ b/data/class/SC_Response.php @@ -133,6 +133,7 @@ public static function actionExit() * @param bool|null $useSsl true:HTTPSを強制, false:HTTPを強制, null:継承 * * @return void + * * @static */ public static function sendRedirect($location, $arrQueryString = [], $inheritQueryString = false, $useSsl = null) @@ -259,6 +260,7 @@ public static function sendRedirect($location, $arrQueryString = [], $inheritQue * @param string $location /html/ からのパス。先頭に / を含むかは任意。「../」の解釈は行なわない。 * * @return void + * * @static */ public static function sendRedirectFromUrlPath($location, $arrQueryString = [], $inheritQueryString = false, $useSsl = null) @@ -311,12 +313,13 @@ public function setStatusCode($statusCode = null) * @see http://ja.wikipedia.org/wiki/HTTP%E3%82%B9%E3%83%86%E3%83%BC%E3%82%BF%E3%82%B9%E3%82%B3%E3%83%BC%E3%83%89 (邦訳) * * @license http://www.gnu.org/licenses/fdl.html GFDL (邦訳) + * * @static */ public static function sendHttpStatus($statusCode) { $protocol = $_SERVER['SERVER_PROTOCOL']; - $httpVersion = (strpos($protocol, '1.1') !== false) ? '1.1' : '1.0'; + $httpVersion = (str_contains($protocol, '1.1')) ? '1.1' : '1.0'; $messages = [ // Informational 1xx // 【情報】 100 => 'Continue', // 継続 diff --git a/data/class/SC_SelectSql.php b/data/class/SC_SelectSql.php index 3e3f6986da..09a105892d 100644 --- a/data/class/SC_SelectSql.php +++ b/data/class/SC_SelectSql.php @@ -133,7 +133,7 @@ public function selectTermRange($from_year, $from_month, $from_day, $to_year, $t // @see http://svn.ec-cube.net/open_trac/ticket/328 // FIXME とりあえずintvalで対策... $date2 = mktime(0, 0, 0, (int) $to_month, (int) $to_day, (int) $to_year); - $date2 = $date2 + 86400; + $date2 += 86400; // SQL文のdate関数に与えるフォーマットは、yyyy/mm/ddで指定する。 $date2 = date('Y/m/d', $date2); diff --git a/data/class/SC_SendMail.php b/data/class/SC_SendMail.php index 64905df724..8bacdc1746 100644 --- a/data/class/SC_SendMail.php +++ b/data/class/SC_SendMail.php @@ -167,8 +167,8 @@ public function setHost($host) trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); $this->host = $host; $arrHost = [ - 'host' => $this->host, - 'port' => $this->port, + 'host' => $this->host, + 'port' => $this->port, ]; // PEAR::Mailを使ってメール送信オブジェクト作成 $this->objMail = &Mail::factory('smtp', $arrHost); @@ -184,8 +184,8 @@ public function setPort($port) trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); $this->port = $port; $arrHost = [ - 'host' => $this->host, - 'port' => $this->port, + 'host' => $this->host, + 'port' => $this->port, ]; // PEAR::Mailを使ってメール送信オブジェクト作成 $this->objMail = &Mail::factory('smtp', $arrHost); diff --git a/data/class/SC_SmartphoneUserAgent.php b/data/class/SC_SmartphoneUserAgent.php index 388a8da411..b413538aad 100644 --- a/data/class/SC_SmartphoneUserAgent.php +++ b/data/class/SC_SmartphoneUserAgent.php @@ -39,6 +39,7 @@ class SC_SmartphoneUserAgent public static function isSmartphone() { $detect = new MobileDetect(); + // SPでかつPC表示OFFの場合 // TabletはPC扱い return ($detect->isMobile() && !$detect->isTablet()) && !SC_SmartphoneUserAgent_Ex::getSmartphonePcFlag(); diff --git a/data/class/api/SC_Api_Operation.php b/data/class/api/SC_Api_Operation.php index ceef24d0e8..3fd75fda97 100644 --- a/data/class/api/SC_Api_Operation.php +++ b/data/class/api/SC_Api_Operation.php @@ -368,10 +368,10 @@ public static function doApiAction($arrPost) if (count($arrErr) == 0) { // 実行成功 $arrResponseValidSection = ['Request' => [ - 'IsValid' => 'True', - $operation_name.'Request' => $arrOperationRequestValid, - ], - ]; + 'IsValid' => 'True', + $operation_name.'Request' => $arrOperationRequestValid, + ], + ]; $response_outer = $operation_name.'Response'; SC_Api_Utils_Ex::printApiLog('Operation SUCCESS', $start_time, $response_outer); } else { @@ -381,10 +381,10 @@ public static function doApiAction($arrPost) $arrResponseErrorSection[] = ['Code' => $error_code, 'Message' => $error_msg]; } $arrResponseValidSection = ['Request' => [ - 'IsValid' => 'False', - 'Errors' => ['Error' => $arrResponseErrorSection], - ], - ]; + 'IsValid' => 'False', + 'Errors' => ['Error' => $arrResponseErrorSection], + ], + ]; if (is_object($objApiOperation)) { $response_outer = $operation_name.'Response'; } else { diff --git a/data/class/api/SC_Api_Utils.php b/data/class/api/SC_Api_Utils.php index 6d9a977353..0321516089 100644 --- a/data/class/api/SC_Api_Utils.php +++ b/data/class/api/SC_Api_Utils.php @@ -113,7 +113,8 @@ public static function getApiConfig($operation_name) * * @param string $msg 出力文字列 * @param text $operation_name - @ @rturn void + * + * @ @rturn void */ public static function printApiLog($msg, $start_time = '', $operation_name = '') { diff --git a/data/class/api/operations/AddrFromZip.php b/data/class/api/operations/AddrFromZip.php index 632ca07b0f..119b0b9e25 100644 --- a/data/class/api/operations/AddrFromZip.php +++ b/data/class/api/operations/AddrFromZip.php @@ -45,10 +45,10 @@ public function doAction($arrParam) $arrAddrList = SC_Utils_Ex::sfGetAddress($zipcode); if (!SC_Utils_Ex::isBlank($arrAddrList)) { $this->setResponse('Address', [ - 'State' => $arrAddrList[0]['state'], - 'City' => $arrAddrList[0]['city'], - 'Town' => $arrAddrList[0]['town'], - ] + 'State' => $arrAddrList[0]['state'], + 'City' => $arrAddrList[0]['city'], + 'Town' => $arrAddrList[0]['town'], + ] ); return true; diff --git a/data/class/api/operations/BrowseNodeLookup.php b/data/class/api/operations/BrowseNodeLookup.php index 8be9786d19..a61d5c5d8e 100644 --- a/data/class/api/operations/BrowseNodeLookup.php +++ b/data/class/api/operations/BrowseNodeLookup.php @@ -91,7 +91,7 @@ public function doAction($arrParam) 'Name' => $category['category_name'], 'PageURL' => HTTP_URL.'products/list.php?category_id='.$category['category_id'], 'has_children' => $category['has_children'], - ]; + ]; } } $this->setResponse('BrowseNode', $arrData); diff --git a/data/class/api/operations/ItemSearch.php b/data/class/api/operations/ItemSearch.php index ca66ca55b5..18ff166998 100644 --- a/data/class/api/operations/ItemSearch.php +++ b/data/class/api/operations/ItemSearch.php @@ -76,7 +76,7 @@ public function doAction($arrParam) 'product_id' => $val['product_id'], 'DetailPageURL' => HTTP_URL.'products/detail.php?product_id='.$val['product_id'], 'ItemAttributes' => $val, - ]; + ]; } $this->setResponse('Item', $arrData); diff --git a/data/class/db/SC_DB_DBFactory.php b/data/class/db/SC_DB_DBFactory.php index d272e21e54..a9f09977cb 100644 --- a/data/class/db/SC_DB_DBFactory.php +++ b/data/class/db/SC_DB_DBFactory.php @@ -68,13 +68,13 @@ public function getDSN($dsn = '') if (empty($dsn)) { if (defined('DEFAULT_DSN')) { $dsn = ['phptype' => DB_TYPE, - 'username' => DB_USER, - 'password' => DB_PASSWORD, - 'protocol' => 'tcp', - 'hostspec' => DB_SERVER, - 'port' => DB_PORT, - 'database' => DB_NAME, - ]; + 'username' => DB_USER, + 'password' => DB_PASSWORD, + 'protocol' => 'tcp', + 'hostspec' => DB_SERVER, + 'port' => DB_PORT, + 'database' => DB_NAME, + ]; } else { return ''; } diff --git a/data/class/db/dbfactory/SC_DB_DBFactory_MYSQL.php b/data/class/db/dbfactory/SC_DB_DBFactory_MYSQL.php index 14e65da6e2..054c10d5e4 100644 --- a/data/class/db/dbfactory/SC_DB_DBFactory_MYSQL.php +++ b/data/class/db/dbfactory/SC_DB_DBFactory_MYSQL.php @@ -313,7 +313,7 @@ public function sfChangeTrunc($sql) */ public function sfChangeArrayToString($sql) { - if (strpos(strtoupper($sql), 'ARRAY_TO_STRING') !== false) { + if (str_contains(strtoupper($sql), 'ARRAY_TO_STRING')) { preg_match_all('/ARRAY_TO_STRING.*?\(.*?ARRAY\(.*?SELECT (.+?) FROM (.+?) WHERE (.+?)\).*?\,.*?\'(.+?)\'.*?\)/is', $sql, $match, PREG_SET_ORDER); foreach ($match as $item) { diff --git a/data/class/graph/SC_Graph_Pie.php b/data/class/graph/SC_Graph_Pie.php index 2cee0691c3..5c7f9f70b4 100644 --- a/data/class/graph/SC_Graph_Pie.php +++ b/data/class/graph/SC_Graph_Pie.php @@ -189,7 +189,7 @@ public function drawGraph() list($ax, $ay) = $this->lfGetArcPos($x, $y, $w, $h, $end); // ラインのずれを補正する if ($end > 180) { - $ax = $ax + 1; + ++$ax; } imageline($this->image, $ax, $ay, $ax, $ay + $z, $this->flame_color); } diff --git a/data/class/helper/SC_Helper_Bloc.php b/data/class/helper/SC_Helper_Bloc.php index 7d4e32a5af..95be9ce759 100644 --- a/data/class/helper/SC_Helper_Bloc.php +++ b/data/class/helper/SC_Helper_Bloc.php @@ -30,7 +30,7 @@ */ class SC_Helper_Bloc { - private $device_type_id = null; + private $device_type_id; public function __construct($devide_type_id = DEVICE_TYPE_PC) { diff --git a/data/class/helper/SC_Helper_CSV.php b/data/class/helper/SC_Helper_CSV.php index a1a8f1cc25..3948ab2ebd 100644 --- a/data/class/helper/SC_Helper_CSV.php +++ b/data/class/helper/SC_Helper_CSV.php @@ -1,411 +1,411 @@ init(); - } - - /** - * 項目情報を初期化する. - * - * @return void - */ - public function init() - { - $this->arrSubnavi = [ - 1 => 'product', - 2 => 'customer', - 3 => 'order', - 4 => 'review', - 5 => 'category', - ]; - - $this->arrSubnaviName = [ - 1 => '商品管理', - 2 => '会員管理', - 3 => '受注管理', - 4 => 'レビュー', - 5 => 'カテゴリ', - ]; - } - - /** - * CSVファイルを送信する - * - * @param int $csv_id CSVフォーマットID - * @param string $where WHERE条件文 - * @param array $arrVal プリペアドステートメントの実行時に使用される配列。配列の要素数は、クエリ内のプレースホルダの数と同じでなければなりません。 - * @param string $order ORDER文 - * @param bool $is_download true:ダウンロード用出力までさせる false:CSVの内容を返す(旧方式、メモリを食います。) - * - * @return bool|string $is_download = true時 成功失敗フラグ(boolean) 、$is_downalod = false時 string - */ - public function sfDownloadCsv($csv_id, $where = '', $arrVal = [], $order = '', $is_download = false) - { - $objQuery = SC_Query_Ex::getSingletonInstance(); - - // CSV出力タイトル行の作成 - $arrOutput = SC_Utils_Ex::sfSwapArray($this->sfGetCsvOutput($csv_id, 'status = '.CSV_COLUMN_STATUS_FLG_ENABLE)); - if (count($arrOutput) <= 0) { - return false; - } // 失敗終了 - $arrOutputCols = $arrOutput['col']; - - $cols = SC_Utils_Ex::sfGetCommaList($arrOutputCols, true); - - // 商品の場合 - $from = ''; - if ($csv_id == 1) { - // この WHERE 句を足さないと無効な規格も出力される。現行仕様と合わせる為追加。 - $inner_where = 'dtb_products_class.del_flg = 0'; - $from = SC_Product_Ex::prdclsSQL($inner_where); - // 会員の場合 - } elseif ($csv_id == 2) { - $from = 'dtb_customer'; - // 注文の場合 - } elseif ($csv_id == 3) { - $from = 'dtb_order'; - // レビューの場合 - } elseif ($csv_id == 4) { - $from = 'dtb_review AS A INNER JOIN dtb_products AS B on A.product_id = B.product_id'; - // カテゴリの場合 - } elseif ($csv_id == 5) { - $from = 'dtb_category'; - } - - $objQuery->setOrder($order); - $sql = $objQuery->getSql($cols, $from, $where); - - return $this->sfDownloadCsvFromSql($sql, $arrVal, $this->arrSubnavi[$csv_id], $arrOutput['disp_name'], $is_download); - } - - /** - * CSV 項目を出力する. - * - * @param int $csv_id CSV ID - * @param string $where SQL の WHERE 句 - * @param array $arrVal WHERE 句の要素 - * @param array $order SQL の ORDER BY 句 - * - * @return array CSV 項目の配列 - */ - public function sfGetCsvOutput($csv_id = '', $where = '', $arrVal = [], $order = 'rank, no') - { - $objQuery = SC_Query_Ex::getSingletonInstance(); - - $cols = 'no, csv_id, col, disp_name, rank, status, rw_flg, mb_convert_kana_option, size_const_type, error_check_types'; - $table = 'dtb_csv'; - - if (SC_Utils_Ex::sfIsInt($csv_id)) { - if ($where == '') { - $where = 'csv_id = ?'; - } else { - $where = "$where AND csv_id = ?"; - } - $arrVal[] = $csv_id; - } - $objQuery->setOrder($order); - - $arrRet = $objQuery->select($cols, $table, $where, $arrVal); - - return $arrRet; - } - - /** - * CSVが出力設定でインポート可能かのチェック - * - * @param array sfGetCsvOutputで取得した内容(またはそれと同等の配列) - * - * @return bool true:インポート可能、false:インポート不可 - */ - public function sfIsImportCSVFrame(&$arrCSVFrame) - { - $result = true; - foreach ($arrCSVFrame as $val) { - if ($val['status'] != CSV_COLUMN_STATUS_FLG_ENABLE - && $val['rw_flg'] == CSV_COLUMN_RW_FLG_READ_WRITE - && $val['error_check_types'] != '' - && strpos(strtoupper($val['error_check_types']), 'EXIST_CHECK') !== false - ) { - // 必須フィールド - $result = false; - } - } - - return $result; - } - - /** - * CSVが出力設定で更新可能かのチェック - * - * @param array sfGetCsvOutputで取得した内容(またはそれと同等の配列) - * - * @return bool true:更新可能、false:新規追加のみ不可 - */ - public function sfIsUpdateCSVFrame(&$arrCSVFrame) - { - $result = true; - foreach ($arrCSVFrame as $val) { - if ($val['status'] != CSV_COLUMN_STATUS_FLG_ENABLE - && $val['rw_flg'] == CSV_COLUMN_RW_FLG_KEY_FIELD - ) { - // キーフィールド - $result = false; - } - } - - return $result; - } - - /** - * CSVファイルのカウント数を得る. - * - * @param resource $fp fopenを使用して作成したファイルポインタ - * - * @return int CSV のカウント数 - */ - public function sfGetCSVRecordCount($fp) - { - $count = 0; - while (!feof($fp)) { - $arrCSV = fgetcsv($fp, CSV_LINE_MAX); - $count++; - } - // ファイルポインタを戻す - if (rewind($fp)) { - return $count - 1; - } else { - return false; - } - } - - /** - * CSV作成 テンポラリファイル出力 コールバック関数 - * - * @param mixed $data 出力データ - * - * @return bool true (true:固定 false:中断) - */ - public function cbOutputCSV($data) - { - // mb_convert_variablesで変換できない文字は"?"にする - mb_substitute_character(SUBSTITUTE_CHAR); - // 1行目のみヘッダーを出力する - if ($this->output_header) { - $header = array_keys($data); - mb_convert_variables('cp932', CHAR_CODE, $header); - fputcsv($this->fpOutput, $header); - $this->output_header = false; - } - mb_convert_variables('cp932', CHAR_CODE, $data); - fputcsv($this->fpOutput, $data); - SC_Utils_Ex::extendTimeOut(); - - return true; - } - - /** - * SQL文からクエリ実行し CSVファイルを送信する - * - * @param int $sql SQL文 - * @param array $arrVal プリペアドステートメントの実行時に使用される配列。配列の要素数は、クエリ内のプレースホルダの数と同じでなければなりません。 - * @param string ファイル名の頭に付ける文字列 - * @param array|null ヘッダ出力列配列。null の場合、SQL 文の列名を出力する。 - * @param bool true:ダウンロード用出力までさせる false:CSVの内容を返す(旧方式、メモリを食います。) - * - * @return bool|string $is_download = true時 成功失敗フラグ(boolean) 、$is_downalod = false時 string - */ - public function sfDownloadCsvFromSql($sql, $arrVal = [], $file_head = 'csv', $arrHeader = null, $is_download = false) - { - $objQuery = SC_Query_Ex::getSingletonInstance(); - - if (!$is_download) { - ob_start(); - } - - $this->fpOutput = &SC_Helper_CSV_Ex::fopen_for_output_csv(); - - // mb_convert_variablesで変換できない文字は"?"にする - mb_substitute_character(SUBSTITUTE_CHAR); - // ヘッダー構築 - $this->output_header = false; - if (is_array($arrHeader)) { - mb_convert_variables('cp932', CHAR_CODE, $arrHeader); - fputcsv($this->fpOutput, $arrHeader); - } elseif (is_null($arrHeader)) { - // ループバック内でヘッダーを出力する - $this->output_header = true; - } - - $objQuery->doCallbackAll([&$this, 'cbOutputCSV'], $sql, $arrVal); - - // コールバック内でヘッダー出力する場合、0行時にヘッダーを生成できない。 - // コールバックが呼ばれていない場合、念のため CRLF を出力しておく。 - // XXX WEB画面前提で、アラート表示する流れのほうが親切かもしれない。 - if ($this->output_header) { - fwrite($this->fpOutput, "\r\n"); - } - - fclose($this->fpOutput); - - // CSV 用の HTTP ヘッダーを送出する。 - if ($is_download) { - $file_name = $file_head.'_'.date('ymd_His').'.csv'; - SC_Response_Ex::headerForDownload($file_name); - $return = true; - } - // 戻り値にCSVデータをセットする - else { - $return = ob_get_clean(); - } - - return $return; - } - - /** - * 前方互換用 - * - * @deprecated 2.13.2 fputcsv を使うこと。(sfDownloadCsvFromSql や cbOutputCSV の実装を参照) - */ - public function sfArrayToCsv($fields, $delimiter = ',', $enclosure = '"', $arrayDelimiter = '|') - { - trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); - if (strlen($delimiter) != 1) { - trigger_error('delimiter must be a single character', E_USER_WARNING); - - return ''; - } - - if (strlen($enclosure) < 1) { - trigger_error('enclosure must be a single character', E_USER_WARNING); - - return ''; - } - - foreach ($fields as $key => $value) { - $field = &$fields[$key]; - - // 配列を「|」区切りの文字列に変換する - if (is_array($field)) { - $field = implode($arrayDelimiter, $field); - } - - /* enclose a field that contains a delimiter, an enclosure character, or a newline */ - if (is_string($field) - && preg_match('/['.preg_quote($delimiter).preg_quote($enclosure).'\\s]/', $field) - ) { - $field = $enclosure.preg_replace('/'.preg_quote($enclosure).'/', $enclosure.$enclosure, $field).$enclosure; - } - } - - return implode($delimiter, $fields); - } - - /** - * 前方互換用 - * - * @deprecated 2.13.2 - */ - public function lfDownloadCsv($arrData, $prefix = '') - { - trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); - if ($prefix == '') { - $dir_name = SC_Utils_Ex::sfUpDirName(); - $file_name = $dir_name.date('ymdHis').'.csv'; - } else { - $file_name = $prefix.date('ymdHis').'.csv'; - } - SC_Response_Ex::headerForDownload($file_name); - - /* データを出力 */ - $fp = &SC_Helper_CSV_Ex::fopen_for_output_csv(); - foreach ($arrData as $lineArray) { - fputcsv($fp, $lineArray); - } - fclose($fp); - } - - /** - * 前方互換用 - * - * @deprecated 2.13.2 - */ - public function lfDownloadCSVFile($filepath, $prefix = '') - { - trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); - $file_name = $prefix.date('YmdHis').'.csv'; - SC_Response_Ex::headerForDownload($file_name); - - /* データを出力 */ - // file_get_contentsはメモリマッピングも自動的に使ってくれるので高速&省メモリ - echo file_get_contents($filepath); - } - - /** - * CSV 出力用のファイルポインタリソースを開く - * - * @return resource ファイルポインタリソース - */ - public static function &fopen_for_output_csv($filename = 'php://output') - { - $fp = fopen($filename, 'w'); - - stream_filter_append($fp, 'convert.eccube_lf2crlf'); - - return $fp; - } - } - - /** - * 改行コードを CRLF に変換するフィルター - * - * @author Seasoft 塚田将久 (新規作成) - * - * @version $Id$ - */ - class php_user_filter_lf2crlf extends php_user_filter - { - #[\ReturnTypeWillChange] - public function filter($in, $out, &$consumed, $closing) - { - while ($bucket = stream_bucket_make_writeable($in)) { - $bucket->data = preg_replace("/[\r\n]+$/", "\r\n", $bucket->data); - $consumed += $bucket->datalen; - stream_bucket_append($out, $bucket); - } - - return PSFS_PASS_ON; - } - } - - stream_filter_register('convert.eccube_lf2crlf', 'php_user_filter_lf2crlf'); +/* + * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. + * + * http://www.ec-cube.co.jp/ + */ + +/** + * CSV 関連 のヘルパークラス. + * + * @author EC-CUBE CO.,LTD. + * + * @version $Id$ + */ +class SC_Helper_CSV +{ + /** 項目英名 */ + public $arrSubnavi; + + /** 項目名 */ + public $arrSubnaviName; + + /** @var resource */ + public $fpOutput; + + /** ヘッダーを出力するか (cbOutputCSV 用) */ + private $output_header = false; + + /** + * デフォルトコンストラクタ. + */ + public function __construct() + { + $this->init(); + } + + /** + * 項目情報を初期化する. + * + * @return void + */ + public function init() + { + $this->arrSubnavi = [ + 1 => 'product', + 2 => 'customer', + 3 => 'order', + 4 => 'review', + 5 => 'category', + ]; + + $this->arrSubnaviName = [ + 1 => '商品管理', + 2 => '会員管理', + 3 => '受注管理', + 4 => 'レビュー', + 5 => 'カテゴリ', + ]; + } + + /** + * CSVファイルを送信する + * + * @param int $csv_id CSVフォーマットID + * @param string $where WHERE条件文 + * @param array $arrVal プリペアドステートメントの実行時に使用される配列。配列の要素数は、クエリ内のプレースホルダの数と同じでなければなりません。 + * @param string $order ORDER文 + * @param bool $is_download true:ダウンロード用出力までさせる false:CSVの内容を返す(旧方式、メモリを食います。) + * + * @return bool|string $is_download = true時 成功失敗フラグ(boolean) 、$is_downalod = false時 string + */ + public function sfDownloadCsv($csv_id, $where = '', $arrVal = [], $order = '', $is_download = false) + { + $objQuery = SC_Query_Ex::getSingletonInstance(); + + // CSV出力タイトル行の作成 + $arrOutput = SC_Utils_Ex::sfSwapArray($this->sfGetCsvOutput($csv_id, 'status = '.CSV_COLUMN_STATUS_FLG_ENABLE)); + if (count($arrOutput) <= 0) { + return false; + } // 失敗終了 + $arrOutputCols = $arrOutput['col']; + + $cols = SC_Utils_Ex::sfGetCommaList($arrOutputCols, true); + + // 商品の場合 + $from = ''; + if ($csv_id == 1) { + // この WHERE 句を足さないと無効な規格も出力される。現行仕様と合わせる為追加。 + $inner_where = 'dtb_products_class.del_flg = 0'; + $from = SC_Product_Ex::prdclsSQL($inner_where); + // 会員の場合 + } elseif ($csv_id == 2) { + $from = 'dtb_customer'; + // 注文の場合 + } elseif ($csv_id == 3) { + $from = 'dtb_order'; + // レビューの場合 + } elseif ($csv_id == 4) { + $from = 'dtb_review AS A INNER JOIN dtb_products AS B on A.product_id = B.product_id'; + // カテゴリの場合 + } elseif ($csv_id == 5) { + $from = 'dtb_category'; + } + + $objQuery->setOrder($order); + $sql = $objQuery->getSql($cols, $from, $where); + + return $this->sfDownloadCsvFromSql($sql, $arrVal, $this->arrSubnavi[$csv_id], $arrOutput['disp_name'], $is_download); + } + + /** + * CSV 項目を出力する. + * + * @param int $csv_id CSV ID + * @param string $where SQL の WHERE 句 + * @param array $arrVal WHERE 句の要素 + * @param array $order SQL の ORDER BY 句 + * + * @return array CSV 項目の配列 + */ + public function sfGetCsvOutput($csv_id = '', $where = '', $arrVal = [], $order = 'rank, no') + { + $objQuery = SC_Query_Ex::getSingletonInstance(); + + $cols = 'no, csv_id, col, disp_name, rank, status, rw_flg, mb_convert_kana_option, size_const_type, error_check_types'; + $table = 'dtb_csv'; + + if (SC_Utils_Ex::sfIsInt($csv_id)) { + if ($where == '') { + $where = 'csv_id = ?'; + } else { + $where = "$where AND csv_id = ?"; + } + $arrVal[] = $csv_id; + } + $objQuery->setOrder($order); + + $arrRet = $objQuery->select($cols, $table, $where, $arrVal); + + return $arrRet; + } + + /** + * CSVが出力設定でインポート可能かのチェック + * + * @param array sfGetCsvOutputで取得した内容(またはそれと同等の配列) + * + * @return bool true:インポート可能、false:インポート不可 + */ + public function sfIsImportCSVFrame(&$arrCSVFrame) + { + $result = true; + foreach ($arrCSVFrame as $val) { + if ($val['status'] != CSV_COLUMN_STATUS_FLG_ENABLE + && $val['rw_flg'] == CSV_COLUMN_RW_FLG_READ_WRITE + && $val['error_check_types'] != '' + && str_contains(strtoupper($val['error_check_types']), 'EXIST_CHECK') + ) { + // 必須フィールド + $result = false; + } + } + + return $result; + } + + /** + * CSVが出力設定で更新可能かのチェック + * + * @param array sfGetCsvOutputで取得した内容(またはそれと同等の配列) + * + * @return bool true:更新可能、false:新規追加のみ不可 + */ + public function sfIsUpdateCSVFrame(&$arrCSVFrame) + { + $result = true; + foreach ($arrCSVFrame as $val) { + if ($val['status'] != CSV_COLUMN_STATUS_FLG_ENABLE + && $val['rw_flg'] == CSV_COLUMN_RW_FLG_KEY_FIELD + ) { + // キーフィールド + $result = false; + } + } + + return $result; + } + + /** + * CSVファイルのカウント数を得る. + * + * @param resource $fp fopenを使用して作成したファイルポインタ + * + * @return int CSV のカウント数 + */ + public function sfGetCSVRecordCount($fp) + { + $count = 0; + while (!feof($fp)) { + $arrCSV = fgetcsv($fp, CSV_LINE_MAX); + $count++; + } + // ファイルポインタを戻す + if (rewind($fp)) { + return $count - 1; + } else { + return false; + } + } + + /** + * CSV作成 テンポラリファイル出力 コールバック関数 + * + * @param mixed $data 出力データ + * + * @return bool true (true:固定 false:中断) + */ + public function cbOutputCSV($data) + { + // mb_convert_variablesで変換できない文字は"?"にする + mb_substitute_character(SUBSTITUTE_CHAR); + // 1行目のみヘッダーを出力する + if ($this->output_header) { + $header = array_keys($data); + mb_convert_variables('cp932', CHAR_CODE, $header); + fputcsv($this->fpOutput, $header); + $this->output_header = false; + } + mb_convert_variables('cp932', CHAR_CODE, $data); + fputcsv($this->fpOutput, $data); + SC_Utils_Ex::extendTimeOut(); + + return true; + } + + /** + * SQL文からクエリ実行し CSVファイルを送信する + * + * @param int $sql SQL文 + * @param array $arrVal プリペアドステートメントの実行時に使用される配列。配列の要素数は、クエリ内のプレースホルダの数と同じでなければなりません。 + * @param string ファイル名の頭に付ける文字列 + * @param array|null ヘッダ出力列配列。null の場合、SQL 文の列名を出力する。 + * @param bool true:ダウンロード用出力までさせる false:CSVの内容を返す(旧方式、メモリを食います。) + * + * @return bool|string $is_download = true時 成功失敗フラグ(boolean) 、$is_downalod = false時 string + */ + public function sfDownloadCsvFromSql($sql, $arrVal = [], $file_head = 'csv', $arrHeader = null, $is_download = false) + { + $objQuery = SC_Query_Ex::getSingletonInstance(); + + if (!$is_download) { + ob_start(); + } + + $this->fpOutput = &SC_Helper_CSV_Ex::fopen_for_output_csv(); + + // mb_convert_variablesで変換できない文字は"?"にする + mb_substitute_character(SUBSTITUTE_CHAR); + // ヘッダー構築 + $this->output_header = false; + if (is_array($arrHeader)) { + mb_convert_variables('cp932', CHAR_CODE, $arrHeader); + fputcsv($this->fpOutput, $arrHeader); + } elseif (is_null($arrHeader)) { + // ループバック内でヘッダーを出力する + $this->output_header = true; + } + + $objQuery->doCallbackAll([&$this, 'cbOutputCSV'], $sql, $arrVal); + + // コールバック内でヘッダー出力する場合、0行時にヘッダーを生成できない。 + // コールバックが呼ばれていない場合、念のため CRLF を出力しておく。 + // XXX WEB画面前提で、アラート表示する流れのほうが親切かもしれない。 + if ($this->output_header) { + fwrite($this->fpOutput, "\r\n"); + } + + fclose($this->fpOutput); + + // CSV 用の HTTP ヘッダーを送出する。 + if ($is_download) { + $file_name = $file_head.'_'.date('ymd_His').'.csv'; + SC_Response_Ex::headerForDownload($file_name); + $return = true; + } + // 戻り値にCSVデータをセットする + else { + $return = ob_get_clean(); + } + + return $return; + } + + /** + * 前方互換用 + * + * @deprecated 2.13.2 fputcsv を使うこと。(sfDownloadCsvFromSql や cbOutputCSV の実装を参照) + */ + public function sfArrayToCsv($fields, $delimiter = ',', $enclosure = '"', $arrayDelimiter = '|') + { + trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); + if (strlen($delimiter) != 1) { + trigger_error('delimiter must be a single character', E_USER_WARNING); + + return ''; + } + + if (strlen($enclosure) < 1) { + trigger_error('enclosure must be a single character', E_USER_WARNING); + + return ''; + } + + foreach ($fields as $key => $value) { + $field = &$fields[$key]; + + // 配列を「|」区切りの文字列に変換する + if (is_array($field)) { + $field = implode($arrayDelimiter, $field); + } + + /* enclose a field that contains a delimiter, an enclosure character, or a newline */ + if (is_string($field) + && preg_match('/['.preg_quote($delimiter).preg_quote($enclosure).'\\s]/', $field) + ) { + $field = $enclosure.preg_replace('/'.preg_quote($enclosure).'/', $enclosure.$enclosure, $field).$enclosure; + } + } + + return implode($delimiter, $fields); + } + + /** + * 前方互換用 + * + * @deprecated 2.13.2 + */ + public function lfDownloadCsv($arrData, $prefix = '') + { + trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); + if ($prefix == '') { + $dir_name = SC_Utils_Ex::sfUpDirName(); + $file_name = $dir_name.date('ymdHis').'.csv'; + } else { + $file_name = $prefix.date('ymdHis').'.csv'; + } + SC_Response_Ex::headerForDownload($file_name); + + /* データを出力 */ + $fp = &SC_Helper_CSV_Ex::fopen_for_output_csv(); + foreach ($arrData as $lineArray) { + fputcsv($fp, $lineArray); + } + fclose($fp); + } + + /** + * 前方互換用 + * + * @deprecated 2.13.2 + */ + public function lfDownloadCSVFile($filepath, $prefix = '') + { + trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); + $file_name = $prefix.date('YmdHis').'.csv'; + SC_Response_Ex::headerForDownload($file_name); + + /* データを出力 */ + // file_get_contentsはメモリマッピングも自動的に使ってくれるので高速&省メモリ + echo file_get_contents($filepath); + } + + /** + * CSV 出力用のファイルポインタリソースを開く + * + * @return resource ファイルポインタリソース + */ + public static function &fopen_for_output_csv($filename = 'php://output') + { + $fp = fopen($filename, 'w'); + + stream_filter_append($fp, 'convert.eccube_lf2crlf'); + + return $fp; + } +} + +/** + * 改行コードを CRLF に変換するフィルター + * + * @author Seasoft 塚田将久 (新規作成) + * + * @version $Id$ + */ +class php_user_filter_lf2crlf extends php_user_filter +{ + #[\ReturnTypeWillChange] + public function filter($in, $out, &$consumed, $closing) + { + while ($bucket = stream_bucket_make_writeable($in)) { + $bucket->data = preg_replace("/[\r\n]+$/", "\r\n", $bucket->data); + $consumed += $bucket->datalen; + stream_bucket_append($out, $bucket); + } + + return PSFS_PASS_ON; + } +} + +stream_filter_register('convert.eccube_lf2crlf', 'php_user_filter_lf2crlf'); diff --git a/data/class/helper/SC_Helper_DB.php b/data/class/helper/SC_Helper_DB.php index 469ade5d0f..21ef6390ba 100644 --- a/data/class/helper/SC_Helper_DB.php +++ b/data/class/helper/SC_Helper_DB.php @@ -256,6 +256,7 @@ public static function sfCreateBasisDataCache() // ファイル生成失敗 return false; } + // ファイル生成成功 return true; } @@ -412,6 +413,7 @@ public static function sfGetCatTree($parent_category_id, $count_check = false) * @param array カテゴリの配列 * @param int $parent 上位カテゴリID * @param array パンくずリスト用の配列 + * * @result void * * @see sfGetCatTree() diff --git a/data/class/helper/SC_Helper_FileManager.php b/data/class/helper/SC_Helper_FileManager.php index 876b168364..0dce690169 100644 --- a/data/class/helper/SC_Helper_FileManager.php +++ b/data/class/helper/SC_Helper_FileManager.php @@ -508,14 +508,14 @@ public static function convertToAbsolutePath($path) { $endsWithSlash = substr($path, -1) === '/'; // 絶対パスかどうか - if (strpos($path, '/') === 0 || preg_match('/^[a-z]:/i', $path)) { + if (str_starts_with($path, '/') || preg_match('/^[a-z]:/i', $path)) { $path = realpath($path); } else { $path = realpath(HTML_REALDIR.$path); } // USER_REALDIR 以下のパスかどうか - if ($path === false || strpos($path, realpath(USER_REALDIR)) === false) { + if ($path === false || !str_contains($path, realpath(USER_REALDIR))) { $path = realpath(USER_REALDIR); } diff --git a/data/class/helper/SC_Helper_Mobile.php b/data/class/helper/SC_Helper_Mobile.php index 11d1b5c83c..7a66326e8b 100644 --- a/data/class/helper/SC_Helper_Mobile.php +++ b/data/class/helper/SC_Helper_Mobile.php @@ -39,42 +39,42 @@ class SC_Helper_Mobile * Application/octet-streamで対応出来ないファイルタイプのみ拡張子をキーに記述する * 拡張子が本配列に存在しない場合は application/force-download を利用する */ public $arrMimetypes = [ - 'html' => 'text/html', - 'css' => 'text/css', - 'hdml' => 'text/x-hdml', - 'mmf' => 'application/x-smaf', - 'jpeg' => 'image/jpeg', - 'jpg' => 'image/jpeg', - 'gif' => 'image/gif', - 'png' => 'image/png', - 'bmp' => 'image/x-ms-bmp', - 'amc' => 'application/x-mpeg', - '3g2' => 'video/3gpp2', - '3gp' => 'video/3gpp', - 'jam' => 'application/x-jam', - 'kjx' => 'application/x-kjx', - 'jar' => 'application/java-archive', - 'jad' => 'text/vnd.sun.j2me.app-descriptor', - 'swf' => 'application/x-shockwave-flash', - 'dmt' => 'application/x-decomail-template', - 'khm' => 'application/x-kddi-htmlmail', - 'hmt' => 'application/x-htmlmail-template', - 'ucm' => 'application/x-ucf-package', - 'ucp' => 'application/x-ucf-package', - 'pdf' => 'application/pdf', - 'wma' => 'audio/x-ms-wma', - 'asf' => 'video/x-ms-asf', - 'wax' => 'audio/x-ms-wax', - 'wvx' => 'video/x-ms-wvx', - 'wmv' => 'video/x-ms-wmv', - 'asx' => 'video/asx', - 'txt' => 'text/plain', - 'exe' => 'application/octet-stream', - 'zip' => 'application/zip', - 'doc' => 'application/msword', - 'xls' => 'application/vnd.ms-excel', - 'ppt' => 'application/vnd.ms-powerpoint', - ]; + 'html' => 'text/html', + 'css' => 'text/css', + 'hdml' => 'text/x-hdml', + 'mmf' => 'application/x-smaf', + 'jpeg' => 'image/jpeg', + 'jpg' => 'image/jpeg', + 'gif' => 'image/gif', + 'png' => 'image/png', + 'bmp' => 'image/x-ms-bmp', + 'amc' => 'application/x-mpeg', + '3g2' => 'video/3gpp2', + '3gp' => 'video/3gpp', + 'jam' => 'application/x-jam', + 'kjx' => 'application/x-kjx', + 'jar' => 'application/java-archive', + 'jad' => 'text/vnd.sun.j2me.app-descriptor', + 'swf' => 'application/x-shockwave-flash', + 'dmt' => 'application/x-decomail-template', + 'khm' => 'application/x-kddi-htmlmail', + 'hmt' => 'application/x-htmlmail-template', + 'ucm' => 'application/x-ucf-package', + 'ucp' => 'application/x-ucf-package', + 'pdf' => 'application/pdf', + 'wma' => 'audio/x-ms-wma', + 'asf' => 'video/x-ms-asf', + 'wax' => 'audio/x-ms-wax', + 'wvx' => 'video/x-ms-wvx', + 'wmv' => 'video/x-ms-wmv', + 'asx' => 'video/asx', + 'txt' => 'text/plain', + 'exe' => 'application/octet-stream', + 'zip' => 'application/zip', + 'doc' => 'application/msword', + 'xls' => 'application/vnd.ms-excel', + 'ppt' => 'application/vnd.ms-powerpoint', + ]; /** * EC-CUBE がサポートする携帯端末かどうかをチェックする。 diff --git a/data/class/helper/SC_Helper_Purchase.php b/data/class/helper/SC_Helper_Purchase.php index 8f2d1be7c9..3c1fbbcc0b 100644 --- a/data/class/helper/SC_Helper_Purchase.php +++ b/data/class/helper/SC_Helper_Purchase.php @@ -526,7 +526,7 @@ public static function copyFromCustomer( 'sex', 'zip01', 'zip02', 'country_id', 'zipcode', 'pref', 'addr01', 'addr02', 'tel01', 'tel02', 'tel03', 'fax01', 'fax02', 'fax03', 'job', 'birth', 'email', - ] + ], ) { if ($objCustomer->isLoginSuccess(true)) { foreach ($keys as $key) { @@ -572,10 +572,10 @@ public function copyFromOrder(&$dest, $src, $prefix = 'shipping', $src_prefix = $arrKey = $this->arrShippingKey; } if (!SC_Utils_Ex::isBlank($prefix)) { - $prefix = $prefix.'_'; + $prefix .= '_'; } if (!SC_Utils_Ex::isBlank($src_prefix)) { - $src_prefix = $src_prefix.'_'; + $src_prefix .= '_'; } foreach ($arrKey as $key) { if (isset($src[$src_prefix.$key])) { @@ -1314,6 +1314,7 @@ public static function sfUpdateOrderStatus($orderId, $newStatus = null, $newAddP * * @param int $order_id 更新対象の注文番号 * @param bool $temp_table 更新対象は「受注_Temp」か + * * @static */ public static function sfUpdateOrderNameCol($order_id, $temp_table = false) diff --git a/data/class/helper/SC_Helper_TaxRule.php b/data/class/helper/SC_Helper_TaxRule.php index ea4a1f6a46..db3dba9d5c 100644 --- a/data/class/helper/SC_Helper_TaxRule.php +++ b/data/class/helper/SC_Helper_TaxRule.php @@ -118,7 +118,7 @@ public static function getTaxPerTaxRate($arrTaxableTotal, $discount_total = 0) $result[$rate] = [ 'discount' => (int) $discount[$rate], 'total' => (int) $reduced_total, - 'tax' => (int) (static::roundByCalcRule($tax, $defaultTaxRule)), + 'tax' => (int) static::roundByCalcRule($tax, $defaultTaxRule), ]; } diff --git a/data/class/helper/SC_Helper_Transform.php b/data/class/helper/SC_Helper_Transform.php index 0f2b855386..2521b7da44 100644 --- a/data/class/helper/SC_Helper_Transform.php +++ b/data/class/helper/SC_Helper_Transform.php @@ -347,7 +347,7 @@ public function getHTML() $err_msg .= '
'.$arrErr['err_msg']; } else { if ($arrErr['type'] == self::ERR_TARGET_ELEMENT_NOT_FOUND) { - $err_msg .= "
${arrErr['selector']} が存在しません"; + $err_msg .= "
{$arrErr['selector']} が存在しません"; } else { $err_msg .= '
'.print_r($arrErr, true); } diff --git a/data/class/pages/LC_Page_Sitemap.php b/data/class/pages/LC_Page_Sitemap.php index dd24558c69..54ba9a7ca6 100644 --- a/data/class/pages/LC_Page_Sitemap.php +++ b/data/class/pages/LC_Page_Sitemap.php @@ -308,6 +308,7 @@ public function date2W3CDatetime($date) $arr = []; // 正規表現で文字列を抽出 preg_match('/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})/', $date, $arr); + // :TODO: time zone も取得するべき... return sprintf('%04d-%02d-%02dT%02d:%02d:%02d+09:00', $arr[1], $arr[2], $arr[3], $arr[4], $arr[5], $arr[6]); diff --git a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tax.php b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tax.php index 6ca0dcf7c7..ea6a96a9ce 100644 --- a/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tax.php +++ b/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tax.php @@ -249,7 +249,7 @@ public function doParamRegist($arrParam) $arrData['OPTION_PRODUCT_TAX_RULE'] = $val; break; default: - } + } } $masterData = new SC_DB_MasterData_Ex(); // DBのデータを更新 diff --git a/data/class/pages/admin/contents/LC_Page_Admin_Contents_CsvSql.php b/data/class/pages/admin/contents/LC_Page_Admin_Contents_CsvSql.php index d46e75d5af..80a1c598b0 100644 --- a/data/class/pages/admin/contents/LC_Page_Admin_Contents_CsvSql.php +++ b/data/class/pages/admin/contents/LC_Page_Admin_Contents_CsvSql.php @@ -461,7 +461,7 @@ public function lfGetSqlDenyList() 'NOTIFY\s', 'PREPARE\s', 'REASSIGN\s', -// 'REINDEX\s', // REINDEXは許可で良いかなと + // 'REINDEX\s', // REINDEXは許可で良いかなと 'RELEASE\sSAVEPOINT', 'RENAME\s', 'REST\s', diff --git a/data/class/pages/admin/contents/LC_Page_Admin_Contents_RecommendSearch.php b/data/class/pages/admin/contents/LC_Page_Admin_Contents_RecommendSearch.php index bd76fac38a..8ea0910344 100644 --- a/data/class/pages/admin/contents/LC_Page_Admin_Contents_RecommendSearch.php +++ b/data/class/pages/admin/contents/LC_Page_Admin_Contents_RecommendSearch.php @@ -140,10 +140,10 @@ public function lfCheckError(&$objFormParam) /** * POSTされた値からSQLのWHEREとBINDを配列で返す。 * - * @return array ('where' => where string, 'bind' => databind array) - * * @param SC_FormParam $objFormParam * @param SC_Helper_DB_Ex $objDb + * + * @return array ('where' => where string, 'bind' => databind array) */ public function createWhere(&$objFormParam, &$objDb) { @@ -219,6 +219,7 @@ public function getProducts($whereAndBind, &$objProduct, $page_max, $startno) $objQuery->setWhere($where); // 取得範囲の指定(開始行番号、行数のセット) $objQuery->setLimitOffset($page_max, $startno); + // 検索結果の取得 return $objProduct->findProductIdsOrder($objQuery, $bind); } diff --git a/data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php b/data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php index 326f542baf..fd4da9ac63 100644 --- a/data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php +++ b/data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php @@ -808,16 +808,16 @@ public function doRegister($order_id, &$objPurchase, &$objFormParam, &$message, $order_id = $objPurchase->registerOrder($order_id, $arrValues); $arrDetail = $objFormParam->getSwapArray([ - 'product_id', - 'product_class_id', - 'product_code', - 'product_name', - 'price', 'quantity', - 'point_rate', - 'classcategory_name1', - 'classcategory_name2', - 'tax_rate', - 'tax_rule', + 'product_id', + 'product_class_id', + 'product_code', + 'product_name', + 'price', 'quantity', + 'point_rate', + 'classcategory_name1', + 'classcategory_name2', + 'tax_rate', + 'tax_rule', ]); // 変更しようとしている商品情報とDBに登録してある商品情報を比較することで、更新すべき数量を計算 @@ -1286,6 +1286,7 @@ public function deleteShipment(&$objFormParam, $arrShipmentDeleteKeys, $delete_s } } } + // $objFormParam->setParam($arrUpdateParams); return $arrUpdateParams; } diff --git a/data/class/pages/admin/order/LC_Page_Admin_Order_Mail.php b/data/class/pages/admin/order/LC_Page_Admin_Order_Mail.php index 26da547d60..4b974e5837 100644 --- a/data/class/pages/admin/order/LC_Page_Admin_Order_Mail.php +++ b/data/class/pages/admin/order/LC_Page_Admin_Order_Mail.php @@ -190,6 +190,7 @@ public function doSend(&$objFormParam) $objFormParam->getValue('header'), $objFormParam->getValue('footer')); } + // TODO $SC_SendMail から送信がちゃんと出来たか確認できたら素敵。 return true; } diff --git a/data/class/pages/admin/order/LC_Page_Admin_Order_ProductSelect.php b/data/class/pages/admin/order/LC_Page_Admin_Order_ProductSelect.php index 30345a0d7a..10d90e1696 100644 --- a/data/class/pages/admin/order/LC_Page_Admin_Order_ProductSelect.php +++ b/data/class/pages/admin/order/LC_Page_Admin_Order_ProductSelect.php @@ -212,10 +212,10 @@ public function getLineCount($whereAndBind, &$objProduct) /** * POSTされた値からSQLのWHEREとBINDを配列で返す。 * - * @return array ('where' => where string, 'bind' => databind array) - * * @param SC_FormParam $objFormParam * @param SC_Helper_DB_Ex $objDb + * + * @return array ('where' => where string, 'bind' => databind array) */ public function createWhere(&$objFormParam, &$objDb) { diff --git a/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore.php b/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore.php index b86c9c85d3..c6cc2a9a93 100644 --- a/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore.php +++ b/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore.php @@ -1113,7 +1113,7 @@ public function checkConflictPlugin($plugin_id) /** * エラー情報が格納されているか判定します. * - * @return boolean. + * @return bool. */ public function isError($error) { diff --git a/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php b/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php index 676595e6b0..e6d70c37b9 100644 --- a/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php +++ b/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php @@ -375,9 +375,9 @@ public function lfCheckProductsClass(&$objFormParam) if (SC_Utils_Ex::isBlank($arrValues['down_realfilename'][$i])) { $arrErr['down_realfilename'][$i] = '※ ダウンロード商品の場合はダウンロード商品用ファイルをアップロードしてください。
'; } - /* - * 通常商品チェック - */ + /* + * 通常商品チェック + */ } elseif ($arrValues['product_type_id'][$i] != PRODUCT_TYPE_DOWNLOAD) { if (!SC_Utils_Ex::isBlank($arrValues['down_filename'][$i])) { $arrErr['down_filename'][$i] = '※ ダウンロード商品ではない場合、ダウンロードファイル名を設定できません。
'; @@ -602,7 +602,7 @@ public function doFileUpload(&$objFormParam) $size = DOWN_SIZE; $byte = 'KB'; if ($size >= 1000) { - $size = $size / 1000; + $size /= 1000; $byte = 'MB'; } $this->arrErr['down_realfilename'][$index] = '※ ダウンロード販売用ファイル名のファイルサイズは'.$size.$byte.'以下のものを使用してください。
'; diff --git a/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php b/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php index 1a9cf7712b..20d424dd46 100644 --- a/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php +++ b/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php @@ -334,7 +334,7 @@ public function lfInitParam(&$objFormParam, &$arrCSVFrame) $col = $item['col']; } // HTML_TAG_CHECKは別途実行なので除去し、別保存しておく - if (strpos(strtoupper($item['error_check_types']), 'HTML_TAG_CHECK') !== false) { + if (str_contains(strtoupper($item['error_check_types']), 'HTML_TAG_CHECK')) { $this->arrTagCheckItem[] = $item; $error_check_types = str_replace('HTML_TAG_CHECK', '', $item['error_check_types']); } else { diff --git a/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php b/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php index 11ecb6cefb..49cd505a36 100644 --- a/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php +++ b/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php @@ -293,7 +293,7 @@ public function lfInitParam(SC_FormParam &$objFormParam, &$arrCSVFrame) $col = $item['col']; } // HTML_TAG_CHECKは別途実行なので除去し、別保存しておく - if (strpos(strtoupper($item['error_check_types']), 'HTML_TAG_CHECK') !== false) { + if (str_contains(strtoupper($item['error_check_types']), 'HTML_TAG_CHECK')) { $this->arrTagCheckItem[] = $item; $error_check_types = str_replace('HTML_TAG_CHECK', '', $item['error_check_types']); } else { @@ -501,8 +501,8 @@ public function lfCheckErrorDetail($item, $arrErr) $exists = $objQuery->exists('dtb_category', $where, [$parent_category_id, - $item['category_id'], - $item['category_name'], ]); + $item['category_id'], + $item['category_name'], ]); if ($exists) { $arrErr['category_name'] = '※ 既に同名のカテゴリが存在します。'; } diff --git a/data/class/pages/admin/system/LC_Page_Admin_System_AdminArea.php b/data/class/pages/admin/system/LC_Page_Admin_System_AdminArea.php index 81401d2ed5..2136fdf842 100644 --- a/data/class/pages/admin/system/LC_Page_Admin_System_AdminArea.php +++ b/data/class/pages/admin/system/LC_Page_Admin_System_AdminArea.php @@ -67,7 +67,7 @@ public function process() */ public function action() { - if (strpos(HTTPS_URL, 'https://') !== false) { + if (str_contains(HTTPS_URL, 'https://')) { $this->tpl_enable_ssl = true; } @@ -137,7 +137,7 @@ public function lfCheckAdminArea(&$arrForm, &$arrErr) $installData = file(CONFIG_REALFILE, FILE_IGNORE_NEW_LINES); foreach ($installData as $key => $line) { - if (strpos($line, 'ADMIN_DIR') !== false && ADMIN_DIR != $admin_dir) { + if (str_contains($line, 'ADMIN_DIR') && ADMIN_DIR != $admin_dir) { if ($admin_dir == 'admin/') { $arrErr['admin_dir'] .= '別のディレクトリ名を指定してください。'; } @@ -176,7 +176,7 @@ public function lfUpdateAdminData(&$arrForm) $installData = file(CONFIG_REALFILE, FILE_IGNORE_NEW_LINES); $diff = 0; foreach ($installData as $key => $line) { - if (strpos($line, 'ADMIN_DIR') !== false && ADMIN_DIR != $admin_dir) { + if (str_contains($line, 'ADMIN_DIR') && ADMIN_DIR != $admin_dir) { $installData[$key] = 'define("ADMIN_DIR", "'.$admin_dir.'");'; // 管理機能ディレクトリのリネーム if (!rename(HTML_REALDIR.ADMIN_DIR, HTML_REALDIR.$admin_dir)) { @@ -187,11 +187,11 @@ public function lfUpdateAdminData(&$arrForm) $diff++; } - if (strpos($line, 'ADMIN_FORCE_SSL') !== false) { + if (str_contains($line, 'ADMIN_FORCE_SSL')) { $installData[$key] = 'define("ADMIN_FORCE_SSL", '.$admin_force_ssl.');'; $diff++; } - if (strpos($line, 'ADMIN_ALLOW_HOSTS') !== false && ADMIN_ALLOW_HOSTS != $admin_allow_hosts) { + if (str_contains($line, 'ADMIN_ALLOW_HOSTS') && ADMIN_ALLOW_HOSTS != $admin_allow_hosts) { $installData[$key] = "define('ADMIN_ALLOW_HOSTS', '".$admin_allow_hosts."');"; $diff++; } diff --git a/data/class/pages/admin/system/LC_Page_Admin_System_Editdb.php b/data/class/pages/admin/system/LC_Page_Admin_System_Editdb.php index e94f1bc1d5..0ba97814c2 100644 --- a/data/class/pages/admin/system/LC_Page_Admin_System_Editdb.php +++ b/data/class/pages/admin/system/LC_Page_Admin_System_Editdb.php @@ -149,9 +149,9 @@ public function lfGetTargetData(&$objFormParam) for ($i = 1; $i <= count($arrIndexFlag); $i++) { // 入力値チェック $param = ['indexflag' => $arrIndexFlag[$i], - 'indexflag_new' => $arrIndexFlagNew[$i], - 'table_name' => $arrTableName[$i], - 'column_name' => $arrColumnName[$i], ]; + 'indexflag_new' => $arrIndexFlagNew[$i], + 'table_name' => $arrTableName[$i], + 'column_name' => $arrColumnName[$i], ]; $objErr = new SC_CheckError_Ex($param); $objErr->doFunc(['インデックス('.$i.')', 'indexflag', INT_LEN], ['NUM_CHECK']); $objErr->doFunc(['インデックス変更後('.$i.')', 'indexflag_new', INT_LEN], ['NUM_CHECK']); diff --git a/data/class/pages/admin/system/LC_Page_Admin_System_Parameter.php b/data/class/pages/admin/system/LC_Page_Admin_System_Parameter.php index 2a869cc12f..b0df7961b2 100644 --- a/data/class/pages/admin/system/LC_Page_Admin_System_Parameter.php +++ b/data/class/pages/admin/system/LC_Page_Admin_System_Parameter.php @@ -140,7 +140,7 @@ public function errorCheck(&$arrKeys, &$arrForm) $objErr = new SC_CheckError_Ex($arrForm); for ($i = 0; $i < count($arrKeys); $i++) { $objErr->doFunc([$arrKeys[$i], - $arrForm[$arrKeys[$i]], ], + $arrForm[$arrKeys[$i]], ], ['EXIST_CHECK_REVERSE', 'EVAL_CHECK']); } diff --git a/data/class/pages/api/LC_Page_Api.php b/data/class/pages/api/LC_Page_Api.php index 2c20367192..c7fdf4a58a 100644 --- a/data/class/pages/api/LC_Page_Api.php +++ b/data/class/pages/api/LC_Page_Api.php @@ -48,7 +48,7 @@ public function init() public function process() { $this->action(); -// $this->sendResponse(); + // $this->sendResponse(); } /** diff --git a/data/class/pages/api/LC_Page_Api_Json.php b/data/class/pages/api/LC_Page_Api_Json.php index 7479bdff83..ed285ec988 100644 --- a/data/class/pages/api/LC_Page_Api_Json.php +++ b/data/class/pages/api/LC_Page_Api_Json.php @@ -48,7 +48,7 @@ public function init() public function process() { $this->action(); -// $this->sendResponse(); + // $this->sendResponse(); } /** diff --git a/data/class/pages/api/LC_Page_Api_Php.php b/data/class/pages/api/LC_Page_Api_Php.php index 5fb0b3497f..b260a7bd57 100644 --- a/data/class/pages/api/LC_Page_Api_Php.php +++ b/data/class/pages/api/LC_Page_Api_Php.php @@ -48,7 +48,7 @@ public function init() public function process() { $this->action(); -// $this->sendResponse(); + // $this->sendResponse(); } /** diff --git a/data/class/pages/api/LC_Page_Api_Xml.php b/data/class/pages/api/LC_Page_Api_Xml.php index 320b5cab6c..0b991c0434 100644 --- a/data/class/pages/api/LC_Page_Api_Xml.php +++ b/data/class/pages/api/LC_Page_Api_Xml.php @@ -48,7 +48,7 @@ public function init() public function process() { $this->action(); -// $this->sendResponse(); + // $this->sendResponse(); } /** diff --git a/data/class/pages/forgot/LC_Page_Forgot.php b/data/class/pages/forgot/LC_Page_Forgot.php index 9817d4ae5d..5623638583 100644 --- a/data/class/pages/forgot/LC_Page_Forgot.php +++ b/data/class/pages/forgot/LC_Page_Forgot.php @@ -203,7 +203,7 @@ public function lfCheckForgotSecret(&$arrForm, &$arrReminder) .' AND name01 = ? AND name02 = ?' .' AND status = 2 AND del_flg = 0'; $arrVal = [$arrForm['email'], $arrForm['email'], - $arrForm['name01'], $arrForm['name02'], ]; + $arrForm['name01'], $arrForm['name02'], ]; $result = $objQuery->select($cols, $table, $where, $arrVal); if (isset($result[0]['reminder']) && isset($arrReminder[$result[0]['reminder']]) && $result[0]['reminder'] == $arrForm['reminder']) { diff --git a/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php b/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php index 96744c2401..657de4993d 100644 --- a/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php +++ b/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php @@ -50,8 +50,8 @@ public function init() $this->arrCountry = $masterData->getMasterData('mtb_country'); $this->httpCacheControl('nocache'); $this->validUrl = [MYPAGE_DELIVADDR_URLPATH, - DELIV_URLPATH, - MULTIPLE_URLPATH, ]; + DELIV_URLPATH, + MULTIPLE_URLPATH, ]; } /** diff --git a/data/class/pages/mypage/LC_Page_Mypage_DownLoad.php b/data/class/pages/mypage/LC_Page_Mypage_DownLoad.php index 5a3efff133..8eda75cd47 100644 --- a/data/class/pages/mypage/LC_Page_Mypage_DownLoad.php +++ b/data/class/pages/mypage/LC_Page_Mypage_DownLoad.php @@ -40,8 +40,8 @@ class LC_Page_Mypage_DownLoad extends LC_Page_Ex * Application/octet-streamで対応出来ないファイルタイプのみ拡張子をキーに記述する * 拡張子が本配列に存在しない場合は $defaultContentTypeを利用する */ public $arrContentType = ['apk' => 'application/vnd.android.package-archive', - 'pdf' => 'application/pdf', - ]; + 'pdf' => 'application/pdf', + ]; /** * Page を初期化する. diff --git a/data/class/pages/products/LC_Page_Products_Detail.php b/data/class/pages/products/LC_Page_Products_Detail.php index ea3afe3d46..b2c6c12977 100644 --- a/data/class/pages/products/LC_Page_Products_Detail.php +++ b/data/class/pages/products/LC_Page_Products_Detail.php @@ -443,6 +443,7 @@ public function lfInitParam(SC_FormParam &$objFormParam) $objFormParam->setParam($_REQUEST); // 入力値の変換 $objFormParam->convParam(); + // 入力情報を渡す return $objFormParam->getFormParamList(); } diff --git a/data/class/pages/shopping/LC_Page_Shopping_LoadPaymentModule.php b/data/class/pages/shopping/LC_Page_Shopping_LoadPaymentModule.php index 2ccda4f87a..73d0224994 100644 --- a/data/class/pages/shopping/LC_Page_Shopping_LoadPaymentModule.php +++ b/data/class/pages/shopping/LC_Page_Shopping_LoadPaymentModule.php @@ -99,7 +99,7 @@ public function getModulePath($order_id) $module_path = str_replace('\\', '/', $module_path); } $module_realdir = str_replace('\\', '/', realpath(MODULE_REALDIR).'/'); - if (strpos($module_path, $module_realdir) !== false) { + if (str_contains($module_path, $module_realdir)) { $module_path = str_replace($module_realdir, '', $module_path); } $module_path = $module_realdir.$module_path; diff --git a/data/class/plugin/SC_Plugin_Util.php b/data/class/plugin/SC_Plugin_Util.php index bb6ba47ba9..f44e221efb 100644 --- a/data/class/plugin/SC_Plugin_Util.php +++ b/data/class/plugin/SC_Plugin_Util.php @@ -221,10 +221,10 @@ public static function checkExtension($key) // プラグイン利用に必須のモジュール // 'EC-CUBEバージョン' => array('モジュール名') $arrRequireExtension = [ - '2.12.0' => ['dom'], - '2.12.1' => ['dom'], - '2.12.2' => ['dom'], - ]; + '2.12.0' => ['dom'], + '2.12.1' => ['dom'], + '2.12.2' => ['dom'], + ]; // 必須拡張モジュールのチェック $arrErr = []; if (is_array($arrRequireExtension[ECCUBE_VERSION])) { diff --git a/data/class/sessionfactory/SC_SessionFactory_UseCookie.php b/data/class/sessionfactory/SC_SessionFactory_UseCookie.php index 2062cb3ee5..1f5d908c6a 100644 --- a/data/class/sessionfactory/SC_SessionFactory_UseCookie.php +++ b/data/class/sessionfactory/SC_SessionFactory_UseCookie.php @@ -95,7 +95,7 @@ public function useCookie() */ protected function getSecureOption() { - return strpos(HTTP_URL, 'https') !== false && strpos(HTTPS_URL, 'https') !== false; + return str_contains(HTTP_URL, 'https') && str_contains(HTTPS_URL, 'https'); } } /* diff --git a/data/class/sessionfactory/SC_SessionFactory_UseRequest.php b/data/class/sessionfactory/SC_SessionFactory_UseRequest.php index c0e7494cca..5a6484b682 100644 --- a/data/class/sessionfactory/SC_SessionFactory_UseRequest.php +++ b/data/class/sessionfactory/SC_SessionFactory_UseRequest.php @@ -36,7 +36,7 @@ */ class SC_SessionFactory_UseRequest extends SC_SessionFactory_Ex { - public $state = null; + public $state; /** * PC/モバイルのセッション管理オブジェクトを切り替える diff --git a/data/class/util/GC_Utils.php b/data/class/util/GC_Utils.php index 01ed79cacb..9961efbeff 100644 --- a/data/class/util/GC_Utils.php +++ b/data/class/util/GC_Utils.php @@ -199,7 +199,7 @@ public static function gfPrintLog($msg, $path = '', $verbose = USE_VERBOSE_LOG) $msg .= 'customer_id = '.$_SESSION['customer']['customer_id']."\n"; } if (GC_Utils_Ex::isAdminFunction()) { - $msg .= 'login_id = '.$_SESSION['login_id'].'('.$_SESSION['authority'].')'.'['.substr(sha1(session_id()), 0, 8).']'."\n"; + $msg .= 'login_id = '.$_SESSION['login_id'].'('.$_SESSION['authority'].')['.substr(sha1(session_id()), 0, 8).']'."\n"; } $msg .= GC_Utils_Ex::toStringBacktrace(GC_Utils_Ex::getDebugBacktrace()); } diff --git a/data/class/util/SC_Utils.php b/data/class/util/SC_Utils.php index c58cafc6d5..f78045fb76 100755 --- a/data/class/util/SC_Utils.php +++ b/data/class/util/SC_Utils.php @@ -325,7 +325,7 @@ public static function sfIsInt($value) */ public static function sfIsZeroFilling($value) { - if (strlen($value) > 1 && (strpos($value, '0') === 0)) { + if (strlen($value) > 1 && str_starts_with($value, '0')) { return true; } @@ -1063,7 +1063,7 @@ public static function sfCutString($str, $len, $byte = true, $commadisp = true) } if ($commadisp) { - $ret = $ret.'...'; + $ret .= '...'; } return $ret; @@ -1268,13 +1268,13 @@ public static function sfCopyDir($src, $des, $mess = '', $override = false) if (is_array($fileArray)) { foreach ($fileArray as $data_) { // CVS管理ファイルはコピーしない - if (strpos($data_, '/CVS/Entries') !== false) { + if (str_contains($data_, '/CVS/Entries')) { break; } - if (strpos($data_, '/CVS/Repository') !== false) { + if (str_contains($data_, '/CVS/Repository')) { break; } - if (strpos($data_, '/CVS/Root') !== false) { + if (str_contains($data_, '/CVS/Root')) { break; } @@ -1346,7 +1346,7 @@ public static function sfGetFileVersion($path) if ($src_fp) { while (!feof($src_fp)) { $line = fgets($src_fp); - if (strpos($line, '@version') !== false) { + if (str_contains($line, '@version')) { $arrLine = explode(' ', $line); $version = $arrLine[5]; } @@ -1881,7 +1881,7 @@ public static function jsonDecode($json) */ public static function isAbsoluteRealPath($realpath) { - if (strpos(PHP_OS, 'WIN') === false) { + if (!str_contains(PHP_OS, 'WIN')) { return substr($realpath, 0, 1) == '/'; } else { return preg_match('/^[a-zA-Z]:(\\\|\/)/', $realpath) ? true : false; diff --git a/data/module/Calendar/Calendar.php b/data/module/Calendar/Calendar.php index 809df81759..62f448cf9b 100644 --- a/data/module/Calendar/Calendar.php +++ b/data/module/Calendar/Calendar.php @@ -320,6 +320,7 @@ public function returnValue($returnType, $format, $stamp, $default) * @param array containing Calendar objects to select (optional) * * @return bool + * * @abstract */ public function build($sDates = []) @@ -338,6 +339,7 @@ public function build($sDates = []) * @param array * * @return bool + * * @abstract */ public function setSelection($sDates) @@ -436,13 +438,13 @@ public function &getEngine() * Set the CALENDAR_FIRST_DAY_OF_WEEK constant to the $firstDay value * if the constant is not set yet. * - * @throws E_USER_WARNING this method throws a WARNING if the - * CALENDAR_FIRST_DAY_OF_WEEK constant is already defined and - * the $firstDay parameter is set to a different value - * * @param int $firstDay first day of the week (0=sunday, 1=monday, ...) * * @return int + * + * @throws E_USER_WARNING this method throws a WARNING if the + * CALENDAR_FIRST_DAY_OF_WEEK constant is already defined and + * the $firstDay parameter is set to a different value */ public function defineFirstDayOfWeek($firstDay = null) { diff --git a/data/module/Calendar/Decorator.php b/data/module/Calendar/Decorator.php index a826e85c43..1ba3939e9c 100644 --- a/data/module/Calendar/Decorator.php +++ b/data/module/Calendar/Decorator.php @@ -32,8 +32,8 @@ * { * function thisDay($format = 'int') * { -.* $day = parent::thisDay('timestamp'); -.* return date('D', $day); + * .* $day = parent::thisDay('timestamp'); + * .* return date('D', $day); * } * } * $Day = & new Calendar_Day(2003, 10, 25); @@ -238,6 +238,7 @@ public function isEmpty() * @param array containing Calendar objects to select (optional) * * @return bool + * * @abstract */ public function build($sDates = []) diff --git a/data/module/Calendar/Decorator/Textual.php b/data/module/Calendar/Decorator/Textual.php index 1fffc79b0d..654a6bbe8f 100644 --- a/data/module/Calendar/Decorator/Textual.php +++ b/data/module/Calendar/Decorator/Textual.php @@ -68,6 +68,7 @@ public function __construct(&$Calendar) * @param string (optional) format of returned months (one,two,short or long) * * @return array + * * @static */ public function monthNames($format = 'long') @@ -81,6 +82,7 @@ public function monthNames($format = 'long') * @param string (optional) format of returned days (one,two,short or long) * * @return array + * * @static */ public function weekdayNames($format = 'long') diff --git a/data/module/Calendar/Decorator/Weekday.php b/data/module/Calendar/Decorator/Weekday.php index 9506b5fdbe..f0970f2167 100644 --- a/data/module/Calendar/Decorator/Weekday.php +++ b/data/module/Calendar/Decorator/Weekday.php @@ -144,7 +144,7 @@ public function nextWeekDay($format = 'int') */ public function adjustWeekScale($dayOfWeek) { - $dayOfWeek = $dayOfWeek - $this->firstDay; + $dayOfWeek -= $this->firstDay; if ($dayOfWeek >= 0) { return $dayOfWeek; } else { diff --git a/data/module/Calendar/Engine/UnixTS.php b/data/module/Calendar/Engine/UnixTS.php index a85a5fd19e..e1e309b46e 100644 --- a/data/module/Calendar/Engine/UnixTS.php +++ b/data/module/Calendar/Engine/UnixTS.php @@ -185,7 +185,7 @@ public function getMaxYears() */ public function getMinYears() { - return $min = strpos(PHP_OS, 'WIN') === false ? 1902 : 1970; + return $min = !str_contains(PHP_OS, 'WIN') ? 1902 : 1970; } /** diff --git a/data/module/Calendar/Factory.php b/data/module/Calendar/Factory.php index 0a07635fb5..2f6eec6478 100644 --- a/data/module/Calendar/Factory.php +++ b/data/module/Calendar/Factory.php @@ -68,6 +68,7 @@ class Calendar_Factory * @param int second * * @return object subclass of Calendar + * * @static */ public static function create($type, $y = 2000, $m = 1, $d = 1, $h = 0, $i = 0, $s = 0) @@ -137,6 +138,7 @@ public static function create($type, $y = 2000, $m = 1, $d = 1, $h = 0, $i = 0, * @param mixed timestamp (depending on Calendar engine being used) * * @return object subclass of Calendar + * * @static */ public static function &createByTimestamp($type, $stamp) diff --git a/data/module/Calendar/Table/Helper.php b/data/module/Calendar/Table/Helper.php index 68f9c1ba15..86174dee5e 100644 --- a/data/module/Calendar/Table/Helper.php +++ b/data/module/Calendar/Table/Helper.php @@ -77,7 +77,7 @@ class Calendar_Table_Helper * * @var int */ - public $numWeeks = null; + public $numWeeks; /** * Number of emtpy days before real days begin in month @@ -232,11 +232,12 @@ public function getEmptyDaysBefore() public function getEmptyDaysAfter() { // Causes bug when displaying more than one month -// static $index; -// if (!isset($index)) { + // static $index; + // if (!isset($index)) { $index = $this->getEmptyDaysBefore() + $this->cE->getDaysInMonth( $this->calendar->thisYear(), $this->calendar->thisMonth()); -// } + + // } return $index; } diff --git a/data/module/Calendar/Util/Textual.php b/data/module/Calendar/Util/Textual.php index 1d93aaf009..fd0a7cdf99 100644 --- a/data/module/Calendar/Util/Textual.php +++ b/data/module/Calendar/Util/Textual.php @@ -51,6 +51,7 @@ class Calendar_Util_Textual * @param string (optional) format of returned months (one,two,short or long) * * @return array + * * @static */ public static function monthNames($format = 'long') @@ -83,6 +84,7 @@ public static function monthNames($format = 'long') * @param string (optional) format of returned days (one,two,short or long) * * @return array + * * @static */ public static function weekdayNames($format = 'long') @@ -116,6 +118,7 @@ public static function weekdayNames($format = 'long') * @param string (optional) format of returned months (one,two,short or long) * * @return string + * * @static */ public static function prevMonthName($Calendar, $format = 'long') @@ -132,6 +135,7 @@ public static function prevMonthName($Calendar, $format = 'long') * @param string (optional) format of returned months (one,two,short or long) * * @return string + * * @static */ public static function thisMonthName($Calendar, $format = 'long') @@ -148,6 +152,7 @@ public static function thisMonthName($Calendar, $format = 'long') * @param string (optional) format of returned months (one,two,short or long) * * @return string + * * @static */ public static function nextMonthName($Calendar, $format = 'long') @@ -165,6 +170,7 @@ public static function nextMonthName($Calendar, $format = 'long') * @param string (optional) format of returned months (one,two,short or long) * * @return string + * * @static */ public static function prevDayName($Calendar, $format = 'long') @@ -187,6 +193,7 @@ public static function prevDayName($Calendar, $format = 'long') * @param string (optional) format of returned months (one,two,short or long) * * @return string + * * @static */ public static function thisDayName($Calendar, $format = 'long') @@ -205,6 +212,7 @@ public static function thisDayName($Calendar, $format = 'long') * @param string (optional) format of returned months (one,two,short or long) * * @return string + * * @static */ public static function nextDayName($Calendar, $format = 'long') @@ -228,6 +236,7 @@ public static function nextDayName($Calendar, $format = 'long') * @param string (optional) format of returned months (one,two,short or long) * * @return array ordered array of week day names + * * @static */ public static function orderedWeekdays($Calendar, $format = 'long') diff --git a/data/module/Calendar/Week.php b/data/module/Calendar/Week.php index aa48fcc812..760ccb4156 100644 --- a/data/module/Calendar/Week.php +++ b/data/module/Calendar/Week.php @@ -238,9 +238,9 @@ public function setSelection($sDates) { foreach ($sDates as $sDate) { foreach ($this->children as $key => $child) { - if ($child->thisDay() == $sDate->thisDay() && - $child->thisMonth() == $sDate->thisMonth() && - $child->thisYear() == $sDate->thisYear() + if ($child->thisDay() == $sDate->thisDay() + && $child->thisMonth() == $sDate->thisMonth() + && $child->thisYear() == $sDate->thisYear() ) { $this->children[$key] = $sDate; $this->children[$key]->setSelected(); diff --git a/data/module/HTTP/Request.php b/data/module/HTTP/Request.php index b55823bfbd..25a304f7e3 100644 --- a/data/module/HTTP/Request.php +++ b/data/module/HTTP/Request.php @@ -302,14 +302,14 @@ class HTTP_Request * * @var array */ - public $_readTimeout = null; + public $_readTimeout; /** * Options to pass to Net_Socket::connect. See stream_context_create * * @var array */ - public $_socketOptions = null; + public $_socketOptions; /**#@-*/ /** @@ -401,7 +401,7 @@ public function _generateHostHeader() $host = $this->_url->host.':'.$this->_url->port; } elseif ($this->_url->port != 443 && strcasecmp($this->_url->protocol, 'https') == 0) { $host = $this->_url->host.':'.$this->_url->port; - } elseif ($this->_url->port == 443 && strcasecmp($this->_url->protocol, 'https') == 0 && strpos($this->_url->url, ':443') !== false) { + } elseif ($this->_url->port == 443 && strcasecmp($this->_url->protocol, 'https') == 0 && str_contains($this->_url->url, ':443')) { $host = $this->_url->host.':'.$this->_url->port; } else { $host = $this->_url->host; @@ -733,20 +733,20 @@ public function sendRequest($saveBody = true) // RFC 2068, section 19.7.1: A client MUST NOT send the Keep-Alive // connection token to a proxy server... - if (isset($this->_proxy_host) && !empty($this->_requestHeaders['connection']) && - 'Keep-Alive' == $this->_requestHeaders['connection']) { + if (isset($this->_proxy_host) && !empty($this->_requestHeaders['connection']) + && 'Keep-Alive' == $this->_requestHeaders['connection']) { $this->removeHeader('connection'); } - $keepAlive = (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http && empty($this->_requestHeaders['connection'])) || - (!empty($this->_requestHeaders['connection']) && 'Keep-Alive' == $this->_requestHeaders['connection']); + $keepAlive = (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http && empty($this->_requestHeaders['connection'])) + || (!empty($this->_requestHeaders['connection']) && 'Keep-Alive' == $this->_requestHeaders['connection']); $sockets = &PEAR::getStaticProperty('HTTP_Request', 'sockets'); $sockKey = $host.':'.$port; unset($this->_sock); // There is a connected socket in the "static" property? - if ($keepAlive && !empty($sockets[$sockKey]) && - !empty($sockets[$sockKey]->fp)) { + if ($keepAlive && !empty($sockets[$sockKey]) + && !empty($sockets[$sockKey]->fp)) { $this->_sock = &$sockets[$sockKey]; $err = null; } else { @@ -810,7 +810,7 @@ public function sendRequest($saveBody = true) $this->_url = new Net_URL($redirect); $this->addHeader('Host', $this->_generateHostHeader()); // Absolute path - } elseif (strpos($redirect, '/') === 0) { + } elseif (str_starts_with($redirect, '/')) { $this->_url->path = $redirect; // Relative path @@ -938,9 +938,9 @@ public function _buildRequest() $request = $this->_method.' '.$url.' HTTP/'.$this->_http."\r\n"; - if (in_array($this->_method, $this->_bodyDisallowed) || - (0 == strlen($this->_body) && (HTTP_REQUEST_METHOD_POST != $this->_method || - (empty($this->_postData) && empty($this->_postFiles))))) { + if (in_array($this->_method, $this->_bodyDisallowed) + || (0 == strlen($this->_body) && (HTTP_REQUEST_METHOD_POST != $this->_method + || (empty($this->_postData) && empty($this->_postFiles))))) { $this->removeHeader('Content-Type'); } else { if (empty($this->_requestHeaders['content-type'])) { @@ -965,8 +965,8 @@ public function _buildRequest() $request .= "\r\n"; // Post data if it's an array - } elseif (HTTP_REQUEST_METHOD_POST == $this->_method && - (!empty($this->_postData) || !empty($this->_postFiles))) { + } elseif (HTTP_REQUEST_METHOD_POST == $this->_method + && (!empty($this->_postData) || !empty($this->_postFiles))) { // "normal" POST request if (!isset($boundary)) { $postdata = implode('&', array_map( @@ -1100,8 +1100,8 @@ public function attach(&$listener) */ public function detach(&$listener) { - if (!is_a($listener, 'HTTP_Request_Listener') || - !isset($this->_listeners[$listener->getId()])) { + if (!is_a($listener, 'HTTP_Request_Listener') + || !isset($this->_listeners[$listener->getId()])) { return false; } unset($this->_listeners[$listener->getId()]); @@ -1231,9 +1231,9 @@ public function __construct(&$sock, &$listeners) * @param bool Whether the response can actually have a message-body. * Will be set to false for HEAD requests. * - * @throws PEAR_Error - * * @return mixed true on success, PEAR_Error in case of malformed response + * + * @throws PEAR_Error */ public function process($saveBody = true, $canHaveBody = true) { @@ -1259,15 +1259,15 @@ public function process($saveBody = true, $canHaveBody = true) // 3. ... If a message is received with both a // Transfer-Encoding header field and a Content-Length header field, // the latter MUST be ignored. - $canHaveBody = $canHaveBody && $this->_code >= 200 && - $this->_code != 204 && $this->_code != 304; + $canHaveBody = $canHaveBody && $this->_code >= 200 + && $this->_code != 204 && $this->_code != 304; // If response body is present, read it and decode $chunked = isset($this->_headers['transfer-encoding']) && ('chunked' == $this->_headers['transfer-encoding']); $gzipped = isset($this->_headers['content-encoding']) && ('gzip' == $this->_headers['content-encoding']); $hasBody = false; - if ($canHaveBody && ($chunked || !isset($this->_headers['content-length']) || - 0 != $this->_headers['content-length'])) { + if ($canHaveBody && ($chunked || !isset($this->_headers['content-length']) + || 0 != $this->_headers['content-length'])) { if ($chunked || !isset($this->_headers['content-length'])) { $this->_toRead = null; } else { @@ -1318,7 +1318,7 @@ public function process($saveBody = true, $canHaveBody = true) */ public function _processHeader($header) { - if (false === strpos($header, ':')) { + if (!str_contains($header, ':')) { return; } list($headername, $headervalue) = explode(':', $header, 2); @@ -1364,7 +1364,7 @@ public function _parseCookie($headervalue) $cookie['value'] = trim(substr($elements[0], $pos + 1)); for ($i = 1; $i < count($elements); $i++) { - if (false === strpos($elements[$i], '=')) { + if (!str_contains($elements[$i], '=')) { $elName = trim($elements[$i]); $elValue = null; } else { diff --git a/data/module/HTTP/Request/Listener.php b/data/module/HTTP/Request/Listener.php index ce21a4630a..b6ec46c90d 100644 --- a/data/module/HTTP/Request/Listener.php +++ b/data/module/HTTP/Request/Listener.php @@ -90,6 +90,7 @@ public function getId() * @param object an object the listener is attached to * @param string Event name * @param mixed Additional data + * * @abstract */ public function update(&$subject, $event, $data = null) diff --git a/data/module/Net/SMTP.php b/data/module/Net/SMTP.php index cc043618c6..f9b7c47325 100644 --- a/data/module/Net/SMTP.php +++ b/data/module/Net/SMTP.php @@ -95,14 +95,14 @@ class Net_SMTP * * @var callable */ - public $_debug_handler = null; + public $_debug_handler; /** * The socket resource being used to connect to the SMTP server. * * @var resource */ - public $_socket = null; + public $_socket; /** * The most recent server response code. @@ -123,7 +123,7 @@ class Net_SMTP * * @var string */ - public $_greeting = null; + public $_greeting; /** * Stores detected features of the SMTP server. @@ -511,9 +511,9 @@ public function auth($uid, $pwd, $method = '', $tls = true, $authz = '') * extension, are connected to an SMTP server which supports the * STARTTLS extension, and aren't already connected over a secure * (SSL) socket connection. */ - if ($tls && version_compare(PHP_VERSION, '5.1.0', '>=') && - extension_loaded('openssl') && isset($this->_esmtp['STARTTLS']) && - strncasecmp($this->host, 'ssl://', 6) !== 0) { + if ($tls && version_compare(PHP_VERSION, '5.1.0', '>=') + && extension_loaded('openssl') && isset($this->_esmtp['STARTTLS']) + && strncasecmp($this->host, 'ssl://', 6) !== 0) { /* Start the TLS connection attempt. */ if (PEAR::isError($result = $this->_put('STARTTLS'))) { return $result; @@ -824,7 +824,7 @@ public function mailFrom($sender, $params = null) if ($params['verp'] === true) { $args .= ' XVERP'; - /* XVERP=something */ + /* XVERP=something */ } elseif (trim($params['verp'])) { $args .= ' XVERP='.$params['verp']; } diff --git a/data/module/Net/Socket.php b/data/module/Net/Socket.php index 871ea7cd57..28a147bfd5 100644 --- a/data/module/Net/Socket.php +++ b/data/module/Net/Socket.php @@ -53,7 +53,7 @@ class Net_Socket extends PEAR * * @var resource */ - public $fp = null; + public $fp; /** * Whether the socket is blocking. Defaults to true. @@ -130,8 +130,8 @@ public function connect($addr, $port = 0, $persistent = null, if (!$addr) { return $this->raiseError('$addr cannot be empty'); - } elseif (strspn($addr, '.0123456789') == strlen($addr) || - strstr($addr, '/') !== false) { + } elseif (strspn($addr, '.0123456789') == strlen($addr) + || strstr($addr, '/') !== false) { $this->addr = $addr; } else { $this->addr = @gethostbyname($addr); diff --git a/data/module/Net/URL.php b/data/module/Net/URL.php index 057c68a4be..e39e732e69 100644 --- a/data/module/Net/URL.php +++ b/data/module/Net/URL.php @@ -154,8 +154,8 @@ public function initialize() /* * Figure out host/port */ - if (!empty($HTTP_SERVER_VARS['HTTP_HOST']) && - preg_match('/^(.*)(:([0-9]+))?$/U', $HTTP_SERVER_VARS['HTTP_HOST'], $matches)) { + if (!empty($HTTP_SERVER_VARS['HTTP_HOST']) + && preg_match('/^(.*)(:([0-9]+))?$/U', $HTTP_SERVER_VARS['HTTP_HOST'], $matches)) { $host = $matches[1]; if (!empty($matches[3])) { $port = $matches[3]; @@ -195,7 +195,7 @@ public function initialize() break; case 'path': - if (strpos($value, '/') === 0) { + if (str_starts_with($value, '/')) { $this->path = $value; } else { $path = dirname($this->path) == DIRECTORY_SEPARATOR ? '' : dirname($this->path); @@ -328,7 +328,7 @@ public function _parseRawQuerystring($querystring) $return = []; foreach ($parts as $part) { - if (strpos($part, '=') !== false) { + if (str_contains($part, '=')) { $value = substr($part, strpos($part, '=') + 1); $key = substr($part, 0, strpos($part, '=')); } else { diff --git a/data/module/gdthumb.php b/data/module/gdthumb.php index 95a7d19563..aa4af01abe 100644 --- a/data/module/gdthumb.php +++ b/data/module/gdthumb.php @@ -148,7 +148,7 @@ public function Main($path, $width, $height, $dst_file, $header = false) return ''; } else { - $dst_file = $dst_file.'.gif'; + $dst_file .= '.gif'; if ($re_size[0] == $size[0] && $re_size[1] == $size[1]) { // サイズが同じ場合には、そのままコピーする。(画質劣化を防ぐ) copy($path, $dst_file); @@ -165,7 +165,7 @@ public function Main($path, $width, $height, $dst_file, $header = false) return ''; } else { - $dst_file = $dst_file.'.png'; + $dst_file .= '.png'; if ($re_size[0] == $size[0] && $re_size[1] == $size[1]) { // サイズが同じ場合には、そのままコピーする。(画質劣化を防ぐ) copy($path, $dst_file); @@ -195,7 +195,7 @@ public function Main($path, $width, $height, $dst_file, $header = false) return ''; } else { - $dst_file = $dst_file.'.png'; + $dst_file .= '.png'; imagepng($dst_im, $dst_file); } imagedestroy($dst_im); @@ -216,7 +216,7 @@ public function Main($path, $width, $height, $dst_file, $header = false) return ''; } else { - $dst_file = $dst_file.'.jpg'; + $dst_file .= '.jpg'; if ($re_size[0] == $size[0] && $re_size[1] == $size[1]) { // サイズが同じ場合には、そのままコピーする。(画質劣化を防ぐ) @@ -263,7 +263,7 @@ public function Main($path, $width, $height, $dst_file, $header = false) return ''; } else { - $dst_file = $dst_file.'.png'; + $dst_file .= '.png'; if ($re_size[0] == $size[0] && $re_size[1] == $size[1]) { // サイズが同じ場合には、そのままコピーする。(画質劣化を防ぐ) copy($path, $dst_file); diff --git a/tests/class/SC_CheckError/SC_CheckError_createParamTest.php b/tests/class/SC_CheckError/SC_CheckError_createParamTest.php index 4ab97712e6..75898cfca0 100644 --- a/tests/class/SC_CheckError/SC_CheckError_createParamTest.php +++ b/tests/class/SC_CheckError/SC_CheckError_createParamTest.php @@ -48,7 +48,7 @@ public function testArrParamIsCaracter() $this->objErr->doFunc(['EXIST_CHECK', 'aabbcc_1234'], ['EXIST_CHECK']); $this->expected = [self::FORM_NAME => [0 => 'A', 1 => 'B', 2 => 'C'], - 'aabbcc_1234' => '', ]; + 'aabbcc_1234' => '', ]; $this->actual = $this->objErr->arrParam; $this->assertEquals($this->expected, $this->actual); } diff --git a/tests/class/SC_Date/SC_Date_getZeroMonthTest.php b/tests/class/SC_Date/SC_Date_getZeroMonthTest.php index 6e1ff0b649..5f496c8a50 100644 --- a/tests/class/SC_Date/SC_Date_getZeroMonthTest.php +++ b/tests/class/SC_Date/SC_Date_getZeroMonthTest.php @@ -50,7 +50,7 @@ public function testGetZeroMonth要素の数が12の配列を返す() public function testGetZeroMonth0をつけた月の配列を返す() { $this->expected = ['01' => '01', '02' => '02', '03' => '03', '04' => '04', '05' => '05', '06' => '06', '07' => '07', '08' => '08', '09' => '09', '10' => '10', '11' => '11', '12' => '12', - ]; + ]; $this->actual = $this->objDate->getZeroMonth(); $this->verify('配列の最低値'); diff --git a/tests/class/SC_Date/SC_Date_isHolidayTest.php b/tests/class/SC_Date/SC_Date_isHolidayTest.php index 1c321ba5a0..f256130568 100644 --- a/tests/class/SC_Date/SC_Date_isHolidayTest.php +++ b/tests/class/SC_Date/SC_Date_isHolidayTest.php @@ -43,7 +43,7 @@ protected function setUp(): void 'create_date' => '2013-02-14 11:22:33', 'update_date' => '2013-02-14 22:11:33', 'del_flg' => '0', - ], + ], [ 'holiday_id' => '2', 'title' => 'TEST HOLIDAY2', @@ -54,8 +54,8 @@ protected function setUp(): void 'create_date' => '2013-02-15 11:22:33', 'update_date' => '2013-02-16 22:11:33', 'del_flg' => '0', - ], - ]; + ], + ]; // 休みの曜日を登録 $baseInfo = [ 'id' => '1', diff --git a/tests/class/SC_FpdfTest.php b/tests/class/SC_FpdfTest.php index 411360c6d7..4e13971af1 100644 --- a/tests/class/SC_FpdfTest.php +++ b/tests/class/SC_FpdfTest.php @@ -9,6 +9,7 @@ protected function setUp(): void /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function test正しいMediaBox情報が出力される() diff --git a/tests/class/SC_Product/SC_Product_TestBase.php b/tests/class/SC_Product/SC_Product_TestBase.php index 908dbd6c01..60125afa40 100644 --- a/tests/class/SC_Product/SC_Product_TestBase.php +++ b/tests/class/SC_Product/SC_Product_TestBase.php @@ -34,7 +34,7 @@ protected function setUpProductClass() 'stock' => '99', 'creator_id' => '1', 'del_flg' => '0', - ], + ], [ 'update_date' => 'CURRENT_TIMESTAMP', 'product_class_id' => '1002', @@ -45,7 +45,7 @@ protected function setUpProductClass() 'creator_id' => '1', 'stock_unlimited' => '1', 'del_flg' => '0', - ], + ], [ 'update_date' => 'CURRENT_TIMESTAMP', 'product_class_id' => '2001', @@ -56,8 +56,8 @@ protected function setUpProductClass() 'creator_id' => '1', 'stock_unlimited' => '1', 'del_flg' => '1', - ], - ]; + ], + ]; $this->objQuery->delete('dtb_products_class'); foreach ($product_class as $key => $item) { @@ -105,7 +105,7 @@ protected function setUpClassCategory() 'creator_id' => '1', 'name' => 'cat1001', 'rank' => 1, - ], + ], [ 'update_date' => 'CURRENT_TIMESTAMP', 'classcategory_id' => '1002', @@ -113,8 +113,8 @@ protected function setUpClassCategory() 'creator_id' => '1', 'name' => 'cat1002', 'rank' => 2, - ], - ]; + ], + ]; // classcategory_id=0のものは削除しない $this->objQuery->delete('dtb_classcategory', 'classcategory_id <> 0'); @@ -144,7 +144,7 @@ protected function setUpProducts() 'del_flg' => '0', 'creator_id' => '1', 'status' => '1', - ], + ], [ 'update_date' => 'CURRENT_TIMESTAMP', 'product_id' => '1002', @@ -159,7 +159,7 @@ protected function setUpProducts() 'del_flg' => '0', 'creator_id' => '1', 'status' => '2', - ], + ], [ 'update_date' => 'CURRENT_TIMESTAMP', 'product_id' => '2001', @@ -175,8 +175,8 @@ protected function setUpProducts() 'del_flg' => '1', 'creator_id' => '1', 'status' => '1', - ], - ]; + ], + ]; $this->objQuery->delete('dtb_products'); foreach ($products as $key => $item) { @@ -196,15 +196,15 @@ protected function setUpProductStatus() 'product_id' => '1001', 'creator_id' => '1', 'del_flg' => '0', - ], + ], [ 'update_date' => 'CURRENT_TIMESTAMP', 'product_status_id' => '1', 'product_id' => '1002', 'creator_id' => '1', 'del_flg' => '0', - ], - ]; + ], + ]; $this->objQuery->delete('dtb_product_status'); foreach ($class_category as $key => $item) { diff --git a/tests/class/SC_Product/SC_Product_getDetailAndProductsClassTest.php b/tests/class/SC_Product/SC_Product_getDetailAndProductsClassTest.php index ccb454674f..4a940af7a7 100644 --- a/tests/class/SC_Product/SC_Product_getDetailAndProductsClassTest.php +++ b/tests/class/SC_Product/SC_Product_getDetailAndProductsClassTest.php @@ -25,7 +25,7 @@ public function testGetDetailAndProductsClass商品規格IDの商品情報と規 $arrRet = $this->objQuery->getCol('update_date', 'dtb_products', 'product_id = 1001'); $this->expected = [ - 'product_id' => '1001', 'product_code_min' => 'code1001', 'product_code_max' => 'code1001', 'name' => '製品名1001', 'comment1' => 'コメント10011', 'comment2' => 'コメント10012', 'comment3' => 'コメント10013', 'main_list_comment' => 'リストコメント1001', 'main_image' => '1001.jpg', 'main_list_image' => '1001-main.jpg', 'price01_min' => '1500', 'price01_max' => '1500', 'price02_min' => '1500', 'price02_max' => '1500', 'stock_min' => '99', 'stock_max' => '99', 'stock_unlimited_min' => '0', 'stock_unlimited_max' => '0', 'deliv_date_id' => '1', 'status' => '1', 'del_flg' => '0', 'update_date' => $arrRet[0], 'price01_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price01_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'maker_id' => null, 'comment4' => null, 'comment5' => null, 'comment6' => null, 'note' => null, 'main_comment' => 'メインコメント1001', 'main_large_image' => null, 'sub_title1' => null, 'sub_comment1' => null, 'sub_image1' => null, 'sub_large_image1' => null, 'sub_title2' => null, 'sub_comment2' => null, 'sub_image2' => null, 'sub_large_image2' => null, 'sub_title3' => null, 'sub_comment3' => null, 'sub_image3' => null, 'sub_large_image3' => null, 'sub_title4' => null, 'sub_comment4' => null, 'sub_image4' => null, 'sub_large_image4' => null, 'sub_title5' => null, 'sub_comment5' => null, 'sub_image5' => null, 'sub_large_image5' => null, 'sub_title6' => null, 'sub_comment6' => null, 'sub_image6' => null, 'sub_large_image6' => null, 'creator_id' => '1', 'create_date' => $arrRet[0], 'point_rate' => '0', 'deliv_fee' => null, 'maker_name' => null, 'stock' => '99', 'stock_unlimited' => '0', 'sale_limit' => null, 'price01' => '1500', 'price02' => '1500', 'product_code' => 'code1001', 'product_class_id' => '1001', 'product_type_id' => '1', 'down_filename' => null, 'down_realfilename' => null, 'classcategory_name1' => 'cat1001', 'rank1' => '1', 'class_name1' => '味', 'class_id1' => '1', 'classcategory_id1' => '1001', 'classcategory_id2' => '1002', 'classcategory_name2' => 'cat1002', 'rank2' => '2', 'class_name2' => '味', 'class_id2' => '1', 'price01_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), + 'product_id' => '1001', 'product_code_min' => 'code1001', 'product_code_max' => 'code1001', 'name' => '製品名1001', 'comment1' => 'コメント10011', 'comment2' => 'コメント10012', 'comment3' => 'コメント10013', 'main_list_comment' => 'リストコメント1001', 'main_image' => '1001.jpg', 'main_list_image' => '1001-main.jpg', 'price01_min' => '1500', 'price01_max' => '1500', 'price02_min' => '1500', 'price02_max' => '1500', 'stock_min' => '99', 'stock_max' => '99', 'stock_unlimited_min' => '0', 'stock_unlimited_max' => '0', 'deliv_date_id' => '1', 'status' => '1', 'del_flg' => '0', 'update_date' => $arrRet[0], 'price01_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price01_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'maker_id' => null, 'comment4' => null, 'comment5' => null, 'comment6' => null, 'note' => null, 'main_comment' => 'メインコメント1001', 'main_large_image' => null, 'sub_title1' => null, 'sub_comment1' => null, 'sub_image1' => null, 'sub_large_image1' => null, 'sub_title2' => null, 'sub_comment2' => null, 'sub_image2' => null, 'sub_large_image2' => null, 'sub_title3' => null, 'sub_comment3' => null, 'sub_image3' => null, 'sub_large_image3' => null, 'sub_title4' => null, 'sub_comment4' => null, 'sub_image4' => null, 'sub_large_image4' => null, 'sub_title5' => null, 'sub_comment5' => null, 'sub_image5' => null, 'sub_large_image5' => null, 'sub_title6' => null, 'sub_comment6' => null, 'sub_image6' => null, 'sub_large_image6' => null, 'creator_id' => '1', 'create_date' => $arrRet[0], 'point_rate' => '0', 'deliv_fee' => null, 'maker_name' => null, 'stock' => '99', 'stock_unlimited' => '0', 'sale_limit' => null, 'price01' => '1500', 'price02' => '1500', 'product_code' => 'code1001', 'product_class_id' => '1001', 'product_type_id' => '1', 'down_filename' => null, 'down_realfilename' => null, 'classcategory_name1' => 'cat1001', 'rank1' => '1', 'class_name1' => '味', 'class_id1' => '1', 'classcategory_id1' => '1001', 'classcategory_id2' => '1002', 'classcategory_name2' => 'cat1002', 'rank2' => '2', 'class_name2' => '味', 'class_id2' => '1', 'price01_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), ]; $this->actual = $this->objProducts->getDetailAndProductsClass('1001'); diff --git a/tests/class/SC_Product/SC_Product_getDetailTest.php b/tests/class/SC_Product/SC_Product_getDetailTest.php index 113a88c222..0f85b733d7 100644 --- a/tests/class/SC_Product/SC_Product_getDetailTest.php +++ b/tests/class/SC_Product/SC_Product_getDetailTest.php @@ -25,7 +25,7 @@ public function testGetDetail商品IDの詳細情報を返す() $arrRet = $this->objQuery->getCol('update_date', 'dtb_products', 'product_id = 1001'); $this->expected = [ - 'product_id' => '1001', 'product_code_min' => 'code1001', 'product_code_max' => 'code1001', 'name' => '製品名1001', 'comment1' => 'コメント10011', 'comment2' => 'コメント10012', 'comment3' => 'コメント10013', 'main_list_comment' => 'リストコメント1001', 'main_image' => '1001.jpg', 'main_list_image' => '1001-main.jpg', 'price01_min' => '1500', 'price01_max' => '1500', 'price02_min' => '1500', 'price02_max' => '1500', 'stock_min' => '99', 'stock_max' => '99', 'stock_unlimited_min' => '0', 'stock_unlimited_max' => '0', 'deliv_date_id' => '1', 'status' => '1', 'del_flg' => '0', 'update_date' => $arrRet[0], 'price01_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price01_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'maker_id' => null, 'comment4' => null, 'comment5' => null, 'comment6' => null, 'note' => null, 'main_comment' => 'メインコメント1001', 'main_large_image' => null, 'sub_title1' => null, 'sub_comment1' => null, 'sub_image1' => null, 'sub_large_image1' => null, 'sub_title2' => null, 'sub_comment2' => null, 'sub_image2' => null, 'sub_large_image2' => null, 'sub_title3' => null, 'sub_comment3' => null, 'sub_image3' => null, 'sub_large_image3' => null, 'sub_title4' => null, 'sub_comment4' => null, 'sub_image4' => null, 'sub_large_image4' => null, 'sub_title5' => null, 'sub_comment5' => null, 'sub_image5' => null, 'sub_large_image5' => null, 'sub_title6' => null, 'sub_comment6' => null, 'sub_image6' => null, 'sub_large_image6' => null, 'creator_id' => '1', 'create_date' => $arrRet[0], 'point_rate' => '0', 'deliv_fee' => null, 'maker_name' => null, + 'product_id' => '1001', 'product_code_min' => 'code1001', 'product_code_max' => 'code1001', 'name' => '製品名1001', 'comment1' => 'コメント10011', 'comment2' => 'コメント10012', 'comment3' => 'コメント10013', 'main_list_comment' => 'リストコメント1001', 'main_image' => '1001.jpg', 'main_list_image' => '1001-main.jpg', 'price01_min' => '1500', 'price01_max' => '1500', 'price02_min' => '1500', 'price02_max' => '1500', 'stock_min' => '99', 'stock_max' => '99', 'stock_unlimited_min' => '0', 'stock_unlimited_max' => '0', 'deliv_date_id' => '1', 'status' => '1', 'del_flg' => '0', 'update_date' => $arrRet[0], 'price01_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price01_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_min_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_max_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'maker_id' => null, 'comment4' => null, 'comment5' => null, 'comment6' => null, 'note' => null, 'main_comment' => 'メインコメント1001', 'main_large_image' => null, 'sub_title1' => null, 'sub_comment1' => null, 'sub_image1' => null, 'sub_large_image1' => null, 'sub_title2' => null, 'sub_comment2' => null, 'sub_image2' => null, 'sub_large_image2' => null, 'sub_title3' => null, 'sub_comment3' => null, 'sub_image3' => null, 'sub_large_image3' => null, 'sub_title4' => null, 'sub_comment4' => null, 'sub_image4' => null, 'sub_large_image4' => null, 'sub_title5' => null, 'sub_comment5' => null, 'sub_image5' => null, 'sub_large_image5' => null, 'sub_title6' => null, 'sub_comment6' => null, 'sub_image6' => null, 'sub_large_image6' => null, 'creator_id' => '1', 'create_date' => $arrRet[0], 'point_rate' => '0', 'deliv_fee' => null, 'maker_name' => null, ]; $this->actual = $this->objProducts->getDetail('1001'); diff --git a/tests/class/SC_Product/SC_Product_getProductsClassTest.php b/tests/class/SC_Product/SC_Product_getProductsClassTest.php index 4a2c780e28..812db4c907 100644 --- a/tests/class/SC_Product/SC_Product_getProductsClassTest.php +++ b/tests/class/SC_Product/SC_Product_getProductsClassTest.php @@ -22,7 +22,7 @@ protected function tearDown(): void public function testGetProductsClass商品規格IDから規格情報を返す() { $this->expected = [ - 'product_id' => '1001', 'del_flg' => '0', 'point_rate' => '0', 'stock' => '99', 'stock_unlimited' => '0', 'sale_limit' => null, 'price01' => '1500', 'price02' => '1500', 'product_code' => 'code1001', 'product_class_id' => '1001', 'product_type_id' => '1', 'down_filename' => null, 'down_realfilename' => null, 'classcategory_name1' => 'cat1001', 'rank1' => '1', 'class_name1' => '味', 'class_id1' => '1', 'classcategory_id1' => '1001', 'classcategory_id2' => '1002', 'classcategory_name2' => 'cat1002', 'rank2' => '2', 'class_name2' => '味', 'class_id2' => '1', 'price01_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), + 'product_id' => '1001', 'del_flg' => '0', 'point_rate' => '0', 'stock' => '99', 'stock_unlimited' => '0', 'sale_limit' => null, 'price01' => '1500', 'price02' => '1500', 'product_code' => 'code1001', 'product_class_id' => '1001', 'product_type_id' => '1', 'down_filename' => null, 'down_realfilename' => null, 'classcategory_name1' => 'cat1001', 'rank1' => '1', 'class_name1' => '味', 'class_id1' => '1', 'classcategory_id1' => '1001', 'classcategory_id2' => '1002', 'classcategory_name2' => 'cat1002', 'rank2' => '2', 'class_name2' => '味', 'class_id2' => '1', 'price01_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), 'price02_inctax' => SC_Helper_TaxRule_Ex::sfCalcIncTax(1500), ]; $this->actual = $this->objProducts->getProductsClass('1001'); diff --git a/tests/class/SC_Query_Test.php b/tests/class/SC_Query_Test.php index a2a5a286ae..ebc728ae49 100644 --- a/tests/class/SC_Query_Test.php +++ b/tests/class/SC_Query_Test.php @@ -103,9 +103,9 @@ public function testGetAll() $result = $this->setTestData(1, '2', 'f'); $this->expected = [['id' => '1', - 'column1' => '1', - 'column2' => '2', - 'column3' => 'f', ]]; + 'column1' => '1', + 'column2' => '2', + 'column3' => 'f', ]]; $this->actual = $this->objQuery->getAll('SELECT * FROM test_table WHERE id = ?', [1]); $this->verify(); @@ -120,9 +120,9 @@ public function testSelect() $result = $this->setTestData(1, '2', 'f'); $this->expected = [['id' => '1', - 'column1' => '1', - 'column2' => '2', - 'column3' => 'f', ]]; + 'column1' => '1', + 'column2' => '2', + 'column3' => 'f', ]]; $this->actual = $this->objQuery->setWhere('id = ?') ->setOrder('id') @@ -190,9 +190,9 @@ public function testQuery1() $this->objQuery->query($sql, $data); $this->expected = [['id' => '1', - 'column1' => '1', - 'column2' => '1', - 'column3' => 'f', ]]; + 'column1' => '1', + 'column2' => '1', + 'column3' => 'f', ]]; $this->actual = $this->objQuery->getAll('SELECT * FROM test_table'); @@ -205,14 +205,14 @@ public function testInsert() $this->objQuery->insert('test_table', ['id' => '1', - 'column1' => '1', - 'column2' => '1', - 'column3' => 'f', ]); + 'column1' => '1', + 'column2' => '1', + 'column3' => 'f', ]); $this->expected = [['id' => '1', - 'column1' => '1', - 'column2' => '1', - 'column3' => 'f', ]]; + 'column1' => '1', + 'column2' => '1', + 'column3' => 'f', ]]; $this->actual = $this->objQuery->getAll('SELECT * FROM test_table'); @@ -233,9 +233,9 @@ public function testQuery2() $this->objQuery->query($sql, $data); $this->expected = [['id' => '1', - 'column1' => '2', - 'column2' => '2', - 'column3' => 'f', ]]; + 'column1' => '2', + 'column2' => '2', + 'column3' => 'f', ]]; $this->actual = $this->objQuery->getAll('SELECT * FROM test_table'); @@ -249,14 +249,14 @@ public function testUpdate() $this->objQuery->update('test_table', ['id' => '1', - 'column1' => '2', - 'column2' => '2', - 'column3' => 'f', ], + 'column1' => '2', + 'column2' => '2', + 'column3' => 'f', ], 'id = ?', [1]); $this->expected = [['id' => '1', - 'column1' => '2', - 'column2' => '2', - 'column3' => 'f', ]]; + 'column1' => '2', + 'column2' => '2', + 'column3' => 'f', ]]; $this->actual = $this->objQuery->getAll('SELECT * FROM test_table'); diff --git a/tests/class/SC_SendMailTest.php b/tests/class/SC_SendMailTest.php index 20016880ba..5b15864466 100644 --- a/tests/class/SC_SendMailTest.php +++ b/tests/class/SC_SendMailTest.php @@ -144,6 +144,7 @@ public function testGetRecip() /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testGetBackendParams() diff --git a/tests/class/SC_SessionFactoryTest.php b/tests/class/SC_SessionFactoryTest.php index d94aa692ff..d9f10592ec 100644 --- a/tests/class/SC_SessionFactoryTest.php +++ b/tests/class/SC_SessionFactoryTest.php @@ -13,7 +13,7 @@ public function testGetInstance() $refClass = new ReflectionClass($sessionFactory); $refMethod = $refClass->getMethod('getSecureOption'); $refMethod->setAccessible(true); - if (strpos(HTTP_URL, 'https') !== false) { + if (str_contains(HTTP_URL, 'https')) { $this->assertTrue($refMethod->invoke($sessionFactory)); } else { $this->markTestIncomplete(); diff --git a/tests/class/fixtures/plugin/PrefilterTransformPlugin/PrefilterTransformPlugin.php b/tests/class/fixtures/plugin/PrefilterTransformPlugin/PrefilterTransformPlugin.php index 1b0614f291..20a3e68f8f 100644 --- a/tests/class/fixtures/plugin/PrefilterTransformPlugin/PrefilterTransformPlugin.php +++ b/tests/class/fixtures/plugin/PrefilterTransformPlugin/PrefilterTransformPlugin.php @@ -9,7 +9,7 @@ public function prefilterTransform(&$source, LC_Page_Ex $objPage, $filename) case DEVICE_TYPE_SMARTPHONE: case DEVICE_TYPE_PC: // 商品一覧画面 - if (strpos($filename, 'products/list.tpl') !== false) { + if (str_contains($filename, 'products/list.tpl')) { // see http://downloads.ec-cube.net/manual/12.0_plugin/plugin.pdf $objTransform->select('h2.title')->insertBefore('

プラグイン仕様書の記述方法

'); } @@ -19,7 +19,7 @@ public function prefilterTransform(&$source, LC_Page_Ex $objPage, $filename) break; case DEVICE_TYPE_ADMIN: default: - } + } $source = $objTransform->getHTML(); } } diff --git a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php index 01bde11e48..15931b2c87 100644 --- a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php +++ b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php @@ -42,7 +42,7 @@ protected function setUpAddress() 'fax01' => '111', 'fax02' => '1111', 'fax03' => '1111', - ], + ], [ 'other_deliv_id' => '1001', 'customer_id' => '1', @@ -61,8 +61,8 @@ protected function setUpAddress() 'fax01' => '111', 'fax02' => '1111', 'fax03' => '1111', - ], - ]; + ], + ]; $this->objQuery->delete('dtb_other_deliv'); foreach ($kiyaku as $key => $item) { diff --git a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getAddressTest.php b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getAddressTest.php index e3ceade30f..713069045b 100644 --- a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getAddressTest.php +++ b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getAddressTest.php @@ -45,27 +45,27 @@ public function testgetAddressTest会員の登録配送先が該当テーブル $other_deliv_id = '1001'; $customer_id = 1; $this->expected = [ - 'other_deliv_id' => '1001', - 'customer_id' => '1', - 'name01' => 'テスト', - 'name02' => 'に', - 'kana01' => 'テスト', - 'kana02' => 'ニ', - 'zip01' => '222', - 'zip02' => '2222', - 'pref' => '2', - 'addr01' => 'テスト1', - 'addr02' => 'テスト2', - 'tel01' => '000', - 'tel02' => '0000', - 'tel03' => '0000', - 'fax01' => '111', - 'fax02' => '1111', - 'fax03' => '1111', - 'country_id' => null, - 'company_name' => null, - 'zipcode' => null, - ]; + 'other_deliv_id' => '1001', + 'customer_id' => '1', + 'name01' => 'テスト', + 'name02' => 'に', + 'kana01' => 'テスト', + 'kana02' => 'ニ', + 'zip01' => '222', + 'zip02' => '2222', + 'pref' => '2', + 'addr01' => 'テスト1', + 'addr02' => 'テスト2', + 'tel01' => '000', + 'tel02' => '0000', + 'tel03' => '0000', + 'fax01' => '111', + 'fax02' => '1111', + 'fax03' => '1111', + 'country_id' => null, + 'company_name' => null, + 'zipcode' => null, + ]; $this->actual = $this->objAddress->getAddress($other_deliv_id, $customer_id); $this->verify('登録配送先取得'); diff --git a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getListTest.php b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getListTest.php index 1efba72da7..2366608579 100644 --- a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getListTest.php +++ b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getListTest.php @@ -44,8 +44,8 @@ public function testgetListTest会員が該当テーブルに存在するかつs 'country_id' => null, 'company_name' => null, 'zipcode' => null, - ], - ]; + ], + ]; $this->actual = $this->objAddress->getList($customer_id, $startno); $this->verify('配送先一覧取得'); @@ -56,7 +56,7 @@ public function testgetListTest会員が該当テーブルに存在する場合 $this->setUpAddress(); $customer_id = '1'; $this->expected = [ - [ + [ 'other_deliv_id' => '1001', 'customer_id' => '1', 'name01' => 'テスト', @@ -77,7 +77,7 @@ public function testgetListTest会員が該当テーブルに存在する場合 'country_id' => null, 'company_name' => null, 'zipcode' => null, - ], + ], [ 'other_deliv_id' => '1000', 'customer_id' => '1', @@ -99,8 +99,8 @@ public function testgetListTest会員が該当テーブルに存在する場合 'country_id' => null, 'company_name' => null, 'zipcode' => null, - ], - ]; + ], + ]; $this->actual = $this->objAddress->getList($customer_id); $this->verify('配送先一覧取得'); diff --git a/tests/class/helper/SC_Helper_DB/SC_Helper_DB_TestBase.php b/tests/class/helper/SC_Helper_DB/SC_Helper_DB_TestBase.php index a0e580e133..8be6678a82 100644 --- a/tests/class/helper/SC_Helper_DB/SC_Helper_DB_TestBase.php +++ b/tests/class/helper/SC_Helper_DB/SC_Helper_DB_TestBase.php @@ -49,28 +49,28 @@ protected function setUpNews() { $news = [ [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1', - 'news_title' => 'ニュース情報01', - 'rank' => '1', - 'creator_id' => '1', - 'del_flg' => '0', + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1', + 'news_title' => 'ニュース情報01', + 'rank' => '1', + 'creator_id' => '1', + 'del_flg' => '0', ], [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '2', - 'news_title' => 'ニュース情報02', - 'rank' => '2', - 'creator_id' => '1', - 'del_flg' => '0', + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '2', + 'news_title' => 'ニュース情報02', + 'rank' => '2', + 'creator_id' => '1', + 'del_flg' => '0', ], [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '3', - 'news_title' => 'ニュース情報03', - 'rank' => '3', - 'creator_id' => '1', - 'del_flg' => '0', + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '3', + 'news_title' => 'ニュース情報03', + 'rank' => '3', + 'creator_id' => '1', + 'del_flg' => '0', ], ]; diff --git a/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetAddPointTest.php b/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetAddPointTest.php index 53197f8746..96c65149e0 100644 --- a/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetAddPointTest.php +++ b/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetAddPointTest.php @@ -13,6 +13,7 @@ protected function setUp(): void /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testSfGetAddPoint() @@ -28,6 +29,7 @@ public function testSfGetAddPoint() /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testSfGetAddPointWithMinus() diff --git a/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetBasisCountTest.php b/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetBasisCountTest.php index 787aa760ab..634835e670 100644 --- a/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetBasisCountTest.php +++ b/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetBasisCountTest.php @@ -59,7 +59,7 @@ public function testSfGetBasisCount_baseinfoのデータが2行の場合_2を返 $baseinfo = [ 'id' => 2, 'update_date' => 'CURRENT_TIMESTAMP', - ]; + ]; $this->objQuery->insert('dtb_baseinfo', $baseinfo); $this->expected = 2; $this->actual = $this->helper->sfGetBasisCount(); diff --git a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php index 3845d6c618..9473eea828 100755 --- a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php +++ b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php @@ -32,7 +32,7 @@ protected function setUpKiyaku() 'create_date' => '2000-01-01 00:00:00', 'update_date' => '2000-01-01 00:00:00', 'del_flg' => '0', - ], + ], [ 'kiyaku_id' => '1001', 'kiyaku_title' => 'test2', @@ -42,7 +42,7 @@ protected function setUpKiyaku() 'create_date' => '2000-01-01 00:00:00', 'update_date' => '2000-01-01 00:00:00', 'del_flg' => '0', - ], + ], [ 'kiyaku_id' => '1002', 'kiyaku_title' => 'test3', @@ -52,8 +52,8 @@ protected function setUpKiyaku() 'create_date' => '2000-01-01 00:00:00', 'update_date' => '2000-01-01 00:00:00', 'del_flg' => '1', - ], - ]; + ], + ]; $this->objQuery->delete('dtb_kiyaku'); foreach ($kiyaku as $key => $item) { diff --git a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getKiyakuTest.php b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getKiyakuTest.php index 728d7c3095..7b53289489 100644 --- a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getKiyakuTest.php +++ b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getKiyakuTest.php @@ -34,7 +34,7 @@ public function testgetKiyakuTest規約情報を取得できた場合規約のar 'create_date' => '2000-01-01 00:00:00', 'update_date' => '2000-01-01 00:00:00', 'del_flg' => '0', - ]; + ]; $this->actual = $this->objKiyaku->getKiyaku($kiyaku_id, $has_deleted); $this->verify('規約詳細取得'); @@ -61,15 +61,15 @@ public function testgetKiyakuTest削除された情報を含む規約情報を $kiyaku_id = 1002; // 期待値 $this->expected = [ - 'kiyaku_id' => '1002', - 'kiyaku_title' => 'test3', - 'kiyaku_text' => 'test_text', - 'rank' => '10', - 'creator_id' => '0', - 'create_date' => '2000-01-01 00:00:00', - 'update_date' => '2000-01-01 00:00:00', - 'del_flg' => '1', - ]; + 'kiyaku_id' => '1002', + 'kiyaku_title' => 'test3', + 'kiyaku_text' => 'test_text', + 'rank' => '10', + 'creator_id' => '0', + 'create_date' => '2000-01-01 00:00:00', + 'update_date' => '2000-01-01 00:00:00', + 'del_flg' => '1', + ]; $this->actual = $this->objKiyaku->getKiyaku($kiyaku_id, $has_deleted); $this->verify('規約詳細取得'); diff --git a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getListTest.php b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getListTest.php index a493ce3af2..028d40ce93 100644 --- a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getListTest.php +++ b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getListTest.php @@ -29,18 +29,18 @@ public function testgetListTest削除した商品も含んだ一覧を取得で 'kiyaku_id' => '1000', 'kiyaku_title' => 'test1', 'kiyaku_text' => 'test_text', - ], + ], [ 'kiyaku_id' => '1001', 'kiyaku_title' => 'test2', 'kiyaku_text' => 'test_text2', - ], + ], [ 'kiyaku_id' => '1002', 'kiyaku_title' => 'test3', 'kiyaku_text' => 'test_text', - ], - ]; + ], + ]; $this->actual = $this->objKiyaku->getList($has_deleted); $this->verify('規約一覧取得'); @@ -57,13 +57,13 @@ public function testgetListTest一覧を取得できた場合削除した商品 'kiyaku_id' => '1000', 'kiyaku_title' => 'test1', 'kiyaku_text' => 'test_text', - ], + ], [ 'kiyaku_id' => '1001', 'kiyaku_title' => 'test2', 'kiyaku_text' => 'test_text2', - ], - ]; + ], + ]; $this->actual = $this->objKiyaku->getList($has_deleted); $this->verify('規約一覧取得'); diff --git a/tests/class/helper/SC_Helper_News/SC_Helper_News_TestBase.php b/tests/class/helper/SC_Helper_News/SC_Helper_News_TestBase.php index 6bab18076f..068526078a 100644 --- a/tests/class/helper/SC_Helper_News/SC_Helper_News_TestBase.php +++ b/tests/class/helper/SC_Helper_News/SC_Helper_News_TestBase.php @@ -48,37 +48,37 @@ protected function tearDown(): void protected function setUpNews() { $news = [ - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1001', - 'news_title' => 'ニュース情報01', - 'rank' => '1', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1001', + 'news_title' => 'ニュース情報01', + 'rank' => '1', + 'creator_id' => '1', + 'del_flg' => '0', ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1002', - 'news_title' => 'ニュース情報02', - 'rank' => '2', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1002', + 'news_title' => 'ニュース情報02', + 'rank' => '2', + 'creator_id' => '1', + 'del_flg' => '0', ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1003', - 'news_title' => 'ニュース情報03', - 'rank' => '3', - 'creator_id' => '1', - 'del_flg' => '1', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1003', + 'news_title' => 'ニュース情報03', + 'rank' => '3', + 'creator_id' => '1', + 'del_flg' => '1', ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1004', - 'news_title' => 'ニュース情報04', - 'rank' => '4', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1004', + 'news_title' => 'ニュース情報04', + 'rank' => '4', + 'creator_id' => '1', + 'del_flg' => '0', ], ]; diff --git a/tests/class/helper/SC_Helper_News/SC_Helper_News_getListTest.php b/tests/class/helper/SC_Helper_News/SC_Helper_News_getListTest.php index 0b67af39db..23a376ca16 100644 --- a/tests/class/helper/SC_Helper_News/SC_Helper_News_getListTest.php +++ b/tests/class/helper/SC_Helper_News/SC_Helper_News_getListTest.php @@ -27,35 +27,35 @@ public function testGetList削除されたニュースも含む場合全ての $has_deleted = true; $this->expected = [ - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1004', - 'news_title' => 'ニュース情報04', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1004', + 'news_title' => 'ニュース情報04', + 'creator_id' => '1', + 'del_flg' => '0', ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1003', - 'news_title' => 'ニュース情報03', - 'creator_id' => '1', - 'del_flg' => '1', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1003', + 'news_title' => 'ニュース情報03', + 'creator_id' => '1', + 'del_flg' => '1', ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1002', - 'news_title' => 'ニュース情報02', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1002', + 'news_title' => 'ニュース情報02', + 'creator_id' => '1', + 'del_flg' => '0', ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1001', - 'news_title' => 'ニュース情報01', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1001', + 'news_title' => 'ニュース情報01', + 'creator_id' => '1', + 'del_flg' => '0', ], - ]; + ]; $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); foreach ($result as $value) { $this->actual[] = Test_Utils::mapArray($value, ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); @@ -73,28 +73,28 @@ public function testGetList削除されたニュースは含まない場合削 $has_deleted = false; $this->expected = [ - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1004', - 'news_title' => 'ニュース情報04', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1004', + 'news_title' => 'ニュース情報04', + 'creator_id' => '1', + 'del_flg' => '0', ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1002', - 'news_title' => 'ニュース情報02', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1002', + 'news_title' => 'ニュース情報02', + 'creator_id' => '1', + 'del_flg' => '0', ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1001', - 'news_title' => 'ニュース情報01', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1001', + 'news_title' => 'ニュース情報01', + 'creator_id' => '1', + 'del_flg' => '0', ], - ]; + ]; $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); foreach ($result as $value) { @@ -113,11 +113,11 @@ public function testGetList表示件数1かつページ番号3の場合対象の $has_deleted = false; $this->expected = [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1001', - 'news_title' => 'ニュース情報01', - 'creator_id' => '1', - 'del_flg' => '0', + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1001', + 'news_title' => 'ニュース情報01', + 'creator_id' => '1', + 'del_flg' => '0', ]; $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); @@ -135,11 +135,11 @@ public function testGetList表示件数1かつページ番号0の場合対象の $has_deleted = false; $this->expected = [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1004', - 'news_title' => 'ニュース情報04', - 'creator_id' => '1', - 'del_flg' => '0', + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1004', + 'news_title' => 'ニュース情報04', + 'creator_id' => '1', + 'del_flg' => '0', ]; $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); diff --git a/tests/class/helper/SC_Helper_News/SC_Helper_News_getNewsTest.php b/tests/class/helper/SC_Helper_News/SC_Helper_News_getNewsTest.php index a630d1c7f5..1e9b202e3b 100644 --- a/tests/class/helper/SC_Helper_News/SC_Helper_News_getNewsTest.php +++ b/tests/class/helper/SC_Helper_News/SC_Helper_News_getNewsTest.php @@ -36,11 +36,11 @@ public function testGet存在するニュースIDを指定した場合対応す $news_id = '1001'; $this->expected = [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1001', - 'news_title' => 'ニュース情報01', - 'creator_id' => '1', - 'del_flg' => '0', + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1001', + 'news_title' => 'ニュース情報01', + 'creator_id' => '1', + 'del_flg' => '0', ]; $result = $this->objNews->getNews($news_id); diff --git a/tests/class/helper/SC_Helper_News/SC_Helper_News_saveNewsTest.php b/tests/class/helper/SC_Helper_News/SC_Helper_News_saveNewsTest.php index d92ca149a8..84daa002b8 100644 --- a/tests/class/helper/SC_Helper_News/SC_Helper_News_saveNewsTest.php +++ b/tests/class/helper/SC_Helper_News/SC_Helper_News_saveNewsTest.php @@ -60,19 +60,19 @@ public function testSaveNewsTestNewsIdが存在する場合対象のニュース $this->setUpNews(); $sqlval = [ - 'news_id' => '1002', - 'news_title' => 'ニュース情報05更新', - 'creator_id' => '1', - 'del_flg' => '0', - ]; + 'news_id' => '1002', + 'news_title' => 'ニュース情報05更新', + 'creator_id' => '1', + 'del_flg' => '0', + ]; $this->expected['count'] = '4'; $this->expected['content'] = [ - 'news_id' => '1002', - 'news_title' => 'ニュース情報05更新', - 'creator_id' => '1', - 'del_flg' => '0', - ]; + 'news_id' => '1002', + 'news_title' => 'ニュース情報05更新', + 'creator_id' => '1', + 'del_flg' => '0', + ]; $ret_id = $this->objNews->saveNews($sqlval); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php index 1f8c90db38..e0ac78e25d 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php @@ -60,29 +60,29 @@ protected function setUpShipping($shipping) protected function getSingleShipping() { return [ - '00001' => [ - 'shipment_id' => '00001', - 'shipment_item' => '商品1', - 'shipping_pref' => '東京都', ], - ]; + '00001' => [ + 'shipment_id' => '00001', + 'shipment_item' => '商品1', + 'shipping_pref' => '東京都', ], + ]; } protected function getMultipleShipping() { return [ - '00001' => [ - 'shipment_id' => '00001', - 'shipment_item' => ['商品1'], - 'shipping_pref' => '東京都', ], - '00002' => [ - 'shipment_id' => '00002', - 'shipment_item' => ['商品2'], - 'shipping_pref' => '沖縄県', ], - '00003' => [ - 'shipment_id' => '00003', - 'shipment_item' => [], - 'shipping_pref' => '埼玉県', ], - ]; + '00001' => [ + 'shipment_id' => '00001', + 'shipment_item' => ['商品1'], + 'shipping_pref' => '東京都', ], + '00002' => [ + 'shipment_id' => '00002', + 'shipment_item' => ['商品2'], + 'shipping_pref' => '沖縄県', ], + '00003' => [ + 'shipment_id' => '00003', + 'shipment_item' => [], + 'shipping_pref' => '埼玉県', ], + ]; } /** @@ -91,28 +91,28 @@ protected function getMultipleShipping() protected function setUpShippingOnDb() { $shippings = [ - [ - 'update_date' => '2000-01-01 00:00:00', - 'shipping_id' => '1', - 'order_id' => '1001', - 'shipping_name01' => '配送情報01', - 'shipping_date' => '2012-01-12', - ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'shipping_id' => '2', - 'order_id' => '2', - 'shipping_name01' => '配送情報02', - 'shipping_date' => '2011-10-01', - ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'shipping_id' => '1002', - 'order_id' => '1002', - 'shipping_time' => '午後', - 'time_id' => '1', - ], - ]; + [ + 'update_date' => '2000-01-01 00:00:00', + 'shipping_id' => '1', + 'order_id' => '1001', + 'shipping_name01' => '配送情報01', + 'shipping_date' => '2012-01-12', + ], + [ + 'update_date' => '2000-01-01 00:00:00', + 'shipping_id' => '2', + 'order_id' => '2', + 'shipping_name01' => '配送情報02', + 'shipping_date' => '2011-10-01', + ], + [ + 'update_date' => '2000-01-01 00:00:00', + 'shipping_id' => '1002', + 'order_id' => '1002', + 'shipping_time' => '午後', + 'time_id' => '1', + ], + ]; $this->objQuery->delete('dtb_shipping'); foreach ($shippings as $key => $item) { @@ -126,24 +126,24 @@ protected function setUpShippingOnDb() protected function setUpOrder($customer_ids = [], $product_class_ids = []) { $orders = [ - [ - 'update_date' => '2000-01-01 00:00:00', - 'customer_id' => $customer_ids[0], - 'order_name01' => '受注情報01', - 'status' => '3', - 'payment_date' => '2032-12-31 01:20:30', // 日付が変わっても良いように、遠い未来に設定 - 'use_point' => '10', - 'add_point' => '20', - ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'customer_id' => $customer_ids[1], - 'order_name01' => '受注情報02', - 'status' => '5', - 'use_point' => '10', - 'add_point' => '20', - ], - ]; + [ + 'update_date' => '2000-01-01 00:00:00', + 'customer_id' => $customer_ids[0], + 'order_name01' => '受注情報01', + 'status' => '3', + 'payment_date' => '2032-12-31 01:20:30', // 日付が変わっても良いように、遠い未来に設定 + 'use_point' => '10', + 'add_point' => '20', + ], + [ + 'update_date' => '2000-01-01 00:00:00', + 'customer_id' => $customer_ids[1], + 'order_name01' => '受注情報02', + 'status' => '5', + 'use_point' => '10', + 'add_point' => '20', + ], + ]; $this->objQuery->delete('dtb_order'); @@ -173,8 +173,8 @@ protected function setUpCustomer() $this->objQuery->delete('dtb_customer'); return [ - $this->objGenerator->createCustomer(null, ['point' => 100]), - $this->objGenerator->createCustomer(null, ['point' => 200]), - ]; + $this->objGenerator->createCustomer(null, ['point' => 100]), + $this->objGenerator->createCustomer(null, ['point' => 200]), + ]; } } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_cancelOrderTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_cancelOrderTest.php index 963dc70bf7..151bb78c6e 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_cancelOrderTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_cancelOrderTest.php @@ -67,22 +67,22 @@ public function testCancelOrderデフォルトの引数で呼び出した場合 }, $this->arrProductsClasses) ); $this->expected = [ - 'testResult' => [ - 'registerOrder' => [ - 'order_id' => '1001', - 'params' => [ - 'status' => ORDER_CANCEL, - ], - ], - 'getOrderDetail' => [ - 'order_id' => '1001', - ], - ], - 'productClass' => array_map(function ($productsClass) { - return ['stock' => $productsClass['stock']]; - }, $this->arrProductsClasses - ), - ]; + 'testResult' => [ + 'registerOrder' => [ + 'order_id' => '1001', + 'params' => [ + 'status' => ORDER_CANCEL, + ], + ], + 'getOrderDetail' => [ + 'order_id' => '1001', + ], + ], + 'productClass' => array_map(function ($productsClass) { + return ['stock' => $productsClass['stock']]; + }, $this->arrProductsClasses + ), + ]; $this->verify(); } @@ -102,22 +102,22 @@ public function testCancelOrderトランザクションが開始していない }, $this->arrProductsClasses) ); $this->expected = [ - 'testResult' => [ - 'registerOrder' => [ - 'order_id' => '1001', - 'params' => [ - 'status' => ORDER_NEW, - ], - ], - 'getOrderDetail' => [ - 'order_id' => '1001', - ], - ], - 'productClass' => array_map(function ($productsClass) { - return ['stock' => $productsClass['stock']]; - }, $this->arrProductsClasses - ), - ]; + 'testResult' => [ + 'registerOrder' => [ + 'order_id' => '1001', + 'params' => [ + 'status' => ORDER_NEW, + ], + ], + 'getOrderDetail' => [ + 'order_id' => '1001', + ], + ], + 'productClass' => array_map(function ($productsClass) { + return ['stock' => $productsClass['stock']]; + }, $this->arrProductsClasses + ), + ]; $this->verify(); } @@ -137,23 +137,23 @@ public function testCancelOrder削除フラグが立っている場合DB更新 }, $this->arrProductsClasses) ); $this->expected = [ - 'testResult' => [ - 'registerOrder' => [ - 'order_id' => '1001', - 'params' => [ - 'status' => ORDER_DELIV, - 'del_flg' => '1', - ], - ], - 'getOrderDetail' => [ - 'order_id' => '1001', - ], - ], - 'productClass' => array_map(function ($productsClass) { - return ['stock' => $productsClass['stock']]; - }, $this->arrProductsClasses - ), - ]; + 'testResult' => [ + 'registerOrder' => [ + 'order_id' => '1001', + 'params' => [ + 'status' => ORDER_DELIV, + 'del_flg' => '1', + ], + ], + 'getOrderDetail' => [ + 'order_id' => '1001', + ], + ], + 'productClass' => array_map(function ($productsClass) { + return ['stock' => $productsClass['stock']]; + }, $this->arrProductsClasses + ), + ]; $this->verify(); } @@ -166,26 +166,26 @@ class SC_Helper_Purchase_cancelOrderMock extends SC_Helper_Purchase public static function registerOrder($order_id, $params) { $_SESSION['testResult']['registerOrder'] = [ - 'order_id' => $order_id, - 'params' => $params, - ]; + 'order_id' => $order_id, + 'params' => $params, + ]; } public static function getOrderDetail($order_id, $has_order_status = true) { $_SESSION['testResult']['getOrderDetail'] = [ - 'order_id' => $order_id, - ]; + 'order_id' => $order_id, + ]; return [ - [ - 'product_class_id' => '1001', - 'quantity' => '5', - ], - [ - 'product_class_id' => '1002', - 'quantity' => '1', - ], - ]; + [ + 'product_class_id' => '1001', + 'quantity' => '5', + ], + [ + 'product_class_id' => '1002', + 'quantity' => '1', + ], + ]; } } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_cleanupSessionTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_cleanupSessionTest.php index 6ac2ffc4c6..07fb099632 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_cleanupSessionTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_cleanupSessionTest.php @@ -68,12 +68,12 @@ public function testCleanupSessionカートとセッションの配送情報が $helper->cleanupSession(1001, $cartSession, $customer, PRODUCT_TYPE_NORMAL); $this->expected = [ - 'cart_max_deleted' => 0, - 'cart_max_notdeleted' => 1, - 'uniqid' => '', - 'shipping' => null, - 'multiple_temp' => null, - ]; + 'cart_max_deleted' => 0, + 'cart_max_notdeleted' => 1, + 'uniqid' => '', + 'shipping' => null, + 'multiple_temp' => null, + ]; $this->actual['cart_max_deleted'] = $cartSession->getMax(PRODUCT_TYPE_NORMAL); $this->actual['cart_max_notdeleted'] = $cartSession->getMax(PRODUCT_TYPE_DOWNLOAD); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_completeOrderTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_completeOrderTest.php index 2be95d5db5..a4be2e13d1 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_completeOrderTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_completeOrderTest.php @@ -51,11 +51,11 @@ protected function setUp(): void $_SESSION['cartKey'] = '1'; $_SESSION['site'] = [ - 'pre_page' => 'pre', - 'now_page' => 'now', - 'regist_success' => true, - 'uniqid' => $this->order_temp_ids[0], - ]; + 'pre_page' => 'pre', + 'now_page' => 'now', + 'regist_success' => true, + 'uniqid' => $this->order_temp_ids[0], + ]; $this->helper = new SC_Helper_Purchase_completeOrderMock(); } @@ -73,32 +73,32 @@ public function testCompleteOrder顧客IDが指定されている場合購入日 $this->helper->completeOrder(ORDER_DELIV); $this->expected = [ - 'verifyChangeCart' => [ - 'uniqId' => $this->order_temp_ids[0], - ], - 'getOrderTemp' => [ - 'uniqId' => $this->order_temp_ids[0], - ], - 'registerOrderComplete' => [ - 'order_temp_id' => $this->order_temp_ids[0], - 'status' => ORDER_DELIV, - 'cartKey' => '1', - ], - 'registerShipmentItem' => [ - [ - 'order_id' => $this->order_ids[0], - 'shipping_id' => '00001', - 'shipment_item' => '商品1', - ], - ], - 'registerShipping' => [ - 'order_id' => $this->order_ids[0], - ], - 'cleanupSession' => [ - 'order_id' => $this->order_ids[0], - 'cartKey' => '1', - ], - ]; + 'verifyChangeCart' => [ + 'uniqId' => $this->order_temp_ids[0], + ], + 'getOrderTemp' => [ + 'uniqId' => $this->order_temp_ids[0], + ], + 'registerOrderComplete' => [ + 'order_temp_id' => $this->order_temp_ids[0], + 'status' => ORDER_DELIV, + 'cartKey' => '1', + ], + 'registerShipmentItem' => [ + [ + 'order_id' => $this->order_ids[0], + 'shipping_id' => '00001', + 'shipment_item' => '商品1', + ], + ], + 'registerShipping' => [ + 'order_id' => $this->order_ids[0], + ], + 'cleanupSession' => [ + 'order_id' => $this->order_ids[0], + 'cartKey' => '1', + ], + ]; $this->actual = $_SESSION['testResult']; $this->verify('適切なfunctionが呼ばれている'); $last_buy_date = $this->objQuery->get('last_buy_date', 'dtb_customer', 'customer_id = ?', $this->customer_ids[1]); @@ -110,32 +110,32 @@ public function testCompleteOrder顧客IDが指定されていない場合特に $this->helper->completeOrder(); // デフォルトのステータス(NEW) $this->expected = [ - 'verifyChangeCart' => [ - 'uniqId' => $this->order_temp_ids[0], - ], - 'getOrderTemp' => [ - 'uniqId' => $this->order_temp_ids[0], - ], - 'registerOrderComplete' => [ - 'order_temp_id' => $this->order_temp_ids[0], - 'status' => ORDER_NEW, - 'cartKey' => '1', - ], - 'registerShipmentItem' => [ - [ - 'order_id' => (string) $this->order_ids[0], - 'shipping_id' => '00001', - 'shipment_item' => '商品1', - ], - ], - 'registerShipping' => [ - 'order_id' => (string) $this->order_ids[0], - ], - 'cleanupSession' => [ - 'order_id' => (string) $this->order_ids[0], - 'cartKey' => '1', - ], - ]; + 'verifyChangeCart' => [ + 'uniqId' => $this->order_temp_ids[0], + ], + 'getOrderTemp' => [ + 'uniqId' => $this->order_temp_ids[0], + ], + 'registerOrderComplete' => [ + 'order_temp_id' => $this->order_temp_ids[0], + 'status' => ORDER_NEW, + 'cartKey' => '1', + ], + 'registerShipmentItem' => [ + [ + 'order_id' => (string) $this->order_ids[0], + 'shipping_id' => '00001', + 'shipment_item' => '商品1', + ], + ], + 'registerShipping' => [ + 'order_id' => (string) $this->order_ids[0], + ], + 'cleanupSession' => [ + 'order_id' => (string) $this->order_ids[0], + 'cartKey' => '1', + ], + ]; $this->actual = $_SESSION['testResult']; $this->verify('適切なfunctionが呼ばれている'); } @@ -160,10 +160,10 @@ public static function getOrderTemp($uniqId) public function registerOrderComplete($orderTemp, &$objCartSession, $cartKey) { $_SESSION['testResult']['registerOrderComplete'] = [ - 'order_temp_id' => $orderTemp['order_temp_id'], - 'status' => $orderTemp['status'], - 'cartKey' => $cartKey, - ]; + 'order_temp_id' => $orderTemp['order_temp_id'], + 'status' => $orderTemp['status'], + 'cartKey' => $cartKey, + ]; return parent::registerOrderComplete($orderTemp, $objCartSession, $cartKey); } @@ -171,24 +171,24 @@ public function registerOrderComplete($orderTemp, &$objCartSession, $cartKey) public static function registerShipmentItem($order_id, $shipping_id, $shipment_item) { $_SESSION['testResult']['registerShipmentItem'][] = [ - 'order_id' => $order_id, - 'shipping_id' => $shipping_id, - 'shipment_item' => $shipment_item, - ]; + 'order_id' => $order_id, + 'shipping_id' => $shipping_id, + 'shipment_item' => $shipment_item, + ]; } public static function registerShipping($order_id, $shipping_temp, $convert_shipping_date = true) { $_SESSION['testResult']['registerShipping'] = [ - 'order_id' => $order_id, - ]; + 'order_id' => $order_id, + ]; } public static function cleanupSession($order_id, &$objCartSesion, &$objCustomer, $cartKey) { $_SESSION['testResult']['cleanupSession'] = [ - 'order_id' => $order_id, - 'cartKey' => $cartKey, - ]; + 'order_id' => $order_id, + 'cartKey' => $cartKey, + ]; } } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromCustomerTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromCustomerTest.php index ff77aa4584..4dbfbed38b 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromCustomerTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromCustomerTest.php @@ -92,31 +92,31 @@ public function testCopyFromCustomerモバイルの場合モバイルのメー $this->customer->setValue('email_mobile', 'mobile@example.com'); $this->expected = [ - 'order_name01' => '姓01', - 'order_name02' => '名01', - 'order_kana01' => 'セイ01', - 'order_kana02' => 'メイ01', - 'order_sex' => '1', - 'order_zip01' => '123', - 'order_zip02' => '4567', - 'order_pref' => '東京都', - 'order_addr01' => 'abc市', - 'order_addr02' => 'def町', - 'order_tel01' => '01', - 'order_tel02' => '234', - 'order_tel03' => '5678', - 'order_fax01' => '02', - 'order_fax02' => '345', - 'order_fax03' => '6789', - 'order_job' => '会社員', - 'order_birth' => '2012-01-01', - 'order_email' => 'mobile@example.com', - 'customer_id' => '1001', - 'update_date' => 'CURRENT_TIMESTAMP', - 'order_country_id' => '', - 'order_company_name' => '', - 'order_zipcode' => '', - ]; + 'order_name01' => '姓01', + 'order_name02' => '名01', + 'order_kana01' => 'セイ01', + 'order_kana02' => 'メイ01', + 'order_sex' => '1', + 'order_zip01' => '123', + 'order_zip02' => '4567', + 'order_pref' => '東京都', + 'order_addr01' => 'abc市', + 'order_addr02' => 'def町', + 'order_tel01' => '01', + 'order_tel02' => '234', + 'order_tel03' => '5678', + 'order_fax01' => '02', + 'order_fax02' => '345', + 'order_fax03' => '6789', + 'order_job' => '会社員', + 'order_birth' => '2012-01-01', + 'order_email' => 'mobile@example.com', + 'customer_id' => '1001', + 'update_date' => 'CURRENT_TIMESTAMP', + 'order_country_id' => '', + 'order_company_name' => '', + 'order_zipcode' => '', + ]; $helper = new SC_Helper_Purchase_Ex(); $helper->copyFromCustomer($dest, $this->customer); $this->actual = $dest; @@ -134,11 +134,11 @@ public function testCopyFromCustomerモバイルかつモバイルのメール User_Utils::setDeviceType(DEVICE_TYPE_MOBILE); $this->expected = [ - 'order_name01' => '姓01', - 'order_email' => 'test@example.com', - 'customer_id' => '1001', - 'update_date' => 'CURRENT_TIMESTAMP', - ]; + 'order_name01' => '姓01', + 'order_email' => 'test@example.com', + 'customer_id' => '1001', + 'update_date' => 'CURRENT_TIMESTAMP', + ]; $helper = new SC_Helper_Purchase_Ex(); $helper->copyFromCustomer($dest, $this->customer, $prefix, $keys); $this->actual = $dest; @@ -157,11 +157,11 @@ public function testCopyFromCustomerモバイルでない場合通常のメー $this->customer->setValue('email_mobile', 'mobile@example.com'); $this->expected = [ - 'prefix_name01' => '姓01', - 'prefix_email' => 'test@example.com', - 'customer_id' => '1001', - 'update_date' => 'CURRENT_TIMESTAMP', - ]; + 'prefix_name01' => '姓01', + 'prefix_email' => 'test@example.com', + 'customer_id' => '1001', + 'update_date' => 'CURRENT_TIMESTAMP', + ]; $helper = new SC_Helper_Purchase_Ex(); $helper->copyFromCustomer($dest, $this->customer, $prefix, $keys); $this->actual = $dest; diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromOrderTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromOrderTest.php index 7f006732d6..96423f5440 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromOrderTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromOrderTest.php @@ -48,42 +48,42 @@ public function testCopyFromOrder全てデフォルト設定にした場合デ { $dest = []; $src = [ - 'order_name01' => '姓', - 'order_name02' => '名', - 'order_kana01' => 'セイ', - 'order_kana02' => 'メイ', - 'order_sex' => '1', - 'order_zip01' => '012', - 'order_zip02' => '1234', - 'order_pref' => '北海道', - 'order_addr01' => '住所01', - 'order_addr02' => '住所02', - 'order_tel01' => '01', - 'order_tel02' => '1234', - 'order_tel03' => '5678', - 'order_fax01' => '02', - 'order_fax02' => '2345', - 'order_fax03' => '6789', - ]; + 'order_name01' => '姓', + 'order_name02' => '名', + 'order_kana01' => 'セイ', + 'order_kana02' => 'メイ', + 'order_sex' => '1', + 'order_zip01' => '012', + 'order_zip02' => '1234', + 'order_pref' => '北海道', + 'order_addr01' => '住所01', + 'order_addr02' => '住所02', + 'order_tel01' => '01', + 'order_tel02' => '1234', + 'order_tel03' => '5678', + 'order_fax01' => '02', + 'order_fax02' => '2345', + 'order_fax03' => '6789', + ]; $this->expected = [ - 'shipping_name01' => '姓', - 'shipping_name02' => '名', - 'shipping_kana01' => 'セイ', - 'shipping_kana02' => 'メイ', - 'shipping_sex' => '1', - 'shipping_zip01' => '012', - 'shipping_zip02' => '1234', - 'shipping_pref' => '北海道', - 'shipping_addr01' => '住所01', - 'shipping_addr02' => '住所02', - 'shipping_tel01' => '01', - 'shipping_tel02' => '1234', - 'shipping_tel03' => '5678', - 'shipping_fax01' => '02', - 'shipping_fax02' => '2345', - 'shipping_fax03' => '6789', - ]; + 'shipping_name01' => '姓', + 'shipping_name02' => '名', + 'shipping_kana01' => 'セイ', + 'shipping_kana02' => 'メイ', + 'shipping_sex' => '1', + 'shipping_zip01' => '012', + 'shipping_zip02' => '1234', + 'shipping_pref' => '北海道', + 'shipping_addr01' => '住所01', + 'shipping_addr02' => '住所02', + 'shipping_tel01' => '01', + 'shipping_tel02' => '1234', + 'shipping_tel03' => '5678', + 'shipping_fax01' => '02', + 'shipping_fax02' => '2345', + 'shipping_fax03' => '6789', + ]; $helper = new SC_Helper_Purchase_Ex(); $helper->copyFromOrder($dest, $src); $this->actual = $dest; @@ -95,15 +95,15 @@ public function testCopyFromOrder接頭辞・キーを設定した場合指定 { $dest = []; $src = [ - 'input_name01' => '姓', - 'input_name02' => '名', - 'input_zip01' => '012', // キーに含まれないもの - ]; + 'input_name01' => '姓', + 'input_name02' => '名', + 'input_zip01' => '012', // キーに含まれないもの + ]; $this->expected = [ - 'output_name01' => '姓', - 'output_name02' => '名', - ]; + 'output_name01' => '姓', + 'output_name02' => '名', + ]; $helper = new SC_Helper_Purchase_Ex(); $helper->copyFromOrder($dest, $src, 'output', 'input', ['name01', 'name02']); $this->actual = $dest; diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_extractShippingTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_extractShippingTest.php index d0a16df7b8..84a550d495 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_extractShippingTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_extractShippingTest.php @@ -49,17 +49,17 @@ public function testExtractShipping予め指定されたキーだけが抽出さ $helper = new SC_Helper_Purchase_Ex(); $helper->arrShippingKey = ['id', 'name', 'code']; $arrSrc = [ - 'shipping_id' => '1001', - 'shipping_code' => 'cd1001', - 'shipping_detail' => 'dt1001', // 無視される - 'shipping_name' => '名称1001', - ]; + 'shipping_id' => '1001', + 'shipping_code' => 'cd1001', + 'shipping_detail' => 'dt1001', // 無視される + 'shipping_name' => '名称1001', + ]; $this->expected = [ - 'shipping_id' => '1001', - 'shipping_name' => '名称1001', - 'shipping_code' => 'cd1001', - ]; + 'shipping_id' => '1001', + 'shipping_name' => '名称1001', + 'shipping_code' => 'cd1001', + ]; $this->actual = $helper->extractShipping($arrSrc); $this->verify(); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderDetailTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderDetailTest.php index c91b7f37ad..fdbab92fef 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderDetailTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderDetailTest.php @@ -64,10 +64,10 @@ public function testGetOrderDetail存在しない受注IDを指定した場合 public function testGetOrderDetail存在する受注IDを指定した場合対応する受注詳細情報が取得できる() { $properties = [ - 'product_id', 'product_class_id', 'product_type_id', 'product_code', - 'product_name', 'classcategory_name1', 'classcategory_name2', 'price', - 'quantity', 'point_rate', 'status', 'payment_date', 'enable', 'effective', - 'tax_rate', 'tax_rule', ]; + 'product_id', 'product_class_id', 'product_type_id', 'product_code', + 'product_name', 'classcategory_name1', 'classcategory_name2', 'price', + 'quantity', 'point_rate', 'status', 'payment_date', 'enable', 'effective', + 'tax_rate', 'tax_rule', ]; $this->objQuery->setOrder('order_detail_id'); $arrOrderDetails = $this->objQuery->select('*', 'dtb_order_detail T1 JOIN dtb_order T2 ON T1.order_id = T2.order_id', 'T1.order_id = ?', [$this->order_ids[0]]); @@ -101,10 +101,10 @@ public function testGetOrderDetail存在する受注IDを指定した場合対 public function testGetOrderDetailステータス取得フラグがOFFのの場合ステータス以外の情報が取得できる() { $properties = [ - 'product_id', 'product_class_id', 'product_type_id', 'product_code', - 'product_name', 'classcategory_name1', 'classcategory_name2', 'price', - 'quantity', 'point_rate', 'enable', 'effective', - 'tax_rate', 'tax_rule', ]; + 'product_id', 'product_class_id', 'product_type_id', 'product_code', + 'product_name', 'classcategory_name1', 'classcategory_name2', 'price', + 'quantity', 'point_rate', 'enable', 'effective', + 'tax_rate', 'tax_rule', ]; $this->objQuery->setOrder('order_detail_id'); $arrOrderDetails = $this->objQuery->select('*', 'dtb_order_detail T1 JOIN dtb_order T2 ON T1.order_id = T2.order_id', 'T1.order_id = ?', [$this->order_ids[0]]); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTempTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTempTest.php index ba100a8433..bc318c6f61 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTempTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTempTest.php @@ -70,10 +70,10 @@ public function testGetOrderTemp存在する受注IDを指定した場合対応 $arrCustomer = $this->objQuery->getRow('*', 'dtb_customer', 'customer_id = ?', [$this->customer_ids[0]]); $this->expected = [ - 'order_temp_id' => $order_temp_id, - 'customer_id' => $this->customer_ids[0], - 'order_name01' => $arrCustomer['name01'], - ]; + 'order_temp_id' => $order_temp_id, + 'customer_id' => $this->customer_ids[0], + 'order_name01' => $arrCustomer['name01'], + ]; $result = SC_Helper_Purchase::getOrderTemp($order_temp_id); $this->actual = Test_Utils::mapArray($result, ['order_temp_id', 'customer_id', 'order_name01']); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTest.php index 8a347979db..cb11252cce 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTest.php @@ -77,10 +77,10 @@ public function testGetOrder顧客IDを指定しなかった場合受注IDに対 $order_id = $this->order_ids[1]; $this->expected = [ - 'order_id' => $order_id, - 'customer_id' => $this->customer_ids[1], - 'order_name01' => '受注情報02', - ]; + 'order_id' => $order_id, + 'customer_id' => $this->customer_ids[1], + 'order_name01' => '受注情報02', + ]; $result = SC_Helper_Purchase::getOrder($order_id); $this->actual = Test_Utils::mapArray($result, ['order_id', 'customer_id', 'order_name01']); @@ -93,10 +93,10 @@ public function testGetOrder存在する顧客IDを指定した場合対応す $customer_id = $this->customer_ids[1]; $this->expected = [ - 'order_id' => $order_id, - 'customer_id' => $customer_id, - 'order_name01' => '受注情報02', - ]; + 'order_id' => $order_id, + 'customer_id' => $customer_id, + 'order_name01' => '受注情報02', + ]; $result = SC_Helper_Purchase::getOrder($order_id, $customer_id); $this->actual = Test_Utils::mapArray($result, ['order_id', 'customer_id', 'order_name01']); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShipmentItemsTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShipmentItemsTest.php index 3205bcccda..6712111536 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShipmentItemsTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShipmentItemsTest.php @@ -81,30 +81,30 @@ public function testGetShipmentItems存在する受注IDと配送先IDを指定 $this->expected['count'] = 2; $this->expected['second'] = [ - 'order_id' => (string) $order_id, - 'shipping_id' => '0', - 'product_class_id' => '2', - 'product_name' => 'アイスクリーム', - 'price' => '1008', - 'productsClass' => ['product_class_id' => '2', 'product_id' => '1'], - ]; + 'order_id' => (string) $order_id, + 'shipping_id' => '0', + 'product_class_id' => '2', + 'product_name' => 'アイスクリーム', + 'price' => '1008', + 'productsClass' => ['product_class_id' => '2', 'product_id' => '1'], + ]; $this->expected['first'] = [ - 'order_id' => (string) $order_id, - 'shipping_id' => '0', - 'product_class_id' => '1', - 'product_name' => 'アイスクリーム', - 'price' => '1008', - 'productsClass' => ['product_class_id' => '1', 'product_id' => '1'], - ]; + 'order_id' => (string) $order_id, + 'shipping_id' => '0', + 'product_class_id' => '1', + 'product_name' => 'アイスクリーム', + 'price' => '1008', + 'productsClass' => ['product_class_id' => '1', 'product_id' => '1'], + ]; $result = SC_Helper_Purchase::getShipmentItems($order_id, $shipping_id); $this->actual['count'] = count($result); $this->actual['first'] = Test_Utils::mapArray($result[0], [ - 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', ]); + 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', ]); $this->actual['first']['productsClass'] = Test_Utils::mapArray($this->actual['first']['productsClass'], ['product_class_id', 'product_id']); $this->actual['second'] = Test_Utils::mapArray($result[1], [ - 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', ]); + 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', ]); $this->actual['second']['productsClass'] = Test_Utils::mapArray($this->actual['second']['productsClass'], ['product_class_id', 'product_id']); $this->verify('配送情報'); } @@ -116,28 +116,28 @@ public function testGetShipmentItems詳細フラグをOFFにした場合結果 $this->expected['count'] = 2; $this->expected['second'] = [ - 'order_id' => (string) $order_id, - 'shipping_id' => '0', - 'product_class_id' => '2', - 'product_name' => 'アイスクリーム', - 'price' => '1008', - 'productsClass' => null, - ]; + 'order_id' => (string) $order_id, + 'shipping_id' => '0', + 'product_class_id' => '2', + 'product_name' => 'アイスクリーム', + 'price' => '1008', + 'productsClass' => null, + ]; $this->expected['first'] = [ - 'order_id' => (string) $order_id, - 'shipping_id' => '0', - 'product_class_id' => '1', - 'product_name' => 'アイスクリーム', - 'price' => '1008', - 'productsClass' => null, - ]; + 'order_id' => (string) $order_id, + 'shipping_id' => '0', + 'product_class_id' => '1', + 'product_name' => 'アイスクリーム', + 'price' => '1008', + 'productsClass' => null, + ]; $result = SC_Helper_Purchase::getShipmentItems($order_id, $shipping_id, false); $this->actual['count'] = count($result); $this->actual['first'] = Test_Utils::mapArray($result[0], [ - 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', ]); + 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', ]); $this->actual['second'] = Test_Utils::mapArray($result[1], [ - 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', ]); + 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', ]); $this->verify('配送情報'); } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingTempTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingTempTest.php index a625c6775a..2897f9fcdc 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingTempTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingTempTest.php @@ -59,15 +59,15 @@ public function testGetShippingTemp保有フラグがONの場合商品のある $this->setUpShipping($this->getMultipleShipping()); $this->expected = [ - '00001' => [ - 'shipment_id' => '00001', - 'shipment_item' => ['商品1'], - 'shipping_pref' => '東京都', ], - '00002' => [ - 'shipment_id' => '00002', - 'shipment_item' => ['商品2'], - 'shipping_pref' => '沖縄県', ], - ]; + '00001' => [ + 'shipment_id' => '00001', + 'shipment_item' => ['商品1'], + 'shipping_pref' => '東京都', ], + '00002' => [ + 'shipment_id' => '00002', + 'shipment_item' => ['商品2'], + 'shipping_pref' => '沖縄県', ], + ]; $this->actual = SC_Helper_Purchase::getShippingTemp(true); $this->verify('配送情報'); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php index 6486973ae0..857513b7a9 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php @@ -68,11 +68,11 @@ public function testGetShippings存在する受注IDを指定した場合結果 $arrCustomer = $this->objQuery->getRow('*', 'dtb_customer', 'customer_id = ?', [$this->customer_ids[0]]); $this->expected['count'] = 1; $this->expected['first'] = [ - 'order_id' => (string) $order_id, - 'shipping_id' => '0', - 'shipping_name01' => $arrCustomer['name01'], - 'shipping_date' => null, - ]; + 'order_id' => (string) $order_id, + 'shipping_id' => '0', + 'shipping_name01' => $arrCustomer['name01'], + 'shipping_date' => null, + ]; $this->expected['shipment_item_count'] = 3; $helper = new SC_Helper_Purchase_Ex(); @@ -81,7 +81,7 @@ public function testGetShippings存在する受注IDを指定した場合結果 $this->actual['count'] = count($result); // shipping_idごとの配列になっているのでshipping_idで抽出 $this->actual['first'] = Test_Utils::mapArray($result[0], [ - 'order_id', 'shipping_id', 'shipping_name01', 'shipping_date', ]); + 'order_id', 'shipping_id', 'shipping_name01', 'shipping_date', ]); $this->actual['shipment_item_count'] = count($result[0]['shipment_item']); $this->verify('配送情報'); } @@ -93,11 +93,11 @@ public function testGetShippings商品取得フラグをOFFにした場合結果 $this->expected['count'] = 1; $this->expected['first'] = [ - 'order_id' => (string) $order_id, - 'shipping_id' => '0', - 'shipping_name01' => $arrCustomer['name01'], - 'shipping_date' => null, - ]; + 'order_id' => (string) $order_id, + 'shipping_id' => '0', + 'shipping_name01' => $arrCustomer['name01'], + 'shipping_date' => null, + ]; $this->expected['shipment_item_count'] = 0; $helper = new SC_Helper_Purchase_Ex(); @@ -105,7 +105,7 @@ public function testGetShippings商品取得フラグをOFFにした場合結果 $this->actual['count'] = count($result); // shipping_idごとの配列になっているのでshipping_idで抽出 $this->actual['first'] = Test_Utils::mapArray($result[0], [ - 'order_id', 'shipping_id', 'shipping_name01', 'shipping_date', ]); + 'order_id', 'shipping_id', 'shipping_name01', 'shipping_date', ]); $this->actual['shipment_item_count'] = is_array($result['1']['shipment_item']) ? count($result['1']['shipment_item']) : 0; $this->verify('配送情報'); } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderCompleteTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderCompleteTest.php index ff0e17ac97..412860357f 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderCompleteTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderCompleteTest.php @@ -61,45 +61,45 @@ public function testRegisterOrderComplete不要な変数が含まれている場 { // 引数の準備 $orderParams = [ - 'order_id' => $this->order_ids[0], - 'status' => ORDER_PAY_WAIT, - 'mail_maga_flg' => '1', - 'order_tax_rate' => '5', - 'order_tax_rule' => '1', - ]; + 'order_id' => $this->order_ids[0], + 'status' => ORDER_PAY_WAIT, + 'mail_maga_flg' => '1', + 'order_tax_rate' => '5', + 'order_tax_rule' => '1', + ]; $cartSession = new SC_CartSession_registerOrderCompleteMock(); $_SESSION['site']['uniqid'] = $this->order_temp_ids[0]; $this->helper->registerOrderComplete($orderParams, $cartSession, '1'); $this->expected = [ - 'registerOrder' => [ - 'order_id' => $this->order_ids[0], - 'status' => ORDER_PAY_WAIT, - 'mailmaga_flg' => null, - ], - 'registerOrderDetail' => [ - 'order_id' => $this->order_ids[0], - 'params' => [ - [ - 'order_id' => $this->order_ids[0], - 'product_id' => '1002', - 'product_class_id' => '1002', - 'product_name' => '製品02', - 'product_code' => 'cd1002', - 'classcategory_name1' => 'cat01', - 'classcategory_name2' => 'cat02', - 'point_rate' => '5', - 'price' => '1000', - 'quantity' => '10', - 'tax_rate' => null, - 'tax_rule' => null, - 'tax_adjust' => null, - ], - ], - ], - 'del_flg' => '1', - ]; + 'registerOrder' => [ + 'order_id' => $this->order_ids[0], + 'status' => ORDER_PAY_WAIT, + 'mailmaga_flg' => null, + ], + 'registerOrderDetail' => [ + 'order_id' => $this->order_ids[0], + 'params' => [ + [ + 'order_id' => $this->order_ids[0], + 'product_id' => '1002', + 'product_class_id' => '1002', + 'product_name' => '製品02', + 'product_code' => 'cd1002', + 'classcategory_name1' => 'cat01', + 'classcategory_name2' => 'cat02', + 'point_rate' => '5', + 'price' => '1000', + 'quantity' => '10', + 'tax_rate' => null, + 'tax_rule' => null, + 'tax_adjust' => null, + ], + ], + ], + 'del_flg' => '1', + ]; $this->actual = $_SESSION['testResult']; $this->actual['del_flg'] = $this->objQuery->get('del_flg', 'dtb_order_temp', 'order_temp_id = ?', $this->order_temp_ids[0]); @@ -110,11 +110,11 @@ public function testRegisterOrderCompleteステータスの指定がない場合 { // 引数の準備 $orderParams = [ - 'order_id' => '1001', - // 'status' => ORDER_PAY_WAIT, - 'order_tax_rate' => '5', - 'order_tax_rule' => '1', - ]; + 'order_id' => '1001', + // 'status' => ORDER_PAY_WAIT, + 'order_tax_rate' => '5', + 'order_tax_rule' => '1', + ]; $cartSession = new SC_CartSession_registerOrderCompleteMock(); $_SESSION['site']['uniqid'] = '1001'; @@ -122,12 +122,12 @@ public function testRegisterOrderCompleteステータスの指定がない場合 // 上の条件と重複する部分は確認を省略 $this->expected = [ - 'registerOrder' => [ - 'order_id' => '1001', - 'status' => ORDER_NEW, - 'mailmaga_flg' => null, - ], - ]; + 'registerOrder' => [ + 'order_id' => '1001', + 'status' => ORDER_NEW, + 'mailmaga_flg' => null, + ], + ]; $this->actual['registerOrder'] = $_SESSION['testResult']['registerOrder']; $this->verify(); @@ -141,18 +141,18 @@ class SC_Helper_Purchase_registerOrderCompleteMock extends SC_Helper_Purchase public static function registerOrder($order_id, $params) { $_SESSION['testResult']['registerOrder'] = [ - 'order_id' => $order_id, - 'status' => $params['status'], - 'mailmaga_flg' => $params['mailmaga_flg'], - ]; + 'order_id' => $order_id, + 'status' => $params['status'], + 'mailmaga_flg' => $params['mailmaga_flg'], + ]; } public static function registerOrderDetail($order_id, $params) { $_SESSION['testResult']['registerOrderDetail'] = [ - 'order_id' => $order_id, - 'params' => $params, - ]; + 'order_id' => $order_id, + 'params' => $params, + ]; } public function setUniqId() @@ -166,19 +166,19 @@ class SC_CartSession_registerOrderCompleteMock extends SC_CartSession public function getCartList($cartKey, $pref_id = 0, $country_id = 0) { return [ - [ - 'productsClass' => [ - 'product_id' => '1002', - 'product_class_id' => '1002', - 'name' => '製品02', - 'product_code' => 'cd1002', - 'classcategory_name1' => 'cat01', - 'classcategory_name2' => 'cat02', - ], - 'point_rate' => '5', - 'price' => '1000', - 'quantity' => '10', - ], - ]; + [ + 'productsClass' => [ + 'product_id' => '1002', + 'product_class_id' => '1002', + 'name' => '製品02', + 'product_code' => 'cd1002', + 'classcategory_name1' => 'cat01', + 'classcategory_name2' => 'cat02', + ], + 'point_rate' => '5', + 'price' => '1000', + 'quantity' => '10', + ], + ]; } } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderDetailTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderDetailTest.php index 90cc896aef..d878c72b75 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderDetailTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderDetailTest.php @@ -54,24 +54,24 @@ protected function tearDown(): void public function testRegisterOrderDetail該当の受注が存在する場合削除後に新しい情報が登録される() { $params = [ - [ - 'order_id' => $this->order_ids[0], - 'hoge' => '999', // DBに存在しないカラム - 'product_id' => '9001', - 'product_class_id' => '9001', - 'product_name' => '製品名9001', - ], - ]; + [ + 'order_id' => $this->order_ids[0], + 'hoge' => '999', // DBに存在しないカラム + 'product_id' => '9001', + 'product_class_id' => '9001', + 'product_name' => '製品名9001', + ], + ]; SC_Helper_Purchase::registerOrderDetail($this->order_ids[0], $params); $this->expected['count'] = '1'; $this->expected['content'] = [ - 'order_id' => $this->order_ids[0], - 'product_id' => '9001', - 'product_class_id' => '9001', - 'product_name' => '製品名9001', - 'product_code' => null, // 古いデータにはあるが、deleteされたので消えている - ]; + 'order_id' => $this->order_ids[0], + 'product_id' => '9001', + 'product_class_id' => '9001', + 'product_name' => '製品名9001', + 'product_code' => null, // 古いデータにはあるが、deleteされたので消えている + ]; $this->actual['count'] = $this->objQuery->count('dtb_order_detail', 'order_id = ?', [$this->order_ids[0]]); $this->actual['content'] = $this->objQuery->getRow( @@ -87,24 +87,24 @@ public function testRegisterOrderDetail該当の受注が存在する場合削 public function testRegisterOrderDetail該当の受注が存在しない場合新しい情報が追加登録される() { $params = [ - [ - 'order_id' => '1003', - 'hoge' => '999', // DBに存在しないカラム - 'product_id' => '9003', - 'product_class_id' => '9003', - 'product_name' => '製品名9003', - ], - ]; + [ + 'order_id' => '1003', + 'hoge' => '999', // DBに存在しないカラム + 'product_id' => '9003', + 'product_class_id' => '9003', + 'product_name' => '製品名9003', + ], + ]; SC_Helper_Purchase::registerOrderDetail('1003', $params); $this->expected['count'] = '1'; $this->expected['content'] = [ - 'order_id' => '1003', - 'product_id' => '9003', - 'product_class_id' => '9003', - 'product_name' => '製品名9003', - 'product_code' => null, - ]; + 'order_id' => '1003', + 'product_id' => '9003', + 'product_class_id' => '9003', + 'product_name' => '製品名9003', + 'product_code' => null, + ]; $this->actual['count'] = $this->objQuery->count('dtb_order_detail', 'order_id = ?', [1003]); $result = $this->objQuery->select( diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderTest.php index 0a754664ac..b86c05547e 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderTest.php @@ -67,20 +67,20 @@ public function testRegisterOrder既に受注IDが存在する場合情報が更 $this->expected = [ 'sfUpdateOrderStatus' => [ - 'order_id' => $order_id, - 'status' => '1', - 'add_point' => 10, - 'use_point' => 20, + 'order_id' => $order_id, + 'status' => '1', + 'add_point' => 10, + 'use_point' => 20, ], 'sfUpdateOrderNameCol' => $order_id, 'count' => '2', 'content' => [ - 'order_id' => $order_id, - 'customer_id' => $this->customer_ids[0], - 'status' => '1', - 'add_point' => '10', - 'use_point' => '20', - 'order_name01' => '受注情報01_更新', + 'order_id' => $order_id, + 'customer_id' => $this->customer_ids[0], + 'status' => '1', + 'add_point' => '10', + 'use_point' => '20', + 'order_name01' => '受注情報01_更新', ], ]; $this->actual = $_SESSION['testResult']; @@ -111,20 +111,20 @@ public function testRegisterOrder存在しない受注IDを指定した場合新 $this->expected = [ 'sfUpdateOrderStatus' => [ - 'order_id' => '1003', - 'status' => '2', - 'add_point' => 100, - 'use_point' => 200, + 'order_id' => '1003', + 'status' => '2', + 'add_point' => 100, + 'use_point' => 200, ], 'sfUpdateOrderNameCol' => '1003', 'count' => '3', 'content' => [ - 'order_id' => '1003', - 'customer_id' => '1003', - 'status' => null, // ここではsfUpdateOrderStatusをモックにしているので更新されない - 'add_point' => '100', - 'use_point' => '200', - 'order_name01' => '受注情報03', + 'order_id' => '1003', + 'customer_id' => '1003', + 'status' => null, // ここではsfUpdateOrderStatusをモックにしているので更新されない + 'add_point' => '100', + 'use_point' => '200', + 'order_name01' => '受注情報03', ], ]; $this->actual = $_SESSION['testResult']; diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShipmentItemTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShipmentItemTest.php index e6bd91ccab..e3ed6f7b2e 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShipmentItemTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShipmentItemTest.php @@ -57,15 +57,15 @@ public function testRegisterShipmentItem製品クラスIDが入っていない $order_id = '1'; $shipping_id = '1'; $arrParams = [ - [ - // 'product_class_id' => '1', - 'product_name' => '追加製品名01', - 'product_code' => 'newcode01', - 'classcategory_name1' => 'newcat01', - 'classcategory_name2' => 'newcat02', - 'price' => '2500', - ], - ]; + [ + // 'product_class_id' => '1', + 'product_name' => '追加製品名01', + 'product_code' => 'newcode01', + 'classcategory_name1' => 'newcat01', + 'classcategory_name2' => 'newcat02', + 'price' => '2500', + ], + ]; // 期待値の設定 $this->expected['count'] = 0; @@ -89,26 +89,26 @@ public function testRegisterShipmentItem製品名等が指定されている場 $order_id = $this->order_ids[0]; $shipping_id = '0'; $arrParams = [ - [ - 'product_class_id' => '1', - 'product_name' => '追加製品名01', - 'product_code' => 'newcode01', - 'classcategory_name1' => 'newcat01', - 'classcategory_name2' => 'newcat02', - 'price' => '2500', - ], - ]; + [ + 'product_class_id' => '1', + 'product_name' => '追加製品名01', + 'product_code' => 'newcode01', + 'classcategory_name1' => 'newcat01', + 'classcategory_name2' => 'newcat02', + 'price' => '2500', + ], + ]; // 期待値の設定 $this->expected['count'] = 1; $this->expected['first'] = [ - 'product_class_id' => '1', - 'product_name' => '追加製品名01', - 'product_code' => 'newcode01', - 'classcategory_name1' => 'newcat01', - 'classcategory_name2' => 'newcat02', - 'price' => '2500', - ]; + 'product_class_id' => '1', + 'product_name' => '追加製品名01', + 'product_code' => 'newcode01', + 'classcategory_name1' => 'newcat01', + 'classcategory_name2' => 'newcat02', + 'price' => '2500', + ]; // 対象functionの呼び出し SC_Helper_Purchase::registerShipmentItem($order_id, $shipping_id, $arrParams); @@ -131,28 +131,28 @@ public function testRegisterShipmentItem製品名等が指定されていない $order_id = $this->order_ids[0]; $shipping_id = '1'; $arrParams = [ - [ - 'product_class_id' => '1', - // 'product_name' => '追加製品名01', - // 'product_code' => 'newcode01', - // 'classcategory_name1' => 'newcat01', - // 'classcategory_name2' => 'newcat02', - // 'price' => '2500' - ], - ]; + [ + 'product_class_id' => '1', + // 'product_name' => '追加製品名01', + // 'product_code' => 'newcode01', + // 'classcategory_name1' => 'newcat01', + // 'classcategory_name2' => 'newcat02', + // 'price' => '2500' + ], + ]; // 期待値の設定 $this->expected['count'] = 1; $this->expected['first'] = [ - 'product_class_id' => '1', - 'product_name' => 'アイスクリーム', - 'product_code' => 'ice-01', - 'classcategory_name1' => '抹茶', - 'classcategory_name2' => 'S', - // TODO 要確認price01, price02を設定しても価格が取れない。実際にはDBから取るケースが無い? - // 'price' => '1500' - 'price' => null, - ]; + 'product_class_id' => '1', + 'product_name' => 'アイスクリーム', + 'product_code' => 'ice-01', + 'classcategory_name1' => '抹茶', + 'classcategory_name2' => 'S', + // TODO 要確認price01, price02を設定しても価格が取れない。実際にはDBから取るケースが無い? + // 'price' => '1500' + 'price' => null, + ]; // 対象functionの呼び出し SC_Helper_Purchase::registerShipmentItem($order_id, $shipping_id, $arrParams); @@ -174,27 +174,27 @@ public function testRegisterShipmentItemDBに存在しないカラムを指定 $order_id = '1'; $shipping_id = '1'; $arrParams = [ - [ - 'product_class_id' => '1', - 'product_name' => '追加製品名01', - 'product_code' => 'newcode01', - 'classcategory_name1' => 'newcat01', - 'classcategory_name2' => 'newcat02', - 'price' => '2500', - 'xxxx' => 'yyyyyy', // 存在しないカラム - ], - ]; + [ + 'product_class_id' => '1', + 'product_name' => '追加製品名01', + 'product_code' => 'newcode01', + 'classcategory_name1' => 'newcat01', + 'classcategory_name2' => 'newcat02', + 'price' => '2500', + 'xxxx' => 'yyyyyy', // 存在しないカラム + ], + ]; // 期待値の設定 $this->expected['count'] = 1; $this->expected['first'] = [ - 'product_class_id' => '1', - 'product_name' => '追加製品名01', - 'product_code' => 'newcode01', - 'classcategory_name1' => 'newcat01', - 'classcategory_name2' => 'newcat02', - 'price' => '2500', - ]; + 'product_class_id' => '1', + 'product_name' => '追加製品名01', + 'product_code' => 'newcode01', + 'classcategory_name1' => 'newcat01', + 'classcategory_name2' => 'newcat02', + 'price' => '2500', + ]; // 対象functionの呼び出し SC_Helper_Purchase::registerShipmentItem($order_id, $shipping_id, $arrParams); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShippingTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShippingTest.php index 238f7eaed5..af3a1549bd 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShippingTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShippingTest.php @@ -49,21 +49,21 @@ public function testRegisterShipping元々存在しない受注IDの場合新規 { $order_id = '10'; $arrParams = [ - '20' => [ - 'order_id' => '10', - 'shipping_id' => '20', - 'shipping_name01' => '配送情報10', - 'shipping_date' => '2012/01/12', - ], - ]; + '20' => [ + 'order_id' => '10', + 'shipping_id' => '20', + 'shipping_name01' => '配送情報10', + 'shipping_date' => '2012/01/12', + ], + ]; $this->expected['count'] = '4'; // 1件増える $this->expected['content'] = [ - 'order_id' => '10', - 'shipping_id' => '20', - 'shipping_name01' => '配送情報10', - 'shipping_date' => '2012-01-12 00:00:00', - ]; + 'order_id' => '10', + 'shipping_id' => '20', + 'shipping_name01' => '配送情報10', + 'shipping_date' => '2012-01-12 00:00:00', + ]; SC_Helper_Purchase::registerShipping($order_id, $arrParams); @@ -86,21 +86,21 @@ public function testRegisterShipping元々存在する受注IDの場合既存の { $order_id = '2'; $arrParams = [ - '30' => [ - 'order_id' => '2', - 'shipping_id' => '30', - 'shipping_name01' => '配送情報02-update', - 'shipping_date' => '2013/12/03', - ], - ]; + '30' => [ + 'order_id' => '2', + 'shipping_id' => '30', + 'shipping_name01' => '配送情報02-update', + 'shipping_date' => '2013/12/03', + ], + ]; $this->expected['count'] = '3'; // 件数が変わらない $this->expected['content'] = [ - 'order_id' => '2', - 'shipping_id' => '30', - 'shipping_name01' => '配送情報02-update', - 'shipping_date' => '2013-12-03 00:00:00', - ]; + 'order_id' => '2', + 'shipping_id' => '30', + 'shipping_name01' => '配送情報02-update', + 'shipping_date' => '2013-12-03 00:00:00', + ]; SC_Helper_Purchase::registerShipping($order_id, $arrParams); @@ -123,21 +123,21 @@ public function testRegisterShipping配送日付が空の場合エラーが起 { $order_id = '2'; $arrParams = [ - '30' => [ - 'order_id' => '2', - 'shipping_id' => '30', - 'shipping_name01' => '配送情報02-update', - // 'shipping_date' => '2013/12/03 00:00:00' - ], - ]; + '30' => [ + 'order_id' => '2', + 'shipping_id' => '30', + 'shipping_name01' => '配送情報02-update', + // 'shipping_date' => '2013/12/03 00:00:00' + ], + ]; $this->expected['count'] = '3'; $this->expected['content'] = [ - 'order_id' => '2', - 'shipping_id' => '30', - 'shipping_name01' => '配送情報02-update', - 'shipping_date' => null, - ]; + 'order_id' => '2', + 'shipping_id' => '30', + 'shipping_name01' => '配送情報02-update', + 'shipping_date' => null, + ]; SC_Helper_Purchase::registerShipping($order_id, $arrParams); @@ -160,21 +160,21 @@ public function testRegisterShipping非会員購入の場合配送IDが設定さ { $order_id = '2'; $arrParams = [ - '30' => [ - 'order_id' => '2', - // 'shipping_id' => '30', - 'shipping_name01' => '配送情報02-update', - 'shipping_date' => '2013/12/03 00:00:00', - ], - ]; + '30' => [ + 'order_id' => '2', + // 'shipping_id' => '30', + 'shipping_name01' => '配送情報02-update', + 'shipping_date' => '2013/12/03 00:00:00', + ], + ]; $this->expected['count'] = '3'; // 件数が変わらない $this->expected['content'] = [ - 'order_id' => '2', - 'shipping_id' => '30', - 'shipping_name01' => '配送情報02-update', - 'shipping_date' => '2013-12-03 00:00:00', - ]; + 'order_id' => '2', + 'shipping_id' => '30', + 'shipping_name01' => '配送情報02-update', + 'shipping_date' => '2013-12-03 00:00:00', + ]; SC_Helper_Purchase::registerShipping($order_id, $arrParams); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_rollbackOrderTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_rollbackOrderTest.php index 37e3fe6596..6696c8c149 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_rollbackOrderTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_rollbackOrderTest.php @@ -58,28 +58,28 @@ public function testRollbackOrderデフォルトの引数で呼び出した場 $this->actual['testResult'] = $_SESSION['testResult']; $this->actual['siteRegist'] = $_SESSION['site']['regist_success']; $this->expected = [ - 'testResult' => [ - 'cancelOrder' => [ - 'order_id' => '1001', - 'orderStatus' => ORDER_CANCEL, - 'is_delete' => false, - ], - 'getOrderTempByOrderId' => [ - 'order_id' => '1001', - ], - 'saveOrderTemp' => [ - 'uniqid' => $uniqid, - 'arrOrderTemp' => [ - 'customer_id' => '2001', - 'del_flg' => '0', - ], - ], - 'verifyChangeCart' => [ - 'uniqid' => $uniqid, - ], - ], - 'siteRegist' => true, - ]; + 'testResult' => [ + 'cancelOrder' => [ + 'order_id' => '1001', + 'orderStatus' => ORDER_CANCEL, + 'is_delete' => false, + ], + 'getOrderTempByOrderId' => [ + 'order_id' => '1001', + ], + 'saveOrderTemp' => [ + 'uniqid' => $uniqid, + 'arrOrderTemp' => [ + 'customer_id' => '2001', + 'del_flg' => '0', + ], + ], + 'verifyChangeCart' => [ + 'uniqid' => $uniqid, + ], + ], + 'siteRegist' => true, + ]; $this->verify(); } @@ -96,28 +96,28 @@ public function testRollbackOrderトランザクションが開始していな $this->actual['testResult'] = $_SESSION['testResult']; $this->actual['siteRegist'] = $_SESSION['site']['regist_success']; $this->expected = [ - 'testResult' => [ - 'cancelOrder' => [ - 'order_id' => '1001', - 'orderStatus' => ORDER_DELIV, - 'is_delete' => true, - ], - 'getOrderTempByOrderId' => [ - 'order_id' => '1001', - ], - 'saveOrderTemp' => [ - 'uniqid' => $uniqid, - 'arrOrderTemp' => [ - 'customer_id' => '2001', - 'del_flg' => '0', - ], - ], - 'verifyChangeCart' => [ - 'uniqid' => $uniqid, - ], - ], - 'siteRegist' => true, - ]; + 'testResult' => [ + 'cancelOrder' => [ + 'order_id' => '1001', + 'orderStatus' => ORDER_DELIV, + 'is_delete' => true, + ], + 'getOrderTempByOrderId' => [ + 'order_id' => '1001', + ], + 'saveOrderTemp' => [ + 'uniqid' => $uniqid, + 'arrOrderTemp' => [ + 'customer_id' => '2001', + 'del_flg' => '0', + ], + ], + 'verifyChangeCart' => [ + 'uniqid' => $uniqid, + ], + ], + 'siteRegist' => true, + ]; $this->verify(); } // //////////////////////////////////////// @@ -130,35 +130,35 @@ class SC_Helper_Purchase_rollbackOrderMock extends SC_Helper_Purchase public static function cancelOrder($order_id, $orderStatus = ORDER_CANCEL, $is_delete = false) { $_SESSION['testResult']['cancelOrder'] = [ - 'order_id' => $order_id, - 'orderStatus' => $orderStatus, - 'is_delete' => $is_delete, - ]; + 'order_id' => $order_id, + 'orderStatus' => $orderStatus, + 'is_delete' => $is_delete, + ]; } public static function getOrderTempByOrderId($order_id) { $_SESSION['testResult']['getOrderTempByOrderId'] = [ - 'order_id' => $order_id, - ]; + 'order_id' => $order_id, + ]; return [ - 'customer_id' => '2001', - ]; + 'customer_id' => '2001', + ]; } public static function saveOrderTemp($uniqid, $arrOrderTemp, &$objCustomer = null) { $_SESSION['testResult']['saveOrderTemp'] = [ - 'uniqid' => $uniqid, - 'arrOrderTemp' => $arrOrderTemp, - ]; + 'uniqid' => $uniqid, + 'arrOrderTemp' => $arrOrderTemp, + ]; } public static function verifyChangeCart($uniqid, &$objCartSession) { $_SESSION['testResult']['verifyChangeCart'] = [ - 'uniqid' => $uniqid, - ]; + 'uniqid' => $uniqid, + ]; } } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveOrderTempTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveOrderTempTest.php index c319e9a9c0..49ef66078b 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveOrderTempTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveOrderTempTest.php @@ -61,9 +61,9 @@ public function testSaveOrderTemp受注一時情報IDが空の場合何もしな { $this->helper->saveOrderTemp(null, [ - 'customer_id' => '1003', - 'order_name01' => '受注情報03', - 'update_date' => 'CURRENT_TIMESTAMP', + 'customer_id' => '1003', + 'order_name01' => '受注情報03', + 'update_date' => 'CURRENT_TIMESTAMP', ] ); @@ -77,20 +77,20 @@ public function testSaveOrderTemp既存の情報がない場合情報が新規 { $this->helper->saveOrderTemp('1003', [ - 'customer_id' => '1003', - 'order_name01' => '受注情報03', - 'update_date' => 'CURRENT_TIMESTAMP', + 'customer_id' => '1003', + 'order_name01' => '受注情報03', + 'update_date' => 'CURRENT_TIMESTAMP', ] ); $this->expected['count'] = '3'; $this->expected['content'] = [ - [ - 'order_temp_id' => '1003', - 'customer_id' => '1003', - 'order_name01' => '受注情報03', - ], - ]; + [ + 'order_temp_id' => '1003', + 'customer_id' => '1003', + 'order_name01' => '受注情報03', + ], + ]; $this->actual['count'] = $this->objQuery->count('dtb_order_temp'); $this->actual['content'] = $this->objQuery->select( 'order_temp_id, customer_id, order_name01', @@ -103,20 +103,20 @@ public function testSaveOrderTemp既存の情報がある場合情報が更新 { $this->helper->saveOrderTemp($this->order_temp_ids[0], [ - 'customer_id' => '2002', - 'order_name01' => '受注情報92', - 'update_date' => 'CURRENT_TIMESTAMP', + 'customer_id' => '2002', + 'order_name01' => '受注情報92', + 'update_date' => 'CURRENT_TIMESTAMP', ] ); $this->expected['count'] = '2'; $this->expected['content'] = [ - [ - 'order_temp_id' => $this->order_temp_ids[0], - 'customer_id' => '2002', - 'order_name01' => '受注情報92', - ], - ]; + [ + 'order_temp_id' => $this->order_temp_ids[0], + 'customer_id' => '2002', + 'order_name01' => '受注情報92', + ], + ]; $this->actual['count'] = $this->objQuery->count('dtb_order_temp'); $this->actual['content'] = $this->objQuery->select( 'order_temp_id, customer_id, order_name01', @@ -129,10 +129,10 @@ public function testSaveOrderTemp注文者情報がある場合情報がコピ { $this->helper->saveOrderTemp('1003', [ - 'order_temp_id' => '1003', - 'customer_id' => '1003', - 'order_name01' => '受注情報03', - 'update_date' => 'CURRENT_TIMESTAMP', + 'order_temp_id' => '1003', + 'customer_id' => '1003', + 'order_name01' => '受注情報03', + 'update_date' => 'CURRENT_TIMESTAMP', ], new SC_Customer_Ex() ); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveShippingTempTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveShippingTempTest.php index 08a9efdf23..7ea2189462 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveShippingTempTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveShippingTempTest.php @@ -53,11 +53,11 @@ public function testSaveShippingTemp元々存在しない配送先IDの場合新 ); $this->expected = [ - 'count' => 4, // 配送情報全体の件数 - 'shipping_id' => 0, - 'shipment_item' => null, - 'shipping_pref' => '大阪府', - ]; + 'count' => 4, // 配送情報全体の件数 + 'shipping_id' => 0, + 'shipment_item' => null, + 'shipping_pref' => '大阪府', + ]; $this->actual['count'] = count($_SESSION['shipping']); $this->actual['shipping_id'] = $_SESSION['shipping']['0']['shipping_id']; $this->actual['shipment_item'] = $_SESSION['shipping']['0']['shipment_item']; @@ -76,11 +76,11 @@ public function testSaveShippingTemp元々存在する配送先IDの場合情報 ); $this->expected = [ - 'count' => 3, // 配送情報全体の件数 - 'shipping_id' => '00001', - 'shipment_item' => ['商品1'], - 'shipping_pref' => '大阪府', - ]; + 'count' => 3, // 配送情報全体の件数 + 'shipping_id' => '00001', + 'shipment_item' => ['商品1'], + 'shipping_pref' => '大阪府', + ]; $this->actual['count'] = count($_SESSION['shipping']); $this->actual['shipping_id'] = $_SESSION['shipping']['00001']['shipping_id']; $this->actual['shipment_item'] = $_SESSION['shipping']['00001']['shipment_item']; diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setDownloadableFlgToTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setDownloadableFlgToTest.php index 1d80d03846..393323f016 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setDownloadableFlgToTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setDownloadableFlgToTest.php @@ -47,8 +47,8 @@ protected function tearDown(): void public function testSetDownloadableFlgTo販売価格が0円の場合フラグがONになる() { $input = [ - '1001' => ['price' => 0], - ]; + '1001' => ['price' => 0], + ]; $this->expected = true; SC_Helper_Purchase::setDownloadableFlgTo($input); @@ -60,8 +60,8 @@ public function testSetDownloadableFlgTo販売価格が0円の場合フラグが public function testSetDownloadableFlgToダウンロード期限内かつ入金日ありの場合フラグがONになる() { $input = [ - '1001' => ['price' => 1000, 'effective' => '1', 'payment_date' => '2012-12-12'], - ]; + '1001' => ['price' => 1000, 'effective' => '1', 'payment_date' => '2012-12-12'], + ]; $this->expected = true; SC_Helper_Purchase::setDownloadableFlgTo($input); @@ -73,8 +73,8 @@ public function testSetDownloadableFlgToダウンロード期限内かつ入金 public function testSetDownloadableFlgToダウンロード期限内かつ入金日なしの場合フラグがOFFになる() { $input = [ - '1001' => ['price' => 1000, 'effective' => '1', 'payment_date' => null], - ]; + '1001' => ['price' => 1000, 'effective' => '1', 'payment_date' => null], + ]; $this->expected = false; SC_Helper_Purchase::setDownloadableFlgTo($input); @@ -86,8 +86,8 @@ public function testSetDownloadableFlgToダウンロード期限内かつ入金 public function testSetDownloadableFlgToダウンロード期限外かつ入金日ありの場合フラグがOFFになる() { $input = [ - '1001' => ['price' => 1000, 'effective' => '0', 'payment_date' => '2012-12-12'], - ]; + '1001' => ['price' => 1000, 'effective' => '0', 'payment_date' => '2012-12-12'], + ]; $this->expected = false; SC_Helper_Purchase::setDownloadableFlgTo($input); @@ -99,8 +99,8 @@ public function testSetDownloadableFlgToダウンロード期限外かつ入金 public function testSetDownloadableFlgToダウンロード期限外かつ入金日なしの場合フラグがOFFになる() { $input = [ - '1001' => ['price' => 1000, 'effective' => '0', 'payment_date' => null], - ]; + '1001' => ['price' => 1000, 'effective' => '0', 'payment_date' => null], + ]; $this->expected = false; SC_Helper_Purchase::setDownloadableFlgTo($input); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempForSoleTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempForSoleTest.php index 1bd95d7e7f..db19e6c106 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempForSoleTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempForSoleTest.php @@ -54,12 +54,12 @@ public function testSetShipmentItemTempForSoleいったん配送情報がクリ $helper->setShipmentItemTempForSole($cartSession, $shipping_id); $this->expected = [ - 'clearShipmentItemTemp' => true, - 'shipmentItemTemp' => [ - ['shipping_id' => '1001', 'id' => '1', 'quantity' => '10'], - ['shipping_id' => '1001', 'id' => '2', 'quantity' => '5'], - ], - ]; + 'clearShipmentItemTemp' => true, + 'shipmentItemTemp' => [ + ['shipping_id' => '1001', 'id' => '1', 'quantity' => '10'], + ['shipping_id' => '1001', 'id' => '2', 'quantity' => '5'], + ], + ]; $this->actual = $_SESSION['testResult']; $this->verify(); @@ -87,9 +87,9 @@ class SC_CartSession_setShipmentItemTempForSoleMock extends SC_CartSession public function getCartList($key, $pref_id = 0, $country_id = 0) { return [ - ['id' => '1', 'quantity' => '10'], - ['id' => '2', 'quantity' => '5'], - ['id' => '3', 'quantity' => '0'], - ]; + ['id' => '1', 'quantity' => '10'], + ['id' => '2', 'quantity' => '5'], + ['id' => '3', 'quantity' => '0'], + ]; } } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderStatusTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderStatusTest.php index 2b468908be..8279140c1f 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderStatusTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderStatusTest.php @@ -65,15 +65,15 @@ public function testSfUpdateOrderStatusオプションの引数が未指定の SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id); // 引数は最低限だけ指定 $this->expected = [ - 'order' => [ - 'status' => '3', - 'add_point' => '20', - 'use_point' => '10', - ], - 'customer' => [ - 'point' => $customer_point, - ], - ]; + 'order' => [ + 'status' => '3', + 'add_point' => '20', + 'use_point' => '10', + ], + 'customer' => [ + 'point' => $customer_point, + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -88,12 +88,11 @@ public function testSfUpdateOrderStatusオプションの引数が未指定の // TODO 定数を変更できないためテスト不可 /** - public function testSfUpdateOrderStatus_ポイント使用しない設定の場合_ポイントに関する処理が行われない() - { - - - $this->verify(); - } + * public function testSfUpdateOrderStatus_ポイント使用しない設定の場合_ポイントに関する処理が行われない() + * { + * + * $this->verify(); + * } */ public function testSfUpdateOrderStatus対応状況が発送済みに変更された場合発送日が更新される() { @@ -108,15 +107,15 @@ public function testSfUpdateOrderStatus対応状況が発送済みに変更さ SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id, ORDER_DELIV, 50, 45); $this->expected = [ - 'order' => [ - 'status' => ORDER_DELIV, - 'add_point' => '50', // 引数の設定どおりになる - 'use_point' => '45', // 引数の設定どおりになる - ], - 'customer' => [ - 'point' => $customer_point, // ポイントを使わない - ], - ]; + 'order' => [ + 'status' => ORDER_DELIV, + 'add_point' => '50', // 引数の設定どおりになる + 'use_point' => '45', // 引数の設定どおりになる + ], + 'customer' => [ + 'point' => $customer_point, // ポイントを使わない + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -145,12 +144,12 @@ public function testSfUpdateOrderStatus対応状況が入金済みに変更さ SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id, ORDER_PRE_END, 50, 45); $this->expected = [ - 'order' => [ - 'status' => ORDER_PRE_END, - 'add_point' => '50', // 引数の設定どおりになる - 'use_point' => '45', // 引数の設定どおりになる - ], - ]; + 'order' => [ + 'status' => ORDER_PRE_END, + 'add_point' => '50', // 引数の設定どおりになる + 'use_point' => '45', // 引数の設定どおりになる + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -178,15 +177,15 @@ public function testSfUpdateOrderStatus変更前の対応状況が利用対象 SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id, ORDER_CANCEL, 0, 45); $this->expected = [ - 'order' => [ - 'status' => ORDER_CANCEL, - 'add_point' => '0', // 引数の設定どおりになる - 'use_point' => '45', // 引数の設定どおりになる - ], - 'customer' => [ - 'point' => '210', // 元々200pt+10pt戻す - ], - ]; + 'order' => [ + 'status' => ORDER_CANCEL, + 'add_point' => '0', // 引数の設定どおりになる + 'use_point' => '45', // 引数の設定どおりになる + ], + 'customer' => [ + 'point' => '210', // 元々200pt+10pt戻す + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -208,15 +207,15 @@ public function testSfUpdateOrderStatus変更後の対応状況が利用対象 SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id, ORDER_NEW, 50, 45); $this->expected = [ - 'order' => [ - 'status' => ORDER_NEW, - 'add_point' => '50', // 引数の設定どおりになる - 'use_point' => '45', // 引数の設定どおりになる - ], - 'customer' => [ - 'point' => '55', // 元々100pt→45pt引く - ], - ]; + 'order' => [ + 'status' => ORDER_NEW, + 'add_point' => '50', // 引数の設定どおりになる + 'use_point' => '45', // 引数の設定どおりになる + ], + 'customer' => [ + 'point' => '55', // 元々100pt→45pt引く + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -238,15 +237,15 @@ public function testSfUpdateOrderStatus変更前の対応状況が加算対象 SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id, ORDER_CANCEL, 50, 45); $this->expected = [ - 'order' => [ - 'status' => ORDER_CANCEL, - 'add_point' => '50', // 引数の設定どおりになる - 'use_point' => '45', // 引数の設定どおりになる - ], - 'customer' => [ - 'point' => '180', // 元々200pt→20pt引く - ], - ]; + 'order' => [ + 'status' => ORDER_CANCEL, + 'add_point' => '50', // 引数の設定どおりになる + 'use_point' => '45', // 引数の設定どおりになる + ], + 'customer' => [ + 'point' => '180', // 元々200pt→20pt引く + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -268,15 +267,15 @@ public function testSfUpdateOrderStatus変更後の対応状況が加算対象 SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id, ORDER_DELIV, 50, 0); $this->expected = [ - 'order' => [ - 'status' => ORDER_DELIV, - 'add_point' => '50', // 引数の設定どおりになる - 'use_point' => '0', // 引数の設定どおりになる - ], - 'customer' => [ - 'point' => '150', // 元々100pt→50pt足す - ], - ]; + 'order' => [ + 'status' => ORDER_DELIV, + 'add_point' => '50', // 引数の設定どおりになる + 'use_point' => '0', // 引数の設定どおりになる + ], + 'customer' => [ + 'point' => '150', // 元々100pt→50pt足す + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -298,15 +297,15 @@ public function testSfUpdateOrderStatus加算ポイントがプラスの場合 SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id, ORDER_PRE_END, 40, 25); $this->expected = [ - 'order' => [ - 'status' => ORDER_PRE_END, - 'add_point' => '40', // 引数の設定どおりになる - 'use_point' => '25', // 引数の設定どおりになる - ], - 'customer' => [ - 'point' => '105', // 変更前の状態で-10pt,変更後の状態で+15pt - ], - ]; + 'order' => [ + 'status' => ORDER_PRE_END, + 'add_point' => '40', // 引数の設定どおりになる + 'use_point' => '25', // 引数の設定どおりになる + ], + 'customer' => [ + 'point' => '105', // 変更前の状態で-10pt,変更後の状態で+15pt + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -328,15 +327,15 @@ public function testSfUpdateOrderStatus加算ポイントが負でポイント SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id, ORDER_PRE_END, 0, 50); $this->expected = [ - 'order' => [ - 'status' => ORDER_PRE_END, - 'add_point' => '0', // 引数の設定どおりになる - 'use_point' => '50', // 引数の設定どおりになる - ], - 'customer' => [ - 'point' => '40', // 変更前の状態で-10pt,変更後の状態で-50pt - ], - ]; + 'order' => [ + 'status' => ORDER_PRE_END, + 'add_point' => '0', // 引数の設定どおりになる + 'use_point' => '50', // 引数の設定どおりになる + ], + 'customer' => [ + 'point' => '40', // 変更前の状態で-10pt,変更後の状態で-50pt + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -347,9 +346,9 @@ public function testSfUpdateOrderStatus加算ポイントが負でポイント // TODO ロールバックされる場合はexitするためテスト不可. /** - public function testSfUpdateOrderStatus_加算ポイントが負でポイントが足りていない場合_会員テーブルがロールバックされエラーとなる() - { - } + * public function testSfUpdateOrderStatus_加算ポイントが負でポイントが足りていない場合_会員テーブルがロールバックされエラーとなる() + * { + * } */ // //////////////////////////////////////// diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_unsetOneShippingTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_unsetOneShippingTest.php index 012e8c7ca8..3aabc14752 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_unsetOneShippingTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_unsetOneShippingTest.php @@ -51,15 +51,15 @@ public function testUnsetOneShippingTemp指定したIDの配送情報のみが SC_Helper_Purchase::unsetOneShippingTemp('00002'); $this->expected = [ - '00001' => [ - 'shipment_id' => '00001', - 'shipment_item' => ['商品1'], - 'shipping_pref' => '東京都', ], - '00003' => [ - 'shipment_id' => '00003', - 'shipment_item' => [], - 'shipping_pref' => '埼玉県', ], - ]; + '00001' => [ + 'shipment_id' => '00001', + 'shipment_item' => ['商品1'], + 'shipping_pref' => '東京都', ], + '00003' => [ + 'shipment_id' => '00003', + 'shipment_item' => [], + 'shipping_pref' => '埼玉県', ], + ]; $this->actual = $_SESSION['shipping']; $this->verify('配送情報'); diff --git a/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxDetailTest.php b/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxDetailTest.php index f9b0adbdce..2df59906d5 100644 --- a/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxDetailTest.php +++ b/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxDetailTest.php @@ -112,6 +112,7 @@ public function testGetTaxPerTaxRateWithZero() /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testGetTaxPerTaxRateWithFloor() @@ -161,6 +162,7 @@ public function testGetTaxPerTaxRateWithFloor() /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testGetTaxPerTaxRateWithCeil() @@ -262,7 +264,9 @@ public function testGetTaxPerTaxRateWithRound2() /** * @see https://github.com/EC-CUBE/ec-cube2/pull/762#issuecomment-1897799676 + * * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testGetTaxPerTaxRateWithFloor2() @@ -312,7 +316,9 @@ public function testGetTaxPerTaxRateWithFloor2() /** * @see https://github.com/EC-CUBE/ec-cube2/pull/762#issuecomment-1897799676 + * * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testGetTaxPerTaxRateWithCeil2() diff --git a/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxRuleTest.php b/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxRuleTest.php index fb3747f3be..b4bdf59fcc 100644 --- a/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxRuleTest.php +++ b/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxRuleTest.php @@ -23,6 +23,7 @@ protected function tearDown(): void /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function test定数が正しく設定されているかのテスト() @@ -34,6 +35,7 @@ public function test定数が正しく設定されているかのテスト() /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function test引数が空の場合税率設定で設定かつ適用日時内の最新の値が返される() @@ -60,6 +62,7 @@ public function test引数が空の場合税率設定で設定かつ適用日時 /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function test商品idを指定した場合税率設定で設定かつ適用日時内の最新の値が返される() @@ -86,6 +89,7 @@ public function test商品idを指定した場合税率設定で設定かつ適 /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function test商品規格idを指定した場合税率設定で設定かつ適用日時内の最新の値が返される() diff --git a/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxRule_OptionProductTaxRuleTest.php b/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxRule_OptionProductTaxRuleTest.php index c244d302ed..e7c0bfd0d0 100644 --- a/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxRule_OptionProductTaxRuleTest.php +++ b/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxRule_OptionProductTaxRuleTest.php @@ -25,6 +25,7 @@ protected function tearDown(): void /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function test引数が空の場合税率設定で設定かつ適用日時内の最新の値が返される() @@ -51,6 +52,7 @@ public function test引数が空の場合税率設定で設定かつ適用日時 /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function test商品idを指定した場合商品に設定かつ適用日時内の最新の値が返される() @@ -77,6 +79,7 @@ public function test商品idを指定した場合商品に設定かつ適用日 /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function test商品規格idを指定した場合商品に登録かつ適用日時内の最新の値が返される() @@ -103,6 +106,7 @@ public function test商品規格idを指定した場合商品に登録かつ適 /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function test商品規格idのみを指定した場合税率設定に登録かつ適用日時内の最新の値が返される() @@ -129,6 +133,7 @@ public function test商品規格idのみを指定した場合税率設定に登 /** * @runInSeparateProcess + * * @preserveGlobalState disabled * * 基本税率と同じ税率を設定すると商品別税率を削除する diff --git a/tests/class/plugin/LoadClassFileChangeCustomDirTest.php b/tests/class/plugin/LoadClassFileChangeCustomDirTest.php index 44788e3a83..f89cbe007c 100644 --- a/tests/class/plugin/LoadClassFileChangeCustomDirTest.php +++ b/tests/class/plugin/LoadClassFileChangeCustomDirTest.php @@ -37,6 +37,7 @@ protected function setUp(): void /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testLOading() diff --git a/tests/class/plugin/LoadClassFileChangeTest.php b/tests/class/plugin/LoadClassFileChangeTest.php index da09c22c02..174c33d66f 100644 --- a/tests/class/plugin/LoadClassFileChangeTest.php +++ b/tests/class/plugin/LoadClassFileChangeTest.php @@ -38,6 +38,7 @@ protected function tearDown(): void * loadClassFileChange で拡張したクラスのテストケース. * * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testLoadExtendedClass() diff --git a/tests/class/util/SC_Utils/SC_Utils_arrayDefineIndexesTest.php b/tests/class/util/SC_Utils/SC_Utils_arrayDefineIndexesTest.php index 73ea917125..1b26ab6313 100644 --- a/tests/class/util/SC_Utils/SC_Utils_arrayDefineIndexesTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_arrayDefineIndexesTest.php @@ -61,12 +61,12 @@ public function testArrayDefineIndexesチェック対象のキーが一部存在 $defineIndexes = ['tomato', 'banana', 'kiwi']; $this->expected = [ - 'apple' => 'りんご', - 'banana' => 'バナナ', - 'orange' => 'オレンジ', - 'tomato' => '', - 'kiwi' => '', - ]; + 'apple' => 'りんご', + 'banana' => 'バナナ', + 'orange' => 'オレンジ', + 'tomato' => '', + 'kiwi' => '', + ]; $this->actual = SC_Utils::arrayDefineIndexes($input_array, $defineIndexes); $this->verify(); diff --git a/tests/class/util/SC_Utils/SC_Utils_isAbsoluteRealPathTest.php b/tests/class/util/SC_Utils/SC_Utils_isAbsoluteRealPathTest.php index 147023471c..d178f1323a 100644 --- a/tests/class/util/SC_Utils/SC_Utils_isAbsoluteRealPathTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_isAbsoluteRealPathTest.php @@ -47,7 +47,7 @@ protected function tearDown(): void // /////////////////////////////////////// public function testIsAbsoluteRealPath絶対パスの場合Trueが返る() { - if (strpos(PHP_OS, 'WIN') !== false) { + if (str_contains(PHP_OS, 'WIN')) { $input = 'C:/Program Files/username/hoge/hoge.txt'; $this->markTestSkipped( 'Appveyorが落ちるので暫定スキップしています' @@ -63,7 +63,7 @@ public function testIsAbsoluteRealPath絶対パスの場合Trueが返る() public function testIsAbsoluteRealPath相対パスの場合Trueが返る() { - if (strpos(PHP_OS, 'WIN') !== false) { + if (str_contains(PHP_OS, 'WIN')) { $input = './system32/hoge/hoge.txt'; } else { $input = '../etc/php.ini'; diff --git a/tests/class/util/SC_Utils/SC_Utils_isAppInnerUrlTest.php b/tests/class/util/SC_Utils/SC_Utils_isAppInnerUrlTest.php index 114b1fd81b..73835cf948 100644 --- a/tests/class/util/SC_Utils/SC_Utils_isAppInnerUrlTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_isAppInnerUrlTest.php @@ -49,41 +49,41 @@ protected function tearDown(): void // /////////////////////////////////////// /** - public function testIsAppInnerUrl_非SSLかつアプリ内URLの場合_trueが返る() - { - $input = 'http://sample.eccube.jp/admin/'; - $this->expected = true; - $this->actual = SC_Utils::isAppInnerUrl($input); - - $this->verify(); - } - - public function testIsAppInnerUrl_非SSLかつアプリ外URLの場合_falseが返る() - { - $input = 'http://outside.eccube.jp/admin/'; - $this->expected = false; - $this->actual = SC_Utils::isAppInnerUrl($input); - - $this->verify(); - } - - public function testIsAppInnerUrl_SSLかつアプリ内URLの場合_trueが返る() - { - $input = 'https://sample.eccube.jp/admin/'; - $this->expected = true; - $this->actual = SC_Utils::isAppInnerUrl($input); - - $this->verify(); - } - - public function testIsAppInnerUrl_SSLかつアプリ外URLの場合_falseが返る() - { - $input = 'https://outside.eccube.jp/admin/'; - $this->expected = false; - $this->actual = SC_Utils::isAppInnerUrl($input); - - $this->verify(); - } + * public function testIsAppInnerUrl_非SSLかつアプリ内URLの場合_trueが返る() + * { + * $input = 'http://sample.eccube.jp/admin/'; + * $this->expected = true; + * $this->actual = SC_Utils::isAppInnerUrl($input); + * + * $this->verify(); + * } + * + * public function testIsAppInnerUrl_非SSLかつアプリ外URLの場合_falseが返る() + * { + * $input = 'http://outside.eccube.jp/admin/'; + * $this->expected = false; + * $this->actual = SC_Utils::isAppInnerUrl($input); + * + * $this->verify(); + * } + * + * public function testIsAppInnerUrl_SSLかつアプリ内URLの場合_trueが返る() + * { + * $input = 'https://sample.eccube.jp/admin/'; + * $this->expected = true; + * $this->actual = SC_Utils::isAppInnerUrl($input); + * + * $this->verify(); + * } + * + * public function testIsAppInnerUrl_SSLかつアプリ外URLの場合_falseが返る() + * { + * $input = 'https://outside.eccube.jp/admin/'; + * $this->expected = false; + * $this->actual = SC_Utils::isAppInnerUrl($input); + * + * $this->verify(); + * } */ // //////////////////////////////////////// diff --git a/tests/class/util/SC_Utils/SC_Utils_sfArrCombineTest.php b/tests/class/util/SC_Utils/SC_Utils_sfArrCombineTest.php index 4c3cc6be3e..42fd0f284d 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfArrCombineTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfArrCombineTest.php @@ -62,10 +62,10 @@ public function testSfArrCombine入力のキー配列の方が短い場合余っ $values = ['りんご', 'バナナ', 'オレンジ', '梨']; $this->expected = [ - 'apple' => 'りんご', - 'banana' => 'バナナ', - null => '梨', - ]; + 'apple' => 'りんご', + 'banana' => 'バナナ', + null => '梨', + ]; $this->actual = SC_Utils::sfArrCombine($keys, $values); $this->verify(); @@ -77,11 +77,11 @@ public function testSfArrCombine入力のキー配列の方が長い場合余っ $values = ['りんご', 'バナナ']; $this->expected = [ - 'apple' => 'りんご', - 'banana' => 'バナナ', - 'orange' => null, - 'pear' => null, - ]; + 'apple' => 'りんご', + 'banana' => 'バナナ', + 'orange' => null, + 'pear' => null, + ]; $this->actual = SC_Utils::sfArrCombine($keys, $values); $this->verify(); diff --git a/tests/class/util/SC_Utils/SC_Utils_sfArrKeyValueTest.php b/tests/class/util/SC_Utils/SC_Utils_sfArrKeyValueTest.php index 13a4ca0653..fbcde121a7 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfArrKeyValueTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfArrKeyValueTest.php @@ -42,11 +42,11 @@ protected function setUp(): void // parent::setUp(); $this->arrList = [ - ['testkey' => '1011', 'testvalue' => '2001', 'key' => '3001'], - ['testkey' => '2022', 'testvalue' => '2002', 'key' => '3002'], - ['testkey' => '3033', 'testvalue' => '2003', 'key' => '3003'], - ['testkey' => '4044', 'testvalue' => '2004', 'key' => '3004'], - ]; + ['testkey' => '1011', 'testvalue' => '2001', 'key' => '3001'], + ['testkey' => '2022', 'testvalue' => '2002', 'key' => '3002'], + ['testkey' => '3033', 'testvalue' => '2003', 'key' => '3003'], + ['testkey' => '4044', 'testvalue' => '2004', 'key' => '3004'], + ]; $this->keyname = 'testkey'; $this->valuename = 'testvalue'; } @@ -62,10 +62,10 @@ public function testSfArrKeyValue最大長が配列より短い場合最大長 $len_max = 3; $this->expected = [ - '1011' => '2001', - '2022' => '2002', - '3033' => '2003', - ]; + '1011' => '2001', + '2022' => '2002', + '3033' => '2003', + ]; $this->actual = SC_Utils::sfArrKeyValue($this->arrList, $this->keyname, $this->valuename, $len_max); $this->verify(); @@ -74,11 +74,11 @@ public function testSfArrKeyValue最大長が配列より短い場合最大長 public function testSfArrKeyValue最大長が指定されていない場合全要素が出力される() { $this->expected = [ - '1011' => '2001', - '2022' => '2002', - '3033' => '2003', - '4044' => '2004', - ]; + '1011' => '2001', + '2022' => '2002', + '3033' => '2003', + '4044' => '2004', + ]; $this->actual = SC_Utils::sfArrKeyValue($this->arrList, $this->keyname, $this->valuename, $len_max); $this->verify(); @@ -90,11 +90,11 @@ public function testSfArrKeyValueキーサイズが短い場合キーサイズ $keysize = 1; $this->expected = [ - '1...' => '2001', - '2...' => '2002', - '3...' => '2003', - '4...' => '2004', - ]; + '1...' => '2001', + '2...' => '2002', + '3...' => '2003', + '4...' => '2004', + ]; $this->actual = SC_Utils::sfArrKeyValue($this->arrList, $this->keyname, $this->valuename, $len_max, $keysize); $this->verify(); diff --git a/tests/class/util/SC_Utils/SC_Utils_sfCopyDirtest.php b/tests/class/util/SC_Utils/SC_Utils_sfCopyDirtest.php index 1d6c1389a6..8e509c9f18 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfCopyDirtest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfCopyDirtest.php @@ -60,9 +60,9 @@ public function testSfCopyDirディレクトリでない場合Falseを返し何 $dst = self::$TMP_DIR.'/dst/'; $this->expected = [ - 'result' => false, - 'file_exists' => false, - ]; + 'result' => false, + 'file_exists' => false, + ]; $this->actual['result'] = SC_Utils::sfCopyDir($src, $dst); $this->actual['file_exists'] = file_exists($dst); @@ -80,9 +80,9 @@ public function testSfCopyDirコピー先のディレクトリが存在しない $dst = self::$TMP_DIR.'/dst/'; $this->expected = [ - 'dir_exists' => true, - 'files' => ['test.txt'], - ]; + 'dir_exists' => true, + 'files' => ['test.txt'], + ]; SC_Utils::sfCopyDir($src, $dst); $this->actual['dir_exists'] = is_dir($dst); $this->actual['files'] = Test_Utils::mapCols(SC_Helper_FileManager::sfGetFileList($dst), 'file_name'); @@ -117,12 +117,12 @@ public function testSfCopyDirコピー先のディレクトリが存在する場 $dst = self::$TMP_DIR.'/dst/'; $this->expected = [ - 'dir_exists' => true, - 'files' => ['CVS', 'dir1', 'test.txt'], - 'files_2' => ['dir12'], - 'files_3' => ['dir123'], - 'file_content' => 'good morning', - ]; + 'dir_exists' => true, + 'files' => ['CVS', 'dir1', 'test.txt'], + 'files_2' => ['dir12'], + 'files_3' => ['dir123'], + 'file_content' => 'good morning', + ]; SC_Utils::sfCopyDir($src, $dst); $this->actual['dir_exists'] = is_dir($dst); $this->actual['files'] = Test_Utils::mapCols(SC_Helper_FileManager::sfGetFileList($dst), 'file_name'); @@ -151,10 +151,10 @@ public function testSfCopyDir上書きフラグがONの場合同名ファイル $dst = self::$TMP_DIR.'/dst/'; $this->expected = [ - 'dir_exists' => true, - 'files' => ['test.txt'], - 'file_content' => 'hello', - ]; + 'dir_exists' => true, + 'files' => ['test.txt'], + 'file_content' => 'hello', + ]; SC_Utils::sfCopyDir($src, $dst, '', true); $this->actual['dir_exists'] = is_dir($dst); $this->actual['files'] = Test_Utils::mapCols(SC_Helper_FileManager::sfGetFileList($dst), 'file_name'); @@ -183,10 +183,10 @@ public function testSfCopyDir上書きフラグがONかつ書き込み権限が $dst = self::$TMP_DIR.'/dst/'; $this->expected = [ - 'dir_exists' => true, - 'files' => ['test.txt'], - 'file_content' => 'good morning', - ]; + 'dir_exists' => true, + 'files' => ['test.txt'], + 'file_content' => 'good morning', + ]; SC_Utils::sfCopyDir($src, $dst, '', true); $this->actual['dir_exists'] = is_dir($dst); $this->actual['files'] = Test_Utils::mapCols(SC_Helper_FileManager::sfGetFileList($dst), 'file_name'); diff --git a/tests/class/util/SC_Utils/SC_Utils_sfEncodeFileTest.php b/tests/class/util/SC_Utils/SC_Utils_sfEncodeFileTest.php index ff9a464821..19006419e1 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfEncodeFileTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfEncodeFileTest.php @@ -60,9 +60,9 @@ public function testSfEncodeFileファイルが正常に開けた場合ファイ fclose($fp_out); $this->expected = [ - 'filename' => $outdir.'enc_test.txt', - 'content' => 'こんにちは', - ]; + 'filename' => $outdir.'enc_test.txt', + 'content' => 'こんにちは', + ]; $this->actual['filename'] = SC_Utils::sfEncodeFile($filepath, 'euc-jp', $outdir); @@ -75,5 +75,5 @@ public function testSfEncodeFileファイルが正常に開けた場合ファイ // TODO ファイルが開けなかった場合はexitするためテスト不可 - // //////////////////////////////////////// + // //////////////////////////////////////// } diff --git a/tests/class/util/SC_Utils/SC_Utils_sfGetAddressTest.php b/tests/class/util/SC_Utils/SC_Utils_sfGetAddressTest.php index 6d34029bd4..6f46eabfa5 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfGetAddressTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfGetAddressTest.php @@ -58,12 +58,12 @@ public function test住所がヒットしない場合空の配列が返る() public function test住所が一件だけヒットする場合住所データが取得できる() { $this->expected = [ - [ - 'state' => '1', // 北海道 - 'city' => '札幌市中央区', - 'town' => '大通東', - ], - ]; + [ + 'state' => '1', // 北海道 + 'city' => '札幌市中央区', + 'town' => '大通東', + ], + ]; $this->actual = SC_Utils::sfGetAddress('0600041'); $this->verify('郵便番号検索結果'); @@ -73,34 +73,34 @@ public function test住所が一件だけヒットする場合住所データが // 今の仕様ではこれでOKかもしれないが、そもそも一件目しか使わないのなら // $data_list[0]を返した方が良いのでは? /** - public function test_住所が二件以上ヒットする場合_町名を消した住所データが取得できる() - { - $this->expected = array( - array( - 'state' => '5', // 秋田県 - 'city' => '秋田市', - 'town' => '' - ), - array( - 'state' => '5', - 'city' => '秋田市', - 'town' => '' - ) - ); - $this->actual = SC_Utils::sfGetAddress('0110951'); - - $this->verify('郵便番号検索結果'); - } + * public function test_住所が二件以上ヒットする場合_町名を消した住所データが取得できる() + * { + * $this->expected = array( + * array( + * 'state' => '5', // 秋田県 + * 'city' => '秋田市', + * 'town' => '' + * ), + * array( + * 'state' => '5', + * 'city' => '秋田市', + * 'town' => '' + * ) + * ); + * $this->actual = SC_Utils::sfGetAddress('0110951'); + * + * $this->verify('郵便番号検索結果'); + * } */ public function test住所に但し書きが含まれる場合但し書きが消去される() { $this->expected = [ - [ - 'state' => '1', // 北海道 - 'city' => '札幌市中央区', - 'town' => '大通西', - ], - ]; + [ + 'state' => '1', // 北海道 + 'city' => '札幌市中央区', + 'town' => '大通西', + ], + ]; $this->actual = SC_Utils::sfGetAddress('0600042'); $this->verify('郵便番号検索結果'); @@ -109,12 +109,12 @@ public function test住所に但し書きが含まれる場合但し書きが消 public function test住所に注意文言がある場合町名が消去される() { $this->expected = [ - [ - 'state' => '1', // 北海道 - 'city' => '札幌市中央区', - 'town' => '', - ], - ]; + [ + 'state' => '1', // 北海道 + 'city' => '札幌市中央区', + 'town' => '', + ], + ]; $this->actual = SC_Utils::sfGetAddress('0600000'); $this->verify('郵便番号検索結果'); @@ -123,12 +123,12 @@ public function test住所に注意文言がある場合町名が消去される public function test住所に番地の説明が含まれる場合町名が消去される() { $this->expected = [ - [ - 'state' => '8', // 茨城県 - 'city' => '猿島郡堺町', - 'town' => '', - ], - ]; + [ + 'state' => '8', // 茨城県 + 'city' => '猿島郡堺町', + 'town' => '', + ], + ]; $this->actual = SC_Utils::sfGetAddress('3060433'); $this->verify('郵便番号検索結果'); @@ -139,49 +139,49 @@ public function test住所に番地の説明が含まれる場合町名が消去 protected function setUpAddress() { $address = [ - [ - 'zip_id' => '2', - 'zipcode' => '0600041', - 'state' => '北海道', - 'city' => '札幌市中央区', - 'town' => '大通東', - ], - [ - 'zip_id' => '3', - 'zipcode' => '0600042', - 'state' => '北海道', - 'city' => '札幌市中央区', - 'town' => '大通西(1〜19丁目)', - ], - [ - 'zip_id' => '0', - 'zipcode' => '0600000', - 'state' => '北海道', - 'city' => '札幌市中央区', - 'town' => '以下に掲載がない場合', - ], - [ - 'zip_id' => '26867', - 'zipcode' => '3060433', - 'state' => '茨城県', - 'city' => '猿島郡堺町', - 'town' => '堺町の次に番地がくる場合', - ], - [ - 'zip_id' => '16223', - 'zipcode' => '0110951', - 'state' => '秋田県', - 'city' => '秋田市', - 'town' => '土崎港相染町', - ], - [ - 'zip_id' => '16226', - 'zipcode' => '0110951', - 'state' => '秋田県', - 'city' => '秋田市', - 'town' => '土崎港古川町', - ], - ]; + [ + 'zip_id' => '2', + 'zipcode' => '0600041', + 'state' => '北海道', + 'city' => '札幌市中央区', + 'town' => '大通東', + ], + [ + 'zip_id' => '3', + 'zipcode' => '0600042', + 'state' => '北海道', + 'city' => '札幌市中央区', + 'town' => '大通西(1〜19丁目)', + ], + [ + 'zip_id' => '0', + 'zipcode' => '0600000', + 'state' => '北海道', + 'city' => '札幌市中央区', + 'town' => '以下に掲載がない場合', + ], + [ + 'zip_id' => '26867', + 'zipcode' => '3060433', + 'state' => '茨城県', + 'city' => '猿島郡堺町', + 'town' => '堺町の次に番地がくる場合', + ], + [ + 'zip_id' => '16223', + 'zipcode' => '0110951', + 'state' => '秋田県', + 'city' => '秋田市', + 'town' => '土崎港相染町', + ], + [ + 'zip_id' => '16226', + 'zipcode' => '0110951', + 'state' => '秋田県', + 'city' => '秋田市', + 'town' => '土崎港古川町', + ], + ]; $this->objQuery->delete('mtb_zip'); foreach ($address as $item) { diff --git a/tests/class/util/SC_Utils/SC_Utils_sfGetClassCatCountTest.php b/tests/class/util/SC_Utils/SC_Utils_sfGetClassCatCountTest.php index 977cc444e3..b77413e274 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfGetClassCatCountTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfGetClassCatCountTest.php @@ -50,9 +50,9 @@ protected function tearDown(): void public function testSfGetClassCatCount規格分類の件数がIDごとに取得できる() { $this->expected = [ - '1001' => '2', - '1002' => '1', - ]; + '1001' => '2', + '1002' => '1', + ]; $this->actual = SC_Utils::sfGetClassCatCount(); $this->verify('規格分類の件数'); @@ -63,69 +63,69 @@ public function testSfGetClassCatCount規格分類の件数がIDごとに取得 protected function setUpClassCat() { $classes = [ - [ - 'class_id' => '1001', - 'name' => '味', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - 'del_flg' => '0', - ], - [ - 'class_id' => '1002', - 'name' => '大きさ', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - 'del_flg' => '0', - ], - // 削除フラグが立っているので検索されない - [ - 'class_id' => '1003', - 'name' => '匂い', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - 'del_flg' => '1', - ], - ]; + [ + 'class_id' => '1001', + 'name' => '味', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + 'del_flg' => '0', + ], + [ + 'class_id' => '1002', + 'name' => '大きさ', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + 'del_flg' => '0', + ], + // 削除フラグが立っているので検索されない + [ + 'class_id' => '1003', + 'name' => '匂い', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + 'del_flg' => '1', + ], + ]; $this->objQuery->delete('dtb_class'); foreach ($classes as $item) { $this->objQuery->insert('dtb_class', $item); } $class_categories = [ - [ - 'classcategory_id' => '1011', - 'class_id' => '1001', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - ], - // 削除フラグが立っているので検索されない - [ - 'classcategory_id' => '1012', - 'class_id' => '1001', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - 'del_flg' => '1', - ], - [ - 'classcategory_id' => '1013', - 'class_id' => '1001', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - ], - [ - 'classcategory_id' => '1021', - 'class_id' => '1002', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - ], - // dtb_classでdel_flgが立っているので検索されない - [ - 'classcategory_id' => '1031', - 'class_id' => '1003', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - ], - ]; + [ + 'classcategory_id' => '1011', + 'class_id' => '1001', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + ], + // 削除フラグが立っているので検索されない + [ + 'classcategory_id' => '1012', + 'class_id' => '1001', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + 'del_flg' => '1', + ], + [ + 'classcategory_id' => '1013', + 'class_id' => '1001', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + ], + [ + 'classcategory_id' => '1021', + 'class_id' => '1002', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + ], + // dtb_classでdel_flgが立っているので検索されない + [ + 'classcategory_id' => '1031', + 'class_id' => '1003', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + ], + ]; // classcategory_id=0のものは削除しない $this->objQuery->delete('dtb_classcategory', 'classcategory_id <> 0'); foreach ($class_categories as $item) { diff --git a/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypePlainTest.php b/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypePlainTest.php index 6016bc39ce..fb3aabc6ad 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypePlainTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypePlainTest.php @@ -48,15 +48,15 @@ protected function tearDown(): void // /////////////////////////////////////// /** - public function testSfGetHashString_暗号化なしの設定になっている場合_文字列が変換されない() - { - $input = 'hello, world'; - - $this->expected = $input; - $this->actual = SC_Utils::sfGetHashString($input); - - $this->verify(); - } + * public function testSfGetHashString_暗号化なしの設定になっている場合_文字列が変換されない() + * { + * $input = 'hello, world'; + * + * $this->expected = $input; + * $this->actual = SC_Utils::sfGetHashString($input); + * + * $this->verify(); + * } */ public function testDummyTest() { diff --git a/tests/class/util/SC_Utils/SC_Utils_sfGetProductClassIdTest.php b/tests/class/util/SC_Utils/SC_Utils_sfGetProductClassIdTest.php index 79038e5061..5d7216c6e3 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfGetProductClassIdTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfGetProductClassIdTest.php @@ -93,33 +93,33 @@ public function testSfGetProductClassId存在しない製品IDを指定した場 protected function setUpProductsClass() { $products_class = [ - [ - 'product_class_id' => '2001', - 'product_id' => '2001', - 'product_code' => 'code2001', - 'price02' => '1000', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - ], - [ - 'product_class_id' => '1001', - 'product_id' => '1001', - 'product_code' => 'code1001', - 'price02' => '1000', - 'classcategory_id1' => '1', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - ], - [ - 'product_class_id' => '1002', - 'product_id' => '1001', - 'product_code' => 'code1002', - 'price02' => '1000', - 'classcategory_id1' => '2', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - ], - ]; + [ + 'product_class_id' => '2001', + 'product_id' => '2001', + 'product_code' => 'code2001', + 'price02' => '1000', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + ], + [ + 'product_class_id' => '1001', + 'product_id' => '1001', + 'product_code' => 'code1001', + 'price02' => '1000', + 'classcategory_id1' => '1', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + ], + [ + 'product_class_id' => '1002', + 'product_id' => '1001', + 'product_code' => 'code1002', + 'price02' => '1000', + 'classcategory_id1' => '2', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + ], + ]; $this->objQuery->delete('dtb_products_class'); foreach ($products_class as $item) { diff --git a/tests/class/util/SC_Utils/SC_Utils_sfGetUnderChildrenArrayTest.php b/tests/class/util/SC_Utils/SC_Utils_sfGetUnderChildrenArrayTest.php index 20d0b01b43..a088a194c3 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfGetUnderChildrenArrayTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfGetUnderChildrenArrayTest.php @@ -47,12 +47,12 @@ protected function tearDown(): void public function testSfGetUnderChildrenArray与えられた親IDを持つ要素だけが抽出される() { $input_array = [ - ['parent_id' => '1001', 'child_id' => '1001001'], - ['parent_id' => '1002', 'child_id' => '1002001'], - ['parent_id' => '1002', 'child_id' => '1002002'], - ['parent_id' => '1003', 'child_id' => '1003001'], - ['parent_id' => '1004', 'child_id' => '1004001'], - ]; + ['parent_id' => '1001', 'child_id' => '1001001'], + ['parent_id' => '1002', 'child_id' => '1002001'], + ['parent_id' => '1002', 'child_id' => '1002002'], + ['parent_id' => '1003', 'child_id' => '1003001'], + ['parent_id' => '1004', 'child_id' => '1004001'], + ]; $this->expected = ['1002001', '1002002']; $this->actual = SC_Utils::sfGetUnderChildrenArray( $input_array, diff --git a/tests/class/util/SC_Utils/SC_Utils_sfIsIntTest.php b/tests/class/util/SC_Utils/SC_Utils_sfIsIntTest.php index bcfe5877bc..00cd5fc854 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfIsIntTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfIsIntTest.php @@ -94,13 +94,13 @@ public function testSfIsInt正の整数の場合TRUEが返る() // TODO 「整数かどうか」という関数名なのでここはFALSEになるべきでは? /** - public function testSfIsInt_正の小数の場合_FALSEが返る() - { - $this->expected = FALSE; - $this->actual = SC_Utils::sfIsInt('123.456'); - - $this->verify('整数かどうか'); - } + * public function testSfIsInt_正の小数の場合_FALSEが返る() + * { + * $this->expected = FALSE; + * $this->actual = SC_Utils::sfIsInt('123.456'); + * + * $this->verify('整数かどうか'); + * } */ public function testSfIsInt負の整数の場合TRUEが返る() { @@ -111,13 +111,13 @@ public function testSfIsInt負の整数の場合TRUEが返る() } // TODO 文字列長でチェックしているので負の場合は範囲が小さくなっている - /* - public function testSfIsInt_負の整数で桁数が最大の場合_TRUEが返る() - { - $this->expected = TRUE; - $this->actual = SC_Utils::sfIsInt('-123456789'); - - $this->verify('整数かどうか'); - } - */ + /* + public function testSfIsInt_負の整数で桁数が最大の場合_TRUEが返る() + { + $this->expected = TRUE; + $this->actual = SC_Utils::sfIsInt('-123456789'); + + $this->verify('整数かどうか'); + } + */ } diff --git a/tests/class/util/SC_Utils/SC_Utils_sfIsMatchHashPassword_authTypePlainTest.php b/tests/class/util/SC_Utils/SC_Utils_sfIsMatchHashPassword_authTypePlainTest.php index d92c3c694c..de88cd8f91 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfIsMatchHashPassword_authTypePlainTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfIsMatchHashPassword_authTypePlainTest.php @@ -48,27 +48,27 @@ protected function tearDown(): void // /////////////////////////////////////// /** - public function testSfIsMatchHashPassword_文字列が一致する場合_trueが返る() - { - $pass = 'ec-cube'; - $hashpass = 'ec-cube'; - - $this->expected = TRUE; - $this->actual = SC_Utils::sfIsMatchHashPassword($pass, $hashpass); - - $this->verify('パスワード文字列比較結果'); - } - - public function testSfIsMatchHashPassword_文字列が一致しない場合_falseが返る() - { - $pass = 'ec-cube'; - $hashpass = 'EC-cube'; - - $this->expected = FALSE; - $this->actual = SC_Utils::sfIsMatchHashPassword($pass, $hashpass); - - $this->verify('パスワード文字列比較結果'); - } + * public function testSfIsMatchHashPassword_文字列が一致する場合_trueが返る() + * { + * $pass = 'ec-cube'; + * $hashpass = 'ec-cube'; + * + * $this->expected = TRUE; + * $this->actual = SC_Utils::sfIsMatchHashPassword($pass, $hashpass); + * + * $this->verify('パスワード文字列比較結果'); + * } + * + * public function testSfIsMatchHashPassword_文字列が一致しない場合_falseが返る() + * { + * $pass = 'ec-cube'; + * $hashpass = 'EC-cube'; + * + * $this->expected = FALSE; + * $this->actual = SC_Utils::sfIsMatchHashPassword($pass, $hashpass); + * + * $this->verify('パスワード文字列比較結果'); + * } */ public function testDummyTest() { diff --git a/tests/class/util/SC_Utils/SC_Utils_sfMakeHiddenArrayTest.php b/tests/class/util/SC_Utils/SC_Utils_sfMakeHiddenArrayTest.php index 27055ae2b2..81061fa6f0 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfMakeHiddenArrayTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfMakeHiddenArrayTest.php @@ -48,27 +48,27 @@ protected function tearDown(): void public function testSfMakeHiddenArray多段配列が1次元配列に変換される() { $input_array = [ - 'vegetable' => '野菜', - 'fruit' => [ - 'apple' => 'りんご', - 'banana' => 'バナナ', - ], - 'drink' => [ - 'alcohol' => [ - 'beer' => 'ビール', - ], - 'water' => '水', - ], - 'rice' => '米', - ]; + 'vegetable' => '野菜', + 'fruit' => [ + 'apple' => 'りんご', + 'banana' => 'バナナ', + ], + 'drink' => [ + 'alcohol' => [ + 'beer' => 'ビール', + ], + 'water' => '水', + ], + 'rice' => '米', + ]; $this->expected = [ - 'vegetable' => '野菜', - 'fruit[apple]' => 'りんご', - 'fruit[banana]' => 'バナナ', - 'drink[alcohol][beer]' => 'ビール', - 'drink[water]' => '水', - 'rice' => '米', - ]; + 'vegetable' => '野菜', + 'fruit[apple]' => 'りんご', + 'fruit[banana]' => 'バナナ', + 'drink[alcohol][beer]' => 'ビール', + 'drink[water]' => '水', + 'rice' => '米', + ]; $this->actual = SC_Utils::sfMakeHiddenArray($input_array); $this->verify(); } diff --git a/tests/class/util/SC_Utils/SC_Utils_sfPrePointTest.php b/tests/class/util/SC_Utils/SC_Utils_sfPrePointTest.php index 2c35b80317..2c55046cf3 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfPrePointTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfPrePointTest.php @@ -90,9 +90,9 @@ public function testSfPrePoint丸め方法の指定がない場合定数で指 { $this->expected = [9, 9]; $this->actual = [ - SC_Utils::sfPrePoint(100, 9.4), - SC_Utils::sfPrePoint(100, 9.5), - ]; + SC_Utils::sfPrePoint(100, 9.4), + SC_Utils::sfPrePoint(100, 9.5), + ]; $this->verify(); } diff --git a/tests/class/util/SC_Utils/SC_Utils_sfPrintRTest.php b/tests/class/util/SC_Utils/SC_Utils_sfPrintRTest.php index 954527915d..d022dbe8df 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfPrintRTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfPrintRTest.php @@ -46,16 +46,16 @@ protected function tearDown(): void // /////////////////////////////////////// // TODO 環境により出力形式が異なるため、テスト不可(デバッグ用なので、テストしなくてもよさそう) /** - public function testSfPrintR__指定したオブジェクトの情報が出力される() - { - $output = '
' . "\n" - . '**デバッグ中**
' . "\n" - . '' . "\n" - . '**デバッグ中**
' . "\n"; - - $this->expectOutputString($output); - SC_Utils::sfPrintR(array('test'=>'TEST')); - } + * public function testSfPrintR__指定したオブジェクトの情報が出力される() + * { + * $output = '
' . "\n" + * . '**デバッグ中**
' . "\n" + * . '' . "\n" + * . '**デバッグ中**
' . "\n"; + * + * $this->expectOutputString($output); + * SC_Utils::sfPrintR(array('test'=>'TEST')); + * } */ // //////////////////////////////////////// public function testDummyTest() diff --git a/tests/class/util/SC_Utils/SC_Utils_sfSwapArrayTest.php b/tests/class/util/SC_Utils/SC_Utils_sfSwapArrayTest.php index 60d05ad078..0d777fa82a 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfSwapArrayTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfSwapArrayTest.php @@ -47,14 +47,14 @@ protected function tearDown(): void public function testSfSwapArrayカラム名ありの指定の場合キーに名称が入る() { $input_array = [ - ['id' => '1001', 'name' => 'name1001'], - ['id' => '1002', 'name' => 'name1002'], - ]; + ['id' => '1001', 'name' => 'name1001'], + ['id' => '1002', 'name' => 'name1002'], + ]; $this->expected = [ - 'id' => ['1001', '1002'], - 'name' => ['name1001', 'name1002'], - ]; + 'id' => ['1001', '1002'], + 'name' => ['name1001', 'name1002'], + ]; $this->actual = SC_Utils::sfSwapArray($input_array); $this->verify(); @@ -63,14 +63,14 @@ public function testSfSwapArrayカラム名ありの指定の場合キーに名 public function testSfSwapArrayカラム名なしの指定の場合キーに名称が入らない() { $input_array = [ - ['id' => '1001', 'name' => 'name1001'], - ['id' => '1002', 'name' => 'name1002'], - ]; + ['id' => '1001', 'name' => 'name1001'], + ['id' => '1002', 'name' => 'name1002'], + ]; $this->expected = [ - ['1001', '1002'], - ['name1001', 'name1002'], - ]; + ['1001', '1002'], + ['name1001', 'name1002'], + ]; $this->actual = SC_Utils::sfSwapArray($input_array, false); $this->verify(); diff --git a/tests/require.php b/tests/require.php index fc6e779263..0e216392fd 100644 --- a/tests/require.php +++ b/tests/require.php @@ -5,7 +5,7 @@ /* テスト中 */ define('TEST_FUNCTION', true); -if (strpos($_SERVER['SCRIPT_FILENAME'], 'phpunit') !== false && !class_exists('\Eccube2\Tests\Fixture\Generator')) { +if (str_contains($_SERVER['SCRIPT_FILENAME'], 'phpunit') && !class_exists('\Eccube2\Tests\Fixture\Generator')) { echo 'You must set up the project dependencies, run the following commands:'.PHP_EOL. 'composer require nanasess/eccube2-fixture-generator --dev --ignore-platform-req=php'.PHP_EOL; exit(1); From dfe01a7b10a8c2d33cbba15986fd6733e51f9f32 Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Tue, 17 Dec 2024 18:02:38 +0900 Subject: [PATCH 3/7] =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=83=87=E3=83=B3?= =?UTF-8?q?=E3=83=88=E7=AD=89=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/class/api/SC_Api_Operation.php | 18 ++--- data/class/api/SC_Api_Utils.php | 2 +- .../LC_Page_Admin_Contents_CsvSql.php | 2 +- .../ownersstore/LC_Page_Admin_OwnersStore.php | 2 +- ..._Page_Admin_Products_UploadCSVCategory.php | 7 +- .../system/LC_Page_Admin_System_Editdb.php | 6 +- .../system/LC_Page_Admin_System_Parameter.php | 8 ++- data/class/pages/api/LC_Page_Api.php | 2 +- data/class/pages/api/LC_Page_Api_Json.php | 2 +- data/class/pages/api/LC_Page_Api_Php.php | 2 +- data/class/pages/api/LC_Page_Api_Xml.php | 2 +- data/class/pages/forgot/LC_Page_Forgot.php | 6 +- .../mypage/LC_Page_Mypage_DeliveryAddr.php | 6 +- data/module/Calendar/Decorator.php | 4 +- data/module/Calendar/Table/Helper.php | 6 +- .../SC_CheckError_createParamTest.php | 6 +- .../SC_Date/SC_Date_getZeroMonthTest.php | 3 +- tests/class/SC_Query_Test.php | 18 +++-- ...C_Helper_Purchase_getShipmentItemsTest.php | 20 ++++-- ...SC_Helper_Purchase_getShippingTempTest.php | 6 +- .../SC_Helper_Purchase_getShippingsTest.php | 6 +- ...C_Helper_Purchase_registerShippingTest.php | 4 +- ...elper_Purchase_sfUpdateOrderStatusTest.php | 20 +++--- .../SC_Utils/SC_Utils_isAppInnerUrlTest.php | 72 +++++++++---------- .../SC_Utils/SC_Utils_sfGetAddressTest.php | 39 +++++----- ...tils_sfGetHashString_authTypePlainTest.php | 21 +++--- .../util/SC_Utils/SC_Utils_sfIsIntTest.php | 17 +++-- ...fIsMatchHashPassword_authTypePlainTest.php | 46 ++++++------ .../util/SC_Utils/SC_Utils_sfPrintRTest.php | 23 +++--- 29 files changed, 201 insertions(+), 175 deletions(-) diff --git a/data/class/api/SC_Api_Operation.php b/data/class/api/SC_Api_Operation.php index 3fd75fda97..5515ddecb8 100644 --- a/data/class/api/SC_Api_Operation.php +++ b/data/class/api/SC_Api_Operation.php @@ -367,10 +367,11 @@ public static function doApiAction($arrPost) if (count($arrErr) == 0) { // 実行成功 - $arrResponseValidSection = ['Request' => [ - 'IsValid' => 'True', - $operation_name.'Request' => $arrOperationRequestValid, - ], + $arrResponseValidSection = [ + 'Request' => [ + 'IsValid' => 'True', + $operation_name.'Request' => $arrOperationRequestValid, + ], ]; $response_outer = $operation_name.'Response'; SC_Api_Utils_Ex::printApiLog('Operation SUCCESS', $start_time, $response_outer); @@ -380,10 +381,11 @@ public static function doApiAction($arrPost) foreach ($arrErr as $error_code => $error_msg) { $arrResponseErrorSection[] = ['Code' => $error_code, 'Message' => $error_msg]; } - $arrResponseValidSection = ['Request' => [ - 'IsValid' => 'False', - 'Errors' => ['Error' => $arrResponseErrorSection], - ], + $arrResponseValidSection = [ + 'Request' => [ + 'IsValid' => 'False', + 'Errors' => ['Error' => $arrResponseErrorSection], + ], ]; if (is_object($objApiOperation)) { $response_outer = $operation_name.'Response'; diff --git a/data/class/api/SC_Api_Utils.php b/data/class/api/SC_Api_Utils.php index 0321516089..826ddea0ef 100644 --- a/data/class/api/SC_Api_Utils.php +++ b/data/class/api/SC_Api_Utils.php @@ -114,7 +114,7 @@ public static function getApiConfig($operation_name) * @param string $msg 出力文字列 * @param text $operation_name * - * @ @rturn void + * @return void */ public static function printApiLog($msg, $start_time = '', $operation_name = '') { diff --git a/data/class/pages/admin/contents/LC_Page_Admin_Contents_CsvSql.php b/data/class/pages/admin/contents/LC_Page_Admin_Contents_CsvSql.php index 80a1c598b0..69c846a81c 100644 --- a/data/class/pages/admin/contents/LC_Page_Admin_Contents_CsvSql.php +++ b/data/class/pages/admin/contents/LC_Page_Admin_Contents_CsvSql.php @@ -461,7 +461,7 @@ public function lfGetSqlDenyList() 'NOTIFY\s', 'PREPARE\s', 'REASSIGN\s', - // 'REINDEX\s', // REINDEXは許可で良いかなと + // 'REINDEX\s', // REINDEXは許可で良いかなと 'RELEASE\sSAVEPOINT', 'RENAME\s', 'REST\s', diff --git a/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore.php b/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore.php index c6cc2a9a93..7081f41626 100644 --- a/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore.php +++ b/data/class/pages/admin/ownersstore/LC_Page_Admin_OwnersStore.php @@ -1113,7 +1113,7 @@ public function checkConflictPlugin($plugin_id) /** * エラー情報が格納されているか判定します. * - * @return bool. + * @return bool */ public function isError($error) { diff --git a/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php b/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php index 49cd505a36..716062134f 100644 --- a/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php +++ b/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSVCategory.php @@ -500,9 +500,12 @@ public function lfCheckErrorDetail($item, $arrErr) $where = 'parent_category_id = ? AND category_id <> ? AND category_name = ?'; $exists = $objQuery->exists('dtb_category', $where, - [$parent_category_id, + [ + $parent_category_id, $item['category_id'], - $item['category_name'], ]); + $item['category_name'], + ] + ); if ($exists) { $arrErr['category_name'] = '※ 既に同名のカテゴリが存在します。'; } diff --git a/data/class/pages/admin/system/LC_Page_Admin_System_Editdb.php b/data/class/pages/admin/system/LC_Page_Admin_System_Editdb.php index 0ba97814c2..50de0ba67b 100644 --- a/data/class/pages/admin/system/LC_Page_Admin_System_Editdb.php +++ b/data/class/pages/admin/system/LC_Page_Admin_System_Editdb.php @@ -148,10 +148,12 @@ public function lfGetTargetData(&$objFormParam) // 変更されている対象を走査 for ($i = 1; $i <= count($arrIndexFlag); $i++) { // 入力値チェック - $param = ['indexflag' => $arrIndexFlag[$i], + $param = [ + 'indexflag' => $arrIndexFlag[$i], 'indexflag_new' => $arrIndexFlagNew[$i], 'table_name' => $arrTableName[$i], - 'column_name' => $arrColumnName[$i], ]; + 'column_name' => $arrColumnName[$i], + ]; $objErr = new SC_CheckError_Ex($param); $objErr->doFunc(['インデックス('.$i.')', 'indexflag', INT_LEN], ['NUM_CHECK']); $objErr->doFunc(['インデックス変更後('.$i.')', 'indexflag_new', INT_LEN], ['NUM_CHECK']); diff --git a/data/class/pages/admin/system/LC_Page_Admin_System_Parameter.php b/data/class/pages/admin/system/LC_Page_Admin_System_Parameter.php index b0df7961b2..ccfcfce7e4 100644 --- a/data/class/pages/admin/system/LC_Page_Admin_System_Parameter.php +++ b/data/class/pages/admin/system/LC_Page_Admin_System_Parameter.php @@ -139,8 +139,12 @@ public function errorCheck(&$arrKeys, &$arrForm) { $objErr = new SC_CheckError_Ex($arrForm); for ($i = 0; $i < count($arrKeys); $i++) { - $objErr->doFunc([$arrKeys[$i], - $arrForm[$arrKeys[$i]], ], + $objErr->doFunc( + [ + $arrKeys[$i], + $arrForm[$arrKeys[$i] + ], + ], ['EXIST_CHECK_REVERSE', 'EVAL_CHECK']); } diff --git a/data/class/pages/api/LC_Page_Api.php b/data/class/pages/api/LC_Page_Api.php index c7fdf4a58a..1ab54add7f 100644 --- a/data/class/pages/api/LC_Page_Api.php +++ b/data/class/pages/api/LC_Page_Api.php @@ -48,7 +48,7 @@ public function init() public function process() { $this->action(); - // $this->sendResponse(); + // $this->sendResponse(); } /** diff --git a/data/class/pages/api/LC_Page_Api_Json.php b/data/class/pages/api/LC_Page_Api_Json.php index ed285ec988..f77215a921 100644 --- a/data/class/pages/api/LC_Page_Api_Json.php +++ b/data/class/pages/api/LC_Page_Api_Json.php @@ -48,7 +48,7 @@ public function init() public function process() { $this->action(); - // $this->sendResponse(); + // $this->sendResponse(); } /** diff --git a/data/class/pages/api/LC_Page_Api_Php.php b/data/class/pages/api/LC_Page_Api_Php.php index b260a7bd57..0bff94c58c 100644 --- a/data/class/pages/api/LC_Page_Api_Php.php +++ b/data/class/pages/api/LC_Page_Api_Php.php @@ -48,7 +48,7 @@ public function init() public function process() { $this->action(); - // $this->sendResponse(); + // $this->sendResponse(); } /** diff --git a/data/class/pages/api/LC_Page_Api_Xml.php b/data/class/pages/api/LC_Page_Api_Xml.php index 0b991c0434..fa5f52f76d 100644 --- a/data/class/pages/api/LC_Page_Api_Xml.php +++ b/data/class/pages/api/LC_Page_Api_Xml.php @@ -48,7 +48,7 @@ public function init() public function process() { $this->action(); - // $this->sendResponse(); + // $this->sendResponse(); } /** diff --git a/data/class/pages/forgot/LC_Page_Forgot.php b/data/class/pages/forgot/LC_Page_Forgot.php index 5623638583..c1e38f9044 100644 --- a/data/class/pages/forgot/LC_Page_Forgot.php +++ b/data/class/pages/forgot/LC_Page_Forgot.php @@ -202,8 +202,10 @@ public function lfCheckForgotSecret(&$arrForm, &$arrReminder) $where = '(email = ? OR email_mobile = ?)' .' AND name01 = ? AND name02 = ?' .' AND status = 2 AND del_flg = 0'; - $arrVal = [$arrForm['email'], $arrForm['email'], - $arrForm['name01'], $arrForm['name02'], ]; + $arrVal = [ + $arrForm['email'], $arrForm['email'], + $arrForm['name01'], $arrForm['name02'], + ]; $result = $objQuery->select($cols, $table, $where, $arrVal); if (isset($result[0]['reminder']) && isset($arrReminder[$result[0]['reminder']]) && $result[0]['reminder'] == $arrForm['reminder']) { diff --git a/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php b/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php index 657de4993d..24a7a3dc6f 100644 --- a/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php +++ b/data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php @@ -49,9 +49,11 @@ public function init() $this->arrPref = $masterData->getMasterData('mtb_pref'); $this->arrCountry = $masterData->getMasterData('mtb_country'); $this->httpCacheControl('nocache'); - $this->validUrl = [MYPAGE_DELIVADDR_URLPATH, + $this->validUrl = [ + MYPAGE_DELIVADDR_URLPATH, DELIV_URLPATH, - MULTIPLE_URLPATH, ]; + MULTIPLE_URLPATH, + ]; } /** diff --git a/data/module/Calendar/Decorator.php b/data/module/Calendar/Decorator.php index 1ba3939e9c..31eda6872b 100644 --- a/data/module/Calendar/Decorator.php +++ b/data/module/Calendar/Decorator.php @@ -32,8 +32,8 @@ * { * function thisDay($format = 'int') * { - * .* $day = parent::thisDay('timestamp'); - * .* return date('D', $day); + * $day = parent::thisDay('timestamp'); + * return date('D', $day); * } * } * $Day = & new Calendar_Day(2003, 10, 25); diff --git a/data/module/Calendar/Table/Helper.php b/data/module/Calendar/Table/Helper.php index 86174dee5e..1249ae4326 100644 --- a/data/module/Calendar/Table/Helper.php +++ b/data/module/Calendar/Table/Helper.php @@ -232,12 +232,12 @@ public function getEmptyDaysBefore() public function getEmptyDaysAfter() { // Causes bug when displaying more than one month - // static $index; - // if (!isset($index)) { + // static $index; + // if (!isset($index)) { $index = $this->getEmptyDaysBefore() + $this->cE->getDaysInMonth( $this->calendar->thisYear(), $this->calendar->thisMonth()); - // } + // } return $index; } diff --git a/tests/class/SC_CheckError/SC_CheckError_createParamTest.php b/tests/class/SC_CheckError/SC_CheckError_createParamTest.php index 75898cfca0..80dc78730a 100644 --- a/tests/class/SC_CheckError/SC_CheckError_createParamTest.php +++ b/tests/class/SC_CheckError/SC_CheckError_createParamTest.php @@ -47,8 +47,10 @@ public function testArrParamIsCaracter() { $this->objErr->doFunc(['EXIST_CHECK', 'aabbcc_1234'], ['EXIST_CHECK']); - $this->expected = [self::FORM_NAME => [0 => 'A', 1 => 'B', 2 => 'C'], - 'aabbcc_1234' => '', ]; + $this->expected = [ + self::FORM_NAME => [0 => 'A', 1 => 'B', 2 => 'C'], + 'aabbcc_1234' => '', + ]; $this->actual = $this->objErr->arrParam; $this->assertEquals($this->expected, $this->actual); } diff --git a/tests/class/SC_Date/SC_Date_getZeroMonthTest.php b/tests/class/SC_Date/SC_Date_getZeroMonthTest.php index 5f496c8a50..8c4416c368 100644 --- a/tests/class/SC_Date/SC_Date_getZeroMonthTest.php +++ b/tests/class/SC_Date/SC_Date_getZeroMonthTest.php @@ -49,7 +49,8 @@ public function testGetZeroMonth要素の数が12の配列を返す() public function testGetZeroMonth0をつけた月の配列を返す() { - $this->expected = ['01' => '01', '02' => '02', '03' => '03', '04' => '04', '05' => '05', '06' => '06', '07' => '07', '08' => '08', '09' => '09', '10' => '10', '11' => '11', '12' => '12', + $this->expected = [ + '01' => '01', '02' => '02', '03' => '03', '04' => '04', '05' => '05', '06' => '06', '07' => '07', '08' => '08', '09' => '09', '10' => '10', '11' => '11', '12' => '12', ]; $this->actual = $this->objDate->getZeroMonth(); diff --git a/tests/class/SC_Query_Test.php b/tests/class/SC_Query_Test.php index ebc728ae49..7977f62a3b 100644 --- a/tests/class/SC_Query_Test.php +++ b/tests/class/SC_Query_Test.php @@ -248,15 +248,21 @@ public function testUpdate() $this->setTestData(1, '2', 'f'); $this->objQuery->update('test_table', - ['id' => '1', + [ + 'id' => '1', 'column1' => '2', 'column2' => '2', - 'column3' => 'f', ], + 'column3' => 'f', + ], 'id = ?', [1]); - $this->expected = [['id' => '1', - 'column1' => '2', - 'column2' => '2', - 'column3' => 'f', ]]; + $this->expected = [ + [ + 'id' => '1', + 'column1' => '2', + 'column2' => '2', + 'column3' => 'f', + ], + ]; $this->actual = $this->objQuery->getAll('SELECT * FROM test_table'); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShipmentItemsTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShipmentItemsTest.php index 6712111536..91413e8046 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShipmentItemsTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShipmentItemsTest.php @@ -100,11 +100,17 @@ public function testGetShipmentItems存在する受注IDと配送先IDを指定 $result = SC_Helper_Purchase::getShipmentItems($order_id, $shipping_id); $this->actual['count'] = count($result); - $this->actual['first'] = Test_Utils::mapArray($result[0], [ - 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', ]); + $this->actual['first'] = Test_Utils::mapArray($result[0], + [ + 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', + ] + ); $this->actual['first']['productsClass'] = Test_Utils::mapArray($this->actual['first']['productsClass'], ['product_class_id', 'product_id']); - $this->actual['second'] = Test_Utils::mapArray($result[1], [ - 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', ]); + $this->actual['second'] = Test_Utils::mapArray($result[1], + [ + 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', + ] + ); $this->actual['second']['productsClass'] = Test_Utils::mapArray($this->actual['second']['productsClass'], ['product_class_id', 'product_id']); $this->verify('配送情報'); } @@ -135,9 +141,11 @@ public function testGetShipmentItems詳細フラグをOFFにした場合結果 $result = SC_Helper_Purchase::getShipmentItems($order_id, $shipping_id, false); $this->actual['count'] = count($result); $this->actual['first'] = Test_Utils::mapArray($result[0], [ - 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', ]); + 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', + ]); $this->actual['second'] = Test_Utils::mapArray($result[1], [ - 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', ]); + 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', + ]); $this->verify('配送情報'); } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingTempTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingTempTest.php index 2897f9fcdc..b1099094ce 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingTempTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingTempTest.php @@ -62,11 +62,13 @@ public function testGetShippingTemp保有フラグがONの場合商品のある '00001' => [ 'shipment_id' => '00001', 'shipment_item' => ['商品1'], - 'shipping_pref' => '東京都', ], + 'shipping_pref' => '東京都', + ], '00002' => [ 'shipment_id' => '00002', 'shipment_item' => ['商品2'], - 'shipping_pref' => '沖縄県', ], + 'shipping_pref' => '沖縄県', + ], ]; $this->actual = SC_Helper_Purchase::getShippingTemp(true); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php index 857513b7a9..7261d688d0 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php @@ -81,7 +81,8 @@ public function testGetShippings存在する受注IDを指定した場合結果 $this->actual['count'] = count($result); // shipping_idごとの配列になっているのでshipping_idで抽出 $this->actual['first'] = Test_Utils::mapArray($result[0], [ - 'order_id', 'shipping_id', 'shipping_name01', 'shipping_date', ]); + 'order_id', 'shipping_id', 'shipping_name01', 'shipping_date', + ]); $this->actual['shipment_item_count'] = count($result[0]['shipment_item']); $this->verify('配送情報'); } @@ -105,7 +106,8 @@ public function testGetShippings商品取得フラグをOFFにした場合結果 $this->actual['count'] = count($result); // shipping_idごとの配列になっているのでshipping_idで抽出 $this->actual['first'] = Test_Utils::mapArray($result[0], [ - 'order_id', 'shipping_id', 'shipping_name01', 'shipping_date', ]); + 'order_id', 'shipping_id', 'shipping_name01', 'shipping_date', + ]); $this->actual['shipment_item_count'] = is_array($result['1']['shipment_item']) ? count($result['1']['shipment_item']) : 0; $this->verify('配送情報'); } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShippingTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShippingTest.php index af3a1549bd..4c53264dc1 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShippingTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShippingTest.php @@ -127,7 +127,7 @@ public function testRegisterShipping配送日付が空の場合エラーが起 'order_id' => '2', 'shipping_id' => '30', 'shipping_name01' => '配送情報02-update', - // 'shipping_date' => '2013/12/03 00:00:00' + // 'shipping_date' => '2013/12/03 00:00:00' ], ]; @@ -162,7 +162,7 @@ public function testRegisterShipping非会員購入の場合配送IDが設定さ $arrParams = [ '30' => [ 'order_id' => '2', - // 'shipping_id' => '30', + // 'shipping_id' => '30', 'shipping_name01' => '配送情報02-update', 'shipping_date' => '2013/12/03 00:00:00', ], diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderStatusTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderStatusTest.php index 8279140c1f..4942a3a1c8 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderStatusTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderStatusTest.php @@ -87,13 +87,11 @@ public function testSfUpdateOrderStatusオプションの引数が未指定の } // TODO 定数を変更できないためテスト不可 - /** - * public function testSfUpdateOrderStatus_ポイント使用しない設定の場合_ポイントに関する処理が行われない() - * { - * - * $this->verify(); - * } - */ + // public function testSfUpdateOrderStatus_ポイント使用しない設定の場合_ポイントに関する処理が行われない() + // { + // $this->verify(); + // } + public function testSfUpdateOrderStatus対応状況が発送済みに変更された場合発送日が更新される() { $order_id = $this->order_ids[0]; @@ -345,11 +343,9 @@ public function testSfUpdateOrderStatus加算ポイントが負でポイント } // TODO ロールバックされる場合はexitするためテスト不可. - /** - * public function testSfUpdateOrderStatus_加算ポイントが負でポイントが足りていない場合_会員テーブルがロールバックされエラーとなる() - * { - * } - */ + // public function testSfUpdateOrderStatus_加算ポイントが負でポイントが足りていない場合_会員テーブルがロールバックされエラーとなる() + // { + // } // //////////////////////////////////////// diff --git a/tests/class/util/SC_Utils/SC_Utils_isAppInnerUrlTest.php b/tests/class/util/SC_Utils/SC_Utils_isAppInnerUrlTest.php index 73835cf948..edcb14a868 100644 --- a/tests/class/util/SC_Utils/SC_Utils_isAppInnerUrlTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_isAppInnerUrlTest.php @@ -48,43 +48,41 @@ protected function tearDown(): void } // /////////////////////////////////////// - /** - * public function testIsAppInnerUrl_非SSLかつアプリ内URLの場合_trueが返る() - * { - * $input = 'http://sample.eccube.jp/admin/'; - * $this->expected = true; - * $this->actual = SC_Utils::isAppInnerUrl($input); - * - * $this->verify(); - * } - * - * public function testIsAppInnerUrl_非SSLかつアプリ外URLの場合_falseが返る() - * { - * $input = 'http://outside.eccube.jp/admin/'; - * $this->expected = false; - * $this->actual = SC_Utils::isAppInnerUrl($input); - * - * $this->verify(); - * } - * - * public function testIsAppInnerUrl_SSLかつアプリ内URLの場合_trueが返る() - * { - * $input = 'https://sample.eccube.jp/admin/'; - * $this->expected = true; - * $this->actual = SC_Utils::isAppInnerUrl($input); - * - * $this->verify(); - * } - * - * public function testIsAppInnerUrl_SSLかつアプリ外URLの場合_falseが返る() - * { - * $input = 'https://outside.eccube.jp/admin/'; - * $this->expected = false; - * $this->actual = SC_Utils::isAppInnerUrl($input); - * - * $this->verify(); - * } - */ + // public function testIsAppInnerUrl_非SSLかつアプリ内URLの場合_trueが返る() + // { + // $input = 'http://sample.eccube.jp/admin/'; + // $this->expected = true; + // $this->actual = SC_Utils::isAppInnerUrl($input); + + // $this->verify(); + // } + + // public function testIsAppInnerUrl_非SSLかつアプリ外URLの場合_falseが返る() + // { + // $input = 'http://outside.eccube.jp/admin/'; + // $this->expected = false; + // $this->actual = SC_Utils::isAppInnerUrl($input); + + // $this->verify(); + // } + + // public function testIsAppInnerUrl_SSLかつアプリ内URLの場合_trueが返る() + // { + // $input = 'https://sample.eccube.jp/admin/'; + // $this->expected = true; + // $this->actual = SC_Utils::isAppInnerUrl($input); + + // $this->verify(); + // } + + // public function testIsAppInnerUrl_SSLかつアプリ外URLの場合_falseが返る() + // { + // $input = 'https://outside.eccube.jp/admin/'; + // $this->expected = false; + // $this->actual = SC_Utils::isAppInnerUrl($input); + + // $this->verify(); + // } // //////////////////////////////////////// public function testDummyTest() diff --git a/tests/class/util/SC_Utils/SC_Utils_sfGetAddressTest.php b/tests/class/util/SC_Utils/SC_Utils_sfGetAddressTest.php index 6f46eabfa5..7a5aaadf94 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfGetAddressTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfGetAddressTest.php @@ -72,26 +72,25 @@ public function test住所が一件だけヒットする場合住所データが // TODO 二件目に関しては件名のIDへの変換と町名の削除が行われない。 // 今の仕様ではこれでOKかもしれないが、そもそも一件目しか使わないのなら // $data_list[0]を返した方が良いのでは? - /** - * public function test_住所が二件以上ヒットする場合_町名を消した住所データが取得できる() - * { - * $this->expected = array( - * array( - * 'state' => '5', // 秋田県 - * 'city' => '秋田市', - * 'town' => '' - * ), - * array( - * 'state' => '5', - * 'city' => '秋田市', - * 'town' => '' - * ) - * ); - * $this->actual = SC_Utils::sfGetAddress('0110951'); - * - * $this->verify('郵便番号検索結果'); - * } - */ + // public function test_住所が二件以上ヒットする場合_町名を消した住所データが取得できる() + // { + // $this->expected = array( + // array( + // 'state' => '5', // 秋田県 + // 'city' => '秋田市', + // 'town' => '' + // ), + // array( + // 'state' => '5', + // 'city' => '秋田市', + // 'town' => '' + // ) + // ); + // $this->actual = SC_Utils::sfGetAddress('0110951'); + // + // $this->verify('郵便番号検索結果'); + // } + public function test住所に但し書きが含まれる場合但し書きが消去される() { $this->expected = [ diff --git a/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypePlainTest.php b/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypePlainTest.php index fb3aabc6ad..8ee6559ec5 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypePlainTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypePlainTest.php @@ -47,17 +47,16 @@ protected function tearDown(): void } // /////////////////////////////////////// - /** - * public function testSfGetHashString_暗号化なしの設定になっている場合_文字列が変換されない() - * { - * $input = 'hello, world'; - * - * $this->expected = $input; - * $this->actual = SC_Utils::sfGetHashString($input); - * - * $this->verify(); - * } - */ + // public function testSfGetHashString_暗号化なしの設定になっている場合_文字列が変換されない() + // { + // $input = 'hello, world'; + + // $this->expected = $input; + // $this->actual = SC_Utils::sfGetHashString($input); + + // $this->verify(); + // } + public function testDummyTest() { // Warning が出るため空のテストを作成 diff --git a/tests/class/util/SC_Utils/SC_Utils_sfIsIntTest.php b/tests/class/util/SC_Utils/SC_Utils_sfIsIntTest.php index 00cd5fc854..c72bc4f9f8 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfIsIntTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfIsIntTest.php @@ -93,15 +93,14 @@ public function testSfIsInt正の整数の場合TRUEが返る() } // TODO 「整数かどうか」という関数名なのでここはFALSEになるべきでは? - /** - * public function testSfIsInt_正の小数の場合_FALSEが返る() - * { - * $this->expected = FALSE; - * $this->actual = SC_Utils::sfIsInt('123.456'); - * - * $this->verify('整数かどうか'); - * } - */ + // public function testSfIsInt_正の小数の場合_FALSEが返る() + // { + // $this->expected = FALSE; + // $this->actual = SC_Utils::sfIsInt('123.456'); + + // $this->verify('整数かどうか'); + // } + public function testSfIsInt負の整数の場合TRUEが返る() { $this->expected = true; diff --git a/tests/class/util/SC_Utils/SC_Utils_sfIsMatchHashPassword_authTypePlainTest.php b/tests/class/util/SC_Utils/SC_Utils_sfIsMatchHashPassword_authTypePlainTest.php index de88cd8f91..63d67685c7 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfIsMatchHashPassword_authTypePlainTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfIsMatchHashPassword_authTypePlainTest.php @@ -47,29 +47,29 @@ protected function tearDown(): void } // /////////////////////////////////////// - /** - * public function testSfIsMatchHashPassword_文字列が一致する場合_trueが返る() - * { - * $pass = 'ec-cube'; - * $hashpass = 'ec-cube'; - * - * $this->expected = TRUE; - * $this->actual = SC_Utils::sfIsMatchHashPassword($pass, $hashpass); - * - * $this->verify('パスワード文字列比較結果'); - * } - * - * public function testSfIsMatchHashPassword_文字列が一致しない場合_falseが返る() - * { - * $pass = 'ec-cube'; - * $hashpass = 'EC-cube'; - * - * $this->expected = FALSE; - * $this->actual = SC_Utils::sfIsMatchHashPassword($pass, $hashpass); - * - * $this->verify('パスワード文字列比較結果'); - * } - */ + + // public function testSfIsMatchHashPassword_文字列が一致する場合_trueが返る() + // { + // $pass = 'ec-cube'; + // $hashpass = 'ec-cube'; + + // $this->expected = TRUE; + // $this->actual = SC_Utils::sfIsMatchHashPassword($pass, $hashpass); + + // $this->verify('パスワード文字列比較結果'); + // } + + // public function testSfIsMatchHashPassword_文字列が一致しない場合_falseが返る() + // { + // $pass = 'ec-cube'; + // $hashpass = 'EC-cube'; + + // $this->expected = FALSE; + // $this->actual = SC_Utils::sfIsMatchHashPassword($pass, $hashpass); + + // $this->verify('パスワード文字列比較結果'); + // } + public function testDummyTest() { // Warning が出るため空のテストを作成 diff --git a/tests/class/util/SC_Utils/SC_Utils_sfPrintRTest.php b/tests/class/util/SC_Utils/SC_Utils_sfPrintRTest.php index d022dbe8df..4685f59983 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfPrintRTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfPrintRTest.php @@ -45,18 +45,17 @@ protected function tearDown(): void // /////////////////////////////////////// // TODO 環境により出力形式が異なるため、テスト不可(デバッグ用なので、テストしなくてもよさそう) - /** - * public function testSfPrintR__指定したオブジェクトの情報が出力される() - * { - * $output = '
' . "\n" - * . '**デバッグ中**
' . "\n" - * . '' . "\n" - * . '**デバッグ中**
' . "\n"; - * - * $this->expectOutputString($output); - * SC_Utils::sfPrintR(array('test'=>'TEST')); - * } - */ + // public function testSfPrintR__指定したオブジェクトの情報が出力される() + // { + // $output = '
' . "\n" + // . '**デバッグ中**
' . "\n" + // . '' . "\n" + // . '**デバッグ中**
' . "\n"; + + // $this->expectOutputString($output); + // SC_Utils::sfPrintR(array('test'=>'TEST')); + // } + // //////////////////////////////////////// public function testDummyTest() { From 94aeb8c95e7cc44c2a81da6cedf78bbd3df1fb0e Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Wed, 18 Dec 2024 09:19:28 +0900 Subject: [PATCH 4/7] Fix on PHP7.4 --- data/class/SC_CartSession.php | 2 +- data/class/SC_FormParam.php | 2 +- data/class/helper/SC_Helper_Purchase.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/class/SC_CartSession.php b/data/class/SC_CartSession.php index a81447b066..28837adb48 100644 --- a/data/class/SC_CartSession.php +++ b/data/class/SC_CartSession.php @@ -769,7 +769,7 @@ public function calculate( $discount = 0, $deliv_id = 0, $order_pref = 0, - $order_country_id = 0, + $order_country_id = 0 ) { $results = []; $total_point = $this->getAllProductsPoint($product_type_id); diff --git a/data/class/SC_FormParam.php b/data/class/SC_FormParam.php index bbea1d2f21..8d197669cf 100644 --- a/data/class/SC_FormParam.php +++ b/data/class/SC_FormParam.php @@ -285,7 +285,7 @@ public function checkError($br = true) * @return void */ public function recursionCheck($disp_name, $func, $value, &$arrErr, - $length = 0, + $length = 0 ) { // 配列の場合は、再帰実行 if (is_array($value)) { diff --git a/data/class/helper/SC_Helper_Purchase.php b/data/class/helper/SC_Helper_Purchase.php index 3c1fbbcc0b..59d523ca30 100644 --- a/data/class/helper/SC_Helper_Purchase.php +++ b/data/class/helper/SC_Helper_Purchase.php @@ -526,7 +526,7 @@ public static function copyFromCustomer( 'sex', 'zip01', 'zip02', 'country_id', 'zipcode', 'pref', 'addr01', 'addr02', 'tel01', 'tel02', 'tel03', 'fax01', 'fax02', 'fax03', 'job', 'birth', 'email', - ], + ] ) { if ($objCustomer->isLoginSuccess(true)) { foreach ($keys as $key) { From 20d5712f3aec24d14d4b87819e4e3cad3d8ec282 Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Fri, 20 Dec 2024 17:11:38 +0900 Subject: [PATCH 5/7] Fix indent --- .../SC_Helper_News_getListTest.php | 280 +++++++++--------- 1 file changed, 140 insertions(+), 140 deletions(-) diff --git a/tests/class/helper/SC_Helper_News/SC_Helper_News_getListTest.php b/tests/class/helper/SC_Helper_News/SC_Helper_News_getListTest.php index 23a376ca16..130d0e2336 100644 --- a/tests/class/helper/SC_Helper_News/SC_Helper_News_getListTest.php +++ b/tests/class/helper/SC_Helper_News/SC_Helper_News_getListTest.php @@ -1,150 +1,150 @@ objNews = new SC_Helper_News_Ex(); + protected function setUp(): void + { + parent::setUp(); + $this->objNews = new SC_Helper_News_Ex(); + } + + protected function tearDown(): void + { + parent::tearDown(); + } + + // /////////////////////////////////////// + + public function testGetList削除されたニュースも含む場合全てのニュース一覧が取得できる() + { + $objQuery = SC_Query_Ex::getSingletonInstance(); + $this->setUpNews(); + $dispNumber = 0; + $pageNumber = 0; + $has_deleted = true; + + $this->expected = [ + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1004', + 'news_title' => 'ニュース情報04', + 'creator_id' => '1', + 'del_flg' => '0', + ], + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1003', + 'news_title' => 'ニュース情報03', + 'creator_id' => '1', + 'del_flg' => '1', + ], + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1002', + 'news_title' => 'ニュース情報02', + 'creator_id' => '1', + 'del_flg' => '0', + ], + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1001', + 'news_title' => 'ニュース情報01', + 'creator_id' => '1', + 'del_flg' => '0', + ], + ]; + $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); + foreach ($result as $value) { + $this->actual[] = Test_Utils::mapArray($value, ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); } - protected function tearDown(): void - { - parent::tearDown(); + $this->verify(); + } + + public function testGetList削除されたニュースは含まない場合削除されていないニュース一覧が取得できる() + { + $objQuery = SC_Query_Ex::getSingletonInstance(); + $this->setUpNews(); + $dispNumber = 0; + $pageNumber = 0; + $has_deleted = false; + + $this->expected = [ + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1004', + 'news_title' => 'ニュース情報04', + 'creator_id' => '1', + 'del_flg' => '0', + ], + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1002', + 'news_title' => 'ニュース情報02', + 'creator_id' => '1', + 'del_flg' => '0', + ], + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1001', + 'news_title' => 'ニュース情報01', + 'creator_id' => '1', + 'del_flg' => '0', + ], + ]; + + $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); + foreach ($result as $value) { + $this->actual[] = Test_Utils::mapArray($value, ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); } - // /////////////////////////////////////// - - public function testGetList削除されたニュースも含む場合全てのニュース一覧が取得できる() - { - $objQuery = &SC_Query_Ex::getSingletonInstance(); - $this->setUpNews(); - $dispNumber = 0; - $pageNumber = 0; - $has_deleted = true; - - $this->expected = [ - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1004', - 'news_title' => 'ニュース情報04', - 'creator_id' => '1', - 'del_flg' => '0', - ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1003', - 'news_title' => 'ニュース情報03', - 'creator_id' => '1', - 'del_flg' => '1', - ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1002', - 'news_title' => 'ニュース情報02', - 'creator_id' => '1', - 'del_flg' => '0', - ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1001', - 'news_title' => 'ニュース情報01', - 'creator_id' => '1', - 'del_flg' => '0', - ], - ]; - $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); - foreach ($result as $value) { - $this->actual[] = Test_Utils::mapArray($value, ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); - } - - $this->verify(); - } - - public function testGetList削除されたニュースは含まない場合削除されていないニュース一覧が取得できる() - { - $objQuery = &SC_Query_Ex::getSingletonInstance(); - $this->setUpNews(); - $dispNumber = 0; - $pageNumber = 0; - $has_deleted = false; - - $this->expected = [ - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1004', - 'news_title' => 'ニュース情報04', - 'creator_id' => '1', - 'del_flg' => '0', - ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1002', - 'news_title' => 'ニュース情報02', - 'creator_id' => '1', - 'del_flg' => '0', - ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1001', - 'news_title' => 'ニュース情報01', - 'creator_id' => '1', - 'del_flg' => '0', - ], - ]; - - $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); - foreach ($result as $value) { - $this->actual[] = Test_Utils::mapArray($value, ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); - } - - $this->verify(); - } - - public function testGetList表示件数1かつページ番号3の場合対象のニュースが取得できる() - { - $objQuery = &SC_Query_Ex::getSingletonInstance(); - $this->setUpNews(); - $dispNumber = 1; - $pageNumber = 3; - $has_deleted = false; - - $this->expected = [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1001', - 'news_title' => 'ニュース情報01', - 'creator_id' => '1', - 'del_flg' => '0', - ]; - - $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); - $this->actual = Test_Utils::mapArray($result[0], ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); - - $this->verify(); - } - - public function testGetList表示件数1かつページ番号0の場合対象のニュースが取得できる() - { - $objQuery = &SC_Query_Ex::getSingletonInstance(); - $this->setUpNews(); - $dispNumber = 1; - $pageNumber = 0; - $has_deleted = false; - - $this->expected = [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1004', - 'news_title' => 'ニュース情報04', - 'creator_id' => '1', - 'del_flg' => '0', - ]; - - $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); - $this->actual = Test_Utils::mapArray($result[0], ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); - - $this->verify(); - } + $this->verify(); + } + + public function testGetList表示件数1かつページ番号3の場合対象のニュースが取得できる() + { + $objQuery = SC_Query_Ex::getSingletonInstance(); + $this->setUpNews(); + $dispNumber = 1; + $pageNumber = 3; + $has_deleted = false; + + $this->expected = [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1001', + 'news_title' => 'ニュース情報01', + 'creator_id' => '1', + 'del_flg' => '0', + ]; + + $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); + $this->actual = Test_Utils::mapArray($result[0], ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); + + $this->verify(); + } + + public function testGetList表示件数1かつページ番号0の場合対象のニュースが取得できる() + { + $objQuery = SC_Query_Ex::getSingletonInstance(); + $this->setUpNews(); + $dispNumber = 1; + $pageNumber = 0; + $has_deleted = false; + + $this->expected = [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1004', + 'news_title' => 'ニュース情報04', + 'creator_id' => '1', + 'del_flg' => '0', + ]; + + $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); + $this->actual = Test_Utils::mapArray($result[0], ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); + + $this->verify(); + } } From 7953d16ee32fd0e166e2adb0f6213311fa242cad Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Fri, 20 Dec 2024 17:23:45 +0900 Subject: [PATCH 6/7] =?UTF-8?q?`'trailing=5Fcomma=5Fin=5Fmultiline'=20=3D>?= =?UTF-8?q?=20['after=5Fheredoc'=20=3D>=20true,=20'elements'=20=3D>=20['ar?= =?UTF-8?q?rays']],`=20=E3=82=92=E6=8C=87=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index fad0872e3b..5d1ac769a6 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -18,6 +18,7 @@ 'yoda_style' => false, // 強制しなくて良い 'blank_line_after_opening_tag' => false, // 強制しなくて良い 'fully_qualified_strict_types' => false, // 強制しなくて良い + 'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['arrays']], // elements で arrays 以外を指定するとPHP7.4でエラーになる // @Symfony:risky のうち、以下のルールを無効化 'psr_autoloading' => false, // PSR-4 に準拠していないため From 1daa15b0523c8c4a40c212f8608db1a355626f19 Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Fri, 20 Dec 2024 17:27:02 +0900 Subject: [PATCH 7/7] Apply PHP_CS_FIXER_IGNORE_ENV=1 ec-cube php data/vendor/bin/php-cs-fixer -v fix --allow-risky=yes --- data/class/helper/SC_Helper_Purchase.php | 1 + .../SC_Helper_Address_TestBase.php | 4 +- .../SC_Helper_Address_deleteAddressTest.php | 4 +- .../SC_Helper_Address_registAddressTest.php | 4 +- .../SC_Helper_Kiyaku_TestBase.php | 4 +- .../SC_Helper_Kiyaku_deleteKiyakuTest.php | 4 +- .../SC_Helper_Kiyaku_getKiyakuTest.php | 4 +- .../SC_Helper_Kiyaku_getListTest.php | 4 +- .../SC_Helper_Kiyaku_rankDownTest.php | 4 +- .../SC_Helper_Kiyaku_rankUpTest.php | 4 +- .../SC_Helper_Kiyaku_saveKiyakuTest.php | 4 +- .../SC_Helper_News_deleteNewsTest.php | 4 +- .../SC_Helper_News_getListTest.php | 280 +++++++++--------- .../SC_Helper_News_moveRankTest.php | 4 +- .../SC_Helper_News_rankDownTest.php | 4 +- .../SC_Helper_News_rankUpTest.php | 4 +- .../SC_Helper_News_saveNewsTest.php | 4 +- 17 files changed, 171 insertions(+), 170 deletions(-) diff --git a/data/class/helper/SC_Helper_Purchase.php b/data/class/helper/SC_Helper_Purchase.php index 034fc54e1b..9f9bce70f0 100644 --- a/data/class/helper/SC_Helper_Purchase.php +++ b/data/class/helper/SC_Helper_Purchase.php @@ -261,6 +261,7 @@ public static function getOrderTemp($uniqId) $objQuery = SC_Query_Ex::getSingletonInstance(); $result = $objQuery->getRow('*', 'dtb_order_temp', 'order_temp_id = ?', [$uniqId]); + return is_array($result) ? $result : []; // 必ず配列を返す } diff --git a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php index bfc3ae08d2..bd711ebe7b 100644 --- a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php +++ b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php @@ -1,7 +1,7 @@ objNews = new SC_Helper_News_Ex(); - } - - protected function tearDown(): void - { - parent::tearDown(); - } - - // /////////////////////////////////////// - - public function testGetList削除されたニュースも含む場合全てのニュース一覧が取得できる() - { - $objQuery = SC_Query_Ex::getSingletonInstance(); - $this->setUpNews(); - $dispNumber = 0; - $pageNumber = 0; - $has_deleted = true; - - $this->expected = [ - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1004', - 'news_title' => 'ニュース情報04', - 'creator_id' => '1', - 'del_flg' => '0', - ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1003', - 'news_title' => 'ニュース情報03', - 'creator_id' => '1', - 'del_flg' => '1', - ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1002', - 'news_title' => 'ニュース情報02', - 'creator_id' => '1', - 'del_flg' => '0', - ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1001', - 'news_title' => 'ニュース情報01', - 'creator_id' => '1', - 'del_flg' => '0', - ], - ]; - $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); - foreach ($result as $value) { - $this->actual[] = Test_Utils::mapArray($value, ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); + protected function setUp(): void + { + parent::setUp(); + $this->objNews = new SC_Helper_News_Ex(); } - $this->verify(); - } - - public function testGetList削除されたニュースは含まない場合削除されていないニュース一覧が取得できる() - { - $objQuery = SC_Query_Ex::getSingletonInstance(); - $this->setUpNews(); - $dispNumber = 0; - $pageNumber = 0; - $has_deleted = false; - - $this->expected = [ - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1004', - 'news_title' => 'ニュース情報04', - 'creator_id' => '1', - 'del_flg' => '0', - ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1002', - 'news_title' => 'ニュース情報02', - 'creator_id' => '1', - 'del_flg' => '0', - ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1001', - 'news_title' => 'ニュース情報01', - 'creator_id' => '1', - 'del_flg' => '0', - ], - ]; - - $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); - foreach ($result as $value) { - $this->actual[] = Test_Utils::mapArray($value, ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); + protected function tearDown(): void + { + parent::tearDown(); } - $this->verify(); - } - - public function testGetList表示件数1かつページ番号3の場合対象のニュースが取得できる() - { - $objQuery = SC_Query_Ex::getSingletonInstance(); - $this->setUpNews(); - $dispNumber = 1; - $pageNumber = 3; - $has_deleted = false; - - $this->expected = [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1001', - 'news_title' => 'ニュース情報01', - 'creator_id' => '1', - 'del_flg' => '0', - ]; - - $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); - $this->actual = Test_Utils::mapArray($result[0], ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); - - $this->verify(); - } - - public function testGetList表示件数1かつページ番号0の場合対象のニュースが取得できる() - { - $objQuery = SC_Query_Ex::getSingletonInstance(); - $this->setUpNews(); - $dispNumber = 1; - $pageNumber = 0; - $has_deleted = false; - - $this->expected = [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1004', - 'news_title' => 'ニュース情報04', - 'creator_id' => '1', - 'del_flg' => '0', - ]; - - $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); - $this->actual = Test_Utils::mapArray($result[0], ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); - - $this->verify(); - } + // /////////////////////////////////////// + + public function testGetList削除されたニュースも含む場合全てのニュース一覧が取得できる() + { + $objQuery = SC_Query_Ex::getSingletonInstance(); + $this->setUpNews(); + $dispNumber = 0; + $pageNumber = 0; + $has_deleted = true; + + $this->expected = [ + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1004', + 'news_title' => 'ニュース情報04', + 'creator_id' => '1', + 'del_flg' => '0', + ], + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1003', + 'news_title' => 'ニュース情報03', + 'creator_id' => '1', + 'del_flg' => '1', + ], + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1002', + 'news_title' => 'ニュース情報02', + 'creator_id' => '1', + 'del_flg' => '0', + ], + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1001', + 'news_title' => 'ニュース情報01', + 'creator_id' => '1', + 'del_flg' => '0', + ], + ]; + $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); + foreach ($result as $value) { + $this->actual[] = Test_Utils::mapArray($value, ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); + } + + $this->verify(); + } + + public function testGetList削除されたニュースは含まない場合削除されていないニュース一覧が取得できる() + { + $objQuery = SC_Query_Ex::getSingletonInstance(); + $this->setUpNews(); + $dispNumber = 0; + $pageNumber = 0; + $has_deleted = false; + + $this->expected = [ + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1004', + 'news_title' => 'ニュース情報04', + 'creator_id' => '1', + 'del_flg' => '0', + ], + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1002', + 'news_title' => 'ニュース情報02', + 'creator_id' => '1', + 'del_flg' => '0', + ], + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1001', + 'news_title' => 'ニュース情報01', + 'creator_id' => '1', + 'del_flg' => '0', + ], + ]; + + $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); + foreach ($result as $value) { + $this->actual[] = Test_Utils::mapArray($value, ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); + } + + $this->verify(); + } + + public function testGetList表示件数1かつページ番号3の場合対象のニュースが取得できる() + { + $objQuery = SC_Query_Ex::getSingletonInstance(); + $this->setUpNews(); + $dispNumber = 1; + $pageNumber = 3; + $has_deleted = false; + + $this->expected = [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1001', + 'news_title' => 'ニュース情報01', + 'creator_id' => '1', + 'del_flg' => '0', + ]; + + $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); + $this->actual = Test_Utils::mapArray($result[0], ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); + + $this->verify(); + } + + public function testGetList表示件数1かつページ番号0の場合対象のニュースが取得できる() + { + $objQuery = SC_Query_Ex::getSingletonInstance(); + $this->setUpNews(); + $dispNumber = 1; + $pageNumber = 0; + $has_deleted = false; + + $this->expected = [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1004', + 'news_title' => 'ニュース情報04', + 'creator_id' => '1', + 'del_flg' => '0', + ]; + + $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); + $this->actual = Test_Utils::mapArray($result[0], ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); + + $this->verify(); + } } diff --git a/tests/class/helper/SC_Helper_News/SC_Helper_News_moveRankTest.php b/tests/class/helper/SC_Helper_News/SC_Helper_News_moveRankTest.php index 6a3d559fbd..b48232f26e 100644 --- a/tests/class/helper/SC_Helper_News/SC_Helper_News_moveRankTest.php +++ b/tests/class/helper/SC_Helper_News/SC_Helper_News_moveRankTest.php @@ -1,7 +1,7 @@