corentin_wakdo/tests/Support/FakeNutritionGateway.php
Corentin JOGUET 10705858ac
All checks were successful
CI / secret-scan (push) Successful in 8s
CI / php-lint (push) Successful in 20s
CI / static-tests (push) Successful in 49s
CI / js-tests (push) Successful in 26s
feat(stock): enrichissement nutritionnel via API externe OpenFoodFacts (Cr 3.a.3) (#79)
2026-06-22 09:31:15 +02:00

26 lines
598 B
PHP

<?php
declare(strict_types=1);
namespace App\Tests\Support;
use App\Catalogue\NutritionGateway;
/**
* Double de NutritionGateway : renvoie un resultat fixe et trace le nom recherche.
* Permet de tester IngredientController::enrich sans appel reseau reel.
*/
final class FakeNutritionGateway implements NutritionGateway
{
/** @var array{energy_kcal_100g:int, source:string}|null */
public ?array $result = null;
public ?string $lookedUp = null;
public function lookupByName(string $name): ?array
{
$this->lookedUp = $name;
return $this->result;
}
}