Skip to content

Commit

Permalink
時折失敗するテストの修正
Browse files Browse the repository at this point in the history
- Repository/ProductRepositoryGetQueryBuilderBySearchDataAdminTest
  - 在庫の初期化処理を修正
- Web/Admin/IndexControllerTest
  - テストが失敗した場合に詳細を出力
  • Loading branch information
nanasess committed Oct 19, 2016
1 parent 7647cfd commit 8afebc6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,19 @@ public function testLinkStatus()

public function testStockStatus()
{
$faker = $this->getFaker();
// 全商品の在庫を 1 以上にしておく
$Products = $this->app['eccube.repository.product']->findAll();
foreach ($Products as $Product) {
foreach ($Product->getProductClasses() as $ProductClass) {
$ProductClass
->setStockUnlimited(false)
->setStock($faker->numberBetween(1, 999));
}
}
$this->app['orm.em']->flush();

// 1商品だけ 0 に設定する
$Product = $this->app['eccube.repository.product']->findOneBy(array('name' => '商品-1'));
foreach ($Product->getProductClasses() as $ProductClass) {
$ProductClass
Expand Down
12 changes: 10 additions & 2 deletions tests/Eccube/Tests/Web/Admin/IndexControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,17 @@ public function testChangePasswordWithPost()
$Member = clone $this->Member;
$Member->setPassword($form['change_password']['first']);

$this->expected = $this->app['eccube.repository.member']->encryptPassword($Member);;
$this->expected = $this->app['eccube.repository.member']->encryptPassword($Member);
$this->actual = $this->Member->getPassword();
$this->verify();

$this->verify(
'パスワードのハッシュ値が異なります '.PHP_EOL
.' AUTH_MAGIC='.$this->app['config']['auth_magic'].PHP_EOL
.' HASH_Algos='.$this->app['config']['password_hash_algos'].PHP_EOL
.' Input Password='.$form['change_password']['first'].PHP_EOL
.' Expected: salt='.$Member->getSalt().', raw password='.$Member->getPassword().PHP_EOL
.' Actual: salt='.$this->Member->getSalt()
);
}

public function testChangePasswordWithPostInvalid()
Expand Down

0 comments on commit 8afebc6

Please sign in to comment.