corentin_wakdo/tests/Support/FakeNutritionGateway.php
Imugiii 1bef859c21
All checks were successful
CI / secret-scan (push) Successful in 8s
CI / php-lint (push) Successful in 19s
CI / secret-scan (pull_request) Successful in 9s
CI / php-lint (pull_request) Successful in 21s
CI / static-tests (push) Successful in 43s
CI / js-tests (push) Successful in 25s
CI / static-tests (pull_request) Successful in 48s
CI / js-tests (pull_request) Successful in 24s
feat(stock): enrichissement nutritionnel via API externe OpenFoodFacts (Cr 3.a.3)
2026-06-22 07:08:22 +00: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;
}
}