-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #824 from EC-CUBE/seasoft-385-add1
#385 のPHP8対応、PHP5対応、軽微な修正、テスト調整
- Loading branch information
Showing
3 changed files
with
22 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ public function testSfGetBasisDataCache_キャッシュがなく生成もしな | |
unlink($this->cashFilePath); | ||
} | ||
$this->expected = array(); | ||
$this->actual = SC_Helper_DB_sfGetBasisDataCacheMock::sfGetBasisDataCache(); | ||
$this->actual = SC_Helper_DB_Ex::sfGetBasisDataCache(); | ||
$this->verify(); | ||
} | ||
|
||
|
@@ -62,75 +62,8 @@ public function testSfGetBasisDataCache_キャッシュがなく生成する場 | |
if (file_exists($this->cashFilePath)) { | ||
unlink($this->cashFilePath); | ||
} | ||
$this->expected = array( | ||
'id' => '1', | ||
'company_name' => 'testshop', | ||
'company_kana' => 'テストショップ', | ||
'zip01' => '530', | ||
'zip02' => '0001', | ||
'pref' => '1', | ||
'addr01' => 'testaddr01', | ||
'addr02' => 'testaddr02', | ||
'tel01' => '11', | ||
'tel02' => '2222', | ||
'tel03' => '3333', | ||
'fax01' => '11', | ||
'fax02' => '2222', | ||
'fax03' => '3333', | ||
'business_hour' => '09-18', | ||
'law_company' => 'lawcampanyname', | ||
'law_manager' => 'lawmanager', | ||
'law_zip01' => '530', | ||
'law_zip02' => '0001', | ||
'law_pref' => '1', | ||
'law_addr01' => 'lawaddr01', | ||
'law_addr02' => 'lawaddr02', | ||
'law_tel01' => '11', | ||
'law_tel02' => '2222', | ||
'law_tel03' => '3333', | ||
'law_fax01' => '11', | ||
'law_fax02' => '2222', | ||
'law_fax03' => '3333', | ||
'law_email' => '[email protected]', | ||
'law_url' => 'http://test.test', | ||
'law_term01' => 'lawterm01', | ||
'law_term02' => 'lawterm02', | ||
'law_term03' => 'lawterm03', | ||
'law_term04' => 'lawterm04', | ||
'law_term05' => 'lawterm05', | ||
'law_term06' => 'lawterm06', | ||
'law_term07' => 'lawterm07', | ||
'law_term08' => 'lawterm08', | ||
'law_term09' => 'lawterm09', | ||
'law_term10' => 'lawterm10', | ||
'email01' => '[email protected]', | ||
'email02' => '[email protected]', | ||
'email03' => '[email protected]', | ||
'email04' => '[email protected]', | ||
'free_rule' => '1000', | ||
'shop_name' => 'shopname', | ||
'shop_kana' => 'ショップネーム', | ||
'shop_name_eng' => 'shopnameeng', | ||
'point_rate' => '10', | ||
'welcome_point' => '100', | ||
'update_date' => '2012-02-14 11:22:33', | ||
'top_tpl' => 'top.tpl', | ||
'product_tpl' => 'product.tpl', | ||
'detail_tpl' => 'detail.tpl', | ||
'mypage_tpl' => 'mypage.tpl', | ||
'good_traded' => 'goodtraded', | ||
'message' => 'message', | ||
'regular_holiday_ids' => '0|6', | ||
'latitude' => '30.0001', | ||
'longitude' => '45.0001', | ||
'downloadable_days' => '10', | ||
'downloadable_days_unlimited' => '0', | ||
'zipcode' => null, | ||
'country_id' => null, | ||
'law_zipcode' => null, | ||
'law_country_id' => null, | ||
); | ||
$this->actual = SC_Helper_DB_sfGetBasisDataCacheMock::sfGetBasisDataCache(true); | ||
$this->expected = SC_Helper_DB_Ex::getBasisDataFromDB(); | ||
$this->actual = SC_Helper_DB_Ex::sfGetBasisDataCache(true); | ||
$this->verify(); | ||
} | ||
|
||
|
@@ -140,7 +73,7 @@ public function testSfGetBasisDataCache_キャッシュがある場合_キャッ | |
if (file_exists($this->cashFilePath)) { | ||
unlink($this->cashFilePath); | ||
} | ||
SC_Helper_DB_sfGetBasisDataCacheMock::sfCreateBasisDataCache(); | ||
SC_Helper_DB_Ex::sfCreateBasisDataCache(); | ||
$this->expected = array( | ||
'id' => '1', | ||
'company_name' => 'testshop', | ||
|
@@ -204,108 +137,13 @@ public function testSfGetBasisDataCache_キャッシュがある場合_キャッ | |
'longitude' => '45.0001', | ||
'downloadable_days' => '10', | ||
'downloadable_days_unlimited' => '0', | ||
'tax' => '5', | ||
'tax_rule' => '1', | ||
'zipcode' => null, | ||
'country_id' => null, | ||
'law_zipcode' => null, | ||
'law_country_id' => null, | ||
); | ||
$this->actual = SC_Helper_DB_sfGetBasisDataCacheMock::sfGetBasisDataCache(); | ||
$this->actual = SC_Helper_DB_Ex::sfGetBasisDataCache(); | ||
unlink($this->cashFilePath); | ||
$this->verify(); | ||
} | ||
|
||
} | ||
|
||
class SC_Helper_DB_sfGetBasisDataCacheMock extends SC_Helper_DB_Ex | ||
{ | ||
public static function sfCreateBasisDataCache() | ||
{ | ||
// テーブル名 | ||
$name = 'dtb_baseinfo'; | ||
// キャッシュファイルパス | ||
$filepath = MASTER_DATA_REALDIR . $name . '.serial'; | ||
// データ取得 | ||
$arrData = array( | ||
'id' => '1', | ||
'company_name' => 'testshop', | ||
'company_kana' => 'テストショップ', | ||
'zip01' => '530', | ||
'zip02' => '0001', | ||
'pref' => '1', | ||
'addr01' => 'testaddr01', | ||
'addr02' => 'testaddr02', | ||
'tel01' => '11', | ||
'tel02' => '2222', | ||
'tel03' => '3333', | ||
'fax01' => '11', | ||
'fax02' => '2222', | ||
'fax03' => '3333', | ||
'business_hour' => '09-18', | ||
'law_company' => 'lawcampanyname', | ||
'law_manager' => 'lawmanager', | ||
'law_zip01' => '530', | ||
'law_zip02' => '0001', | ||
'law_pref' => '1', | ||
'law_addr01' => 'lawaddr01', | ||
'law_addr02' => 'lawaddr02', | ||
'law_tel01' => '11', | ||
'law_tel02' => '2222', | ||
'law_tel03' => '3333', | ||
'law_fax01' => '11', | ||
'law_fax02' => '2222', | ||
'law_fax03' => '3333', | ||
'law_email' => '[email protected]', | ||
'law_url' => 'http://test.test', | ||
'law_term01' => 'lawterm01', | ||
'law_term02' => 'lawterm02', | ||
'law_term03' => 'lawterm03', | ||
'law_term04' => 'lawterm04', | ||
'law_term05' => 'lawterm05', | ||
'law_term06' => 'lawterm06', | ||
'law_term07' => 'lawterm07', | ||
'law_term08' => 'lawterm08', | ||
'law_term09' => 'lawterm09', | ||
'law_term10' => 'lawterm10', | ||
'tax' => '5', | ||
'tax_rule' => '1', | ||
'email01' => '[email protected]', | ||
'email02' => '[email protected]', | ||
'email03' => '[email protected]', | ||
'email04' => '[email protected]', | ||
'free_rule' => '1000', | ||
'shop_name' => 'shopname', | ||
'shop_kana' => 'ショップネーム', | ||
'shop_name_eng' => 'shopnameeng', | ||
'point_rate' => '10', | ||
'welcome_point' => '100', | ||
'update_date' => '2012-02-14 11:22:33', | ||
'top_tpl' => 'top.tpl', | ||
'product_tpl' => 'product.tpl', | ||
'detail_tpl' => 'detail.tpl', | ||
'mypage_tpl' => 'mypage.tpl', | ||
'good_traded' => 'goodtraded', | ||
'message' => 'message', | ||
'regular_holiday_ids' => '0|6', | ||
'latitude' => '30.0001', | ||
'longitude' => '45.0001', | ||
'downloadable_days' => '10', | ||
'downloadable_days_unlimited' => '0' | ||
); | ||
// シリアライズ | ||
$data = serialize($arrData); | ||
// ファイルを書き出しモードで開く | ||
$handle = fopen($filepath, 'w'); | ||
if (!$handle) { | ||
// ファイル生成失敗 | ||
return false; | ||
} | ||
// ファイルの内容を書き出す. | ||
$res = fwrite($handle, $data); | ||
// ファイルを閉じる | ||
fclose($handle); | ||
if ( $res === false) { | ||
// ファイル生成失敗 | ||
return false; | ||
} | ||
// ファイル生成成功 | ||
return true; | ||
} | ||
} |