public function testGetOrderTemp_存在する受注IDを指定した場合_対応する結果が取得できる()
 {
     $order_temp_id = '1002';
     $this->expected = array('order_temp_id' => '1002', 'customer_id' => '1002', 'order_name01' => '受注情報02');
     $result = SC_Helper_Purchase::getOrderTemp($order_temp_id);
     $this->actual = Test_Utils::mapArray($result, array('order_temp_id', 'customer_id', 'order_name01'));
     $this->verify();
 }
 public function testGetByRank_ランクが存在かつ_has_deletedの場合_対応した結果が返る()
 {
     $rank = '2';
     $this->expected = array('best_id' => '1002', 'category_id' => '0', 'title' => 'タイトルですよ', 'comment' => 'コメントですよ', 'del_flg' => '1');
     $result = SC_Helper_BestProducts_Ex::getByRank($rank, true);
     $this->actual = Test_Utils::mapArray($result, array('best_id', 'category_id', 'title', 'comment', 'del_flg'));
     $this->verify();
 }
 public function testGetBestProducts_削除済みでかつhas_deletedがtrueの場合_対応した結果が返る()
 {
     $best_id = '1002';
     $this->expected = array('category_id' => '0', 'rank' => '2', 'title' => 'タイトルですよ', 'comment' => 'コメントですよ', 'del_flg' => '1');
     $result = SC_Helper_BestProducts_Ex::getBestProducts($best_id, true);
     $this->actual = Test_Utils::mapArray($result, array('category_id', 'rank', 'title', 'comment', 'del_flg'));
     $this->verify();
 }
 public function testGetByName_削除済みでかつhas_deletedがtrueの場合_対応した結果が返る()
 {
     $best_id = '1002';
     $this->expected = array('maker_id' => '1002', 'name' => 'パソナニック', 'rank' => '2', 'creator_id' => '2', 'create_date' => '2000-01-01 00:00:00', 'update_date' => '2000-01-01 00:00:00', 'del_flg' => '1');
     $result = $this->objHelperMaker->getMaker("1002", true);
     $this->actual = Test_Utils::mapArray($result, array('maker_id', 'name', 'rank', 'creator_id', 'create_date', 'update_date', 'del_flg'));
     $this->verify();
 }
 public function testGetPaymentsByPaymentsId_存在する支払IDを指定した場合_対応する支払方法の情報が取得できる()
 {
     $payment_id = '1001';
     $this->expected = array('payment_id' => '1001', 'payment_method' => '支払方法1001');
     $helper = new SC_Helper_Purchase();
     $this->actual = $helper->getPaymentsByPaymentsId($payment_id);
     $this->actual = Test_Utils::mapArray($this->actual, array('payment_id', 'payment_method'));
     $this->verify('支払方法');
 }
 public function testGet_存在するニュースIDを指定した場合_対応する結果が取得できる()
 {
     $this->setUpNews();
     $news_id = '1001';
     $this->expected = array('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);
     $this->actual = Test_Utils::mapArray($result, array('update_date', 'news_id', 'news_title', 'creator_id', 'del_flg'));
     $this->verify();
 }
 public function test__コンパイル済みのファイルを配置するディレクトリが空になる()
 {
     SC_Utils::clearCompliedTemplate();
     $this->expected = array();
     $this->actual = array();
     Test_Utils::array_append($this->actual, COMPILE_REALDIR);
     Test_Utils::array_append($this->actual, COMPILE_ADMIN_REALDIR);
     Test_Utils::array_append($this->actual, SMARTPHONE_COMPILE_REALDIR);
     Test_Utils::array_append($this->actual, MOBILE_COMPILE_REALDIR);
     $this->verify('コンパイル済みファイルの格納先の中身');
 }
 public function testSaveBestProducts_ベストIDがない場合_インサートされる()
 {
     if (DB_TYPE != 'pgsql') {
         //postgresqlだとどうしてもDBエラーになるのでとりいそぎ回避
         $sqlVal = array('product_id' => '4', 'category_id' => '2', 'rank' => '4', 'title' => 'タイトルですよ1004', 'comment' => 'コメントですよ1004', 'creator_id' => '3', 'del_flg' => '0');
         $best_id = SC_Helper_BestProducts_Ex::saveBestProducts($sqlVal);
         $this->expected = array('product_id' => '4', 'category_id' => '2', 'rank' => '4', 'title' => 'タイトルですよ1004', 'comment' => 'コメントですよ1004', 'creator_id' => '3', 'del_flg' => '0');
         $arrRet = SC_Helper_BestProducts_Ex::getBestProducts($best_id);
         $this->actual = Test_Utils::mapArray($arrRet, array('product_id', 'category_id', 'rank', 'title', 'comment', '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 = array('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], array('update_date', 'news_id', 'news_title', 'creator_id', 'del_flg'));
     $this->verify();
 }
 public function testSaveMaker_メーカーIDがない場合_インサートされる()
 {
     //public function testSaveMaker_insert(){
     if (DB_TYPE != 'pgsql') {
         //postgresqlだとどうしてもDBエラーになるのでとりいそぎ回避
         $sqlVal = array('name' => 'フジスリー', 'creator_id' => '1', 'del_flg' => '0');
         $maker_id = $this->objHelperMaker->saveMaker($sqlVal);
         $this->expected = array('name' => 'フジスリー', 'rank' => '5', 'creator_id' => '1', 'del_flg' => '0');
         $arrRet = $this->objHelperMaker->getMaker($maker_id);
         $this->actual = Test_Utils::mapArray($arrRet, array('name', 'rank', 'creator_id', 'del_flg'));
         $this->verify();
     }
 }
 public function testGetShippings_商品取得フラグをOFFにした場合_結果に商品情報が含まれない()
 {
     $order_id = '1001';
     $this->expected['count'] = 1;
     $this->expected['first'] = array('order_id' => '1001', 'shipping_id' => '1', 'shipping_name01' => '配送情報01', 'shipping_date' => '2012-01-12 00:00:00');
     $this->expected['shipment_item_count'] = 0;
     $helper = new SC_Helper_Purchase();
     $result = $helper->getShippings($order_id, false);
     $this->actual['count'] = count($result);
     // shipping_idごとの配列になっているのでshipping_idで抽出
     $this->actual['first'] = Test_Utils::mapArray($result['1'], array('order_id', 'shipping_id', 'shipping_name01', 'shipping_date'));
     $this->actual['shipment_item_count'] = count($result['1']['shipment_item']);
     $this->verify('配送情報');
 }
 public function testGetDeliv_存在する商品種別IDを指定した場合_結果が正しい順序で取得できる()
 {
     $product_type_id = '1001';
     $this->expected['count'] = 2;
     $this->expected['first'] = array('deliv_id' => '1002', 'product_type_id' => '1001', 'name' => '配送業者02', 'rank' => '3');
     $this->expected['second'] = array('deliv_id' => '1001', 'product_type_id' => '1001', 'name' => '配送業者01', 'rank' => '2');
     $helper = new SC_Helper_Purchase();
     $result = $helper->getDeliv($product_type_id);
     $this->actual['count'] = count($result);
     $cols = array('deliv_id', 'product_type_id', 'name', 'rank');
     $this->actual['first'] = Test_Utils::mapArray($result[0], $cols);
     $this->actual['second'] = Test_Utils::mapArray($result[1], $cols);
     $this->verify('配送業者');
 }
 public function testGetShipmentItems_詳細フラグをOFFにした場合_結果に詳細情報が含まれない()
 {
     $order_id = '1';
     $shipping_id = '1';
     $this->expected['count'] = 2;
     $this->expected['first'] = array('order_id' => '1', 'shipping_id' => '1', 'product_class_id' => '1001', 'product_name' => '商品名01', 'price' => '1500', 'productsClass' => null);
     $this->expected['second'] = array('order_id' => '1', 'shipping_id' => '1', 'product_class_id' => '1002', 'product_name' => '商品名02', 'price' => '2400', '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], array('order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass'));
     $this->actual['second'] = Test_Utils::mapArray($result[1], array('order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass'));
     $this->verify('配送情報');
 }
 public function testCopyDirectory_コピー先のファイルが元々存在する場合_上書きされる()
 {
     /**
      * tests/tmp/src
      *             /dir10
      *             /dir20/dir21
      *                   /file22.txt
      */
     mkdir(self::$TMP_DIR . "/src", 0700, true);
     mkdir(self::$TMP_DIR . "/src/dir10", 0700, true);
     mkdir(self::$TMP_DIR . "/src/dir20", 0700, true);
     mkdir(self::$TMP_DIR . "/src/dir20/dir21", 0700, true);
     $fp = fopen(self::$TMP_DIR . "/src/dir20/file22.txt", "w");
     fwrite($fp, "ec-cube test");
     fclose($fp);
     mkdir(self::$TMP_DIR . "/dst");
     mkdir(self::$TMP_DIR . "/dst/dir20");
     $fp_dist = fopen(self::$TMP_DIR . "/dst/dir20/file22.txt", "w");
     fwrite($fp_dist, "hello");
     fclose($fp_dist);
     SC_Utils::copyDirectory(self::$TMP_DIR . "/src/", self::$TMP_DIR . "/dst/");
     $this->expected = array("dir10", "dir20", "dir21", "file22.txt", "ec-cube test");
     $this->actual = array();
     Test_Utils::array_append($this->actual, Test_Utils::mapCols(SC_Helper_FileManager::sfGetFileList(self::$TMP_DIR . "/dst"), "file_name"));
     Test_Utils::array_append($this->actual, Test_Utils::mapCols(SC_Helper_FileManager::sfGetFileList(self::$TMP_DIR . "/dst/dir20"), "file_name"));
     $fp_final = fopen(self::$TMP_DIR . "/dst/dir20/file22.txt", "r");
     $read_result = fread($fp_final, 100);
     fclose($fp_final);
     $this->actual[] = $read_result;
     $this->verify('コピー先のファイル一覧');
 }
 public function testSfCopyDir_上書きフラグがONかつ書き込み権限がない場合_同名ファイルが上書きされない()
 {
     mkdir(self::$TMP_DIR . "/src", 0777, true);
     mkdir(self::$TMP_DIR . "/dst", 0777, true);
     // コピー先も作成しておく
     $fp = fopen(self::$TMP_DIR . "/src/test.txt", "w");
     fwrite($fp, "hello");
     fclose($fp);
     // 上書きされないファイル
     $test_file = self::$TMP_DIR . "/dst/test.txt";
     $fp = fopen($test_file, "w");
     fwrite($fp, "good morning");
     fclose($fp);
     chmod($test_file, 0444);
     // いったん読取専用にする
     $src = self::$TMP_DIR . "/src/";
     $dst = self::$TMP_DIR . "/dst/";
     $this->expected = array('dir_exists' => TRUE, 'files' => array('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');
     $fp = fopen($test_file, "r");
     $this->actual['file_content'] = fread($fp, 100);
     chmod($test_file, 0777);
     // verifyする前にパーミッションを戻す
     $this->verify();
 }
 public function testGetPaymentsByPrice_購入金額がすべての下限を下回る場合_下限の設定がないものだけ取得できる()
 {
     $deliv_id = '1003';
     $total = 9999;
     $helper = new SC_Helper_Purchase();
     $this->expected = array('3002', '3004');
     $result = $helper->getPaymentsByPrice($total, $deliv_id);
     $this->actual = Test_Utils::mapCols($result, 'payment_id');
     $this->verify();
 }