Skip to content

Commit

Permalink
Merge pull request EC-CUBE#6119 from chihiro-adachi/fix-image
Browse files Browse the repository at this point in the history
ダミー画像の生成時にテストが落ちる問題を修正
  • Loading branch information
dotani1111 authored Mar 22, 2024
2 parents 4ddbd56 + 189054b commit 20e9b91
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/Eccube/Tests/Fixture/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
use Eccube\Service\PurchaseFlow\PurchaseContext;
use Eccube\Service\PurchaseFlow\PurchaseFlow;
use Eccube\Util\StringUtil;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
Expand Down Expand Up @@ -415,11 +416,11 @@ public function createProduct($product_name = null, $product_class_num = 3, $wit
for ($i = 0; $i < 3; $i++) {
$ProductImage = new ProductImage();
if ($with_image) {
$width = $faker->numberBetween(480, 640);
$height = $faker->numberBetween(480, 640);
$image = $faker->uuid.'.jpg';
$src = file_get_contents('https://placekitten.com/'.$width.'/'.$height);
file_put_contents(__DIR__.'/../../../../html/upload/save_image/'.$image, $src);
$image = $faker->uuid.'.png';
$src = __DIR__.'/../../../../html/upload/save_image/no_image_product.png';
$dist = __DIR__.'/../../../../html/upload/save_image/'.$image;
$fs = new Filesystem();
$fs->copy($src, $dist);
} else {
$image = $faker->word.'.jpg';
}
Expand Down

0 comments on commit 20e9b91

Please sign in to comment.