Skip to content

Commit

Permalink
リファクタリング
Browse files Browse the repository at this point in the history
  • Loading branch information
dotani1111 committed Sep 27, 2023
1 parent 19ad1fb commit 72c5d45
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions codeception/acceptance/EA03ProductCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class EA03ProductCest
private EntityManager $em;

/** @var Connection */
private $conn;
private Connection $conn;

const ページタイトル = '#main .page-header';
const ページタイトルStyleGuide = '.c-pageTitle';
Expand Down Expand Up @@ -1071,14 +1071,12 @@ public function product_一覧からの規格編集_規格あり_重複在庫の
$ProductClass = $ProductClasses[0];
$id = $ProductClass->getId();

// DBからレコード数とStockを取得
$sql = 'SELECT count(*), stock FROM dtb_product_stock WHERE product_class_id = ?';
$result = $this->conn->fetchAssociative($sql, [$id]);
$count = $result['count(*)'];
$stock = $result['stock'];
// 該当IDの商品が1つか確認
$count = $this->conn->fetchOne('SELECT COUNT(*) FROM dtb_product_stock WHERE product_class_id = ?', [$id]);
$I->assertEquals('1', $count, '該当データは1件です');

// 個数のズレがないか検査
// 個数のズレがないか確認
$stock = $this->conn->fetchOne('SELECT stock FROM dtb_product_stock WHERE product_class_id = ?', [$id]);
$I->assertEquals('10', $stock, 'Stockが一致');
$I->assertEquals('1', $count, '該当データは1件です');
}
}

0 comments on commit 72c5d45

Please sign in to comment.