diff --git a/src/Specification/Affectation/CodeInseeSpecification.php b/src/Specification/Affectation/CodeInseeSpecification.php index c7ae9a158..3fbbb1afd 100644 --- a/src/Specification/Affectation/CodeInseeSpecification.php +++ b/src/Specification/Affectation/CodeInseeSpecification.php @@ -8,12 +8,17 @@ use App\Specification\Context\PartnerSignalementContext; use App\Specification\Context\SpecificationContextInterface; use App\Specification\SpecificationInterface; +use Doctrine\Common\Collections\Collection; use Location\Coordinate; use Location\Polygon; use LongitudeOne\Geo\WKT\Parser; class CodeInseeSpecification implements SpecificationInterface { + private const TYPE_POLYGON = 'POLYGON'; + private const TYPE_MULTIPOLYGON = 'MULTIPOLYGON'; + private const TYPE_GEOMETRYCOLLECTION = 'GEOMETRYCOLLECTION'; + public function __construct(private array|string $inseeToInclude, private ?array $inseeToExclude) { if ('all' !== $inseeToInclude && 'partner_list' !== $inseeToInclude) { @@ -24,6 +29,13 @@ public function __construct(private array|string $inseeToInclude, private ?array $this->inseeToExclude = $inseeToExclude; } + private function isExcludedSignalement(Signalement $signalement): bool + { + $insee = $signalement->getInseeOccupant(); + + return null === $insee || '' === $insee || (!empty($this->inseeToExclude) && \in_array($insee, $this->inseeToExclude)); + } + public function isSatisfiedBy(SpecificationContextInterface $context): bool { if (!$context instanceof PartnerSignalementContext) { @@ -36,55 +48,56 @@ public function isSatisfiedBy(SpecificationContextInterface $context): bool /** @var Partner $partner */ $partner = $context->getPartner(); - if (null === $signalement->getInseeOccupant() - || '' === $signalement->getInseeOccupant() - || !empty($this->inseeToExclude) && \in_array($signalement->getInseeOccupant(), $this->inseeToExclude)) { + if ($this->isExcludedSignalement($signalement)) { return false; } - $result = false; - - switch ($this->inseeToInclude) { - case 'all': - $result = true; - break; - case 'partner_list': - $isZoneOK = true; - $isZoneExcludedOK = true; - $isInseeOK = !empty($partner->getInsee()) - && \in_array($signalement->getInseeOccupant(), $partner->getInsee()); - // var_dump($isInseeOK); - if ($isInseeOK) { - if (!empty($partner->getZones()) && $partner->getZones()->count() > 0) { - $isZoneOK = false; - foreach ($partner->getZones() as $zone) { - $isZoneOK = $this->isSignalementInZone($signalement, $zone); - if ($isZoneOK) { - break; - } - } - } - // var_dump($isZoneOK); - if ($isZoneOK && !empty($partner->getExcludedZones()) && $partner->getExcludedZones()->count() > 0) { - foreach ($partner->getExcludedZones() as $zoneExcluded) { - $isZoneExcludedOK = !$this->isSignalementInZone($signalement, $zoneExcluded); - if (!$isZoneExcludedOK) { - break; - } - } - } - // var_dump($isZoneExcludedOK); - } - - $result = $isInseeOK && $isZoneOK && $isZoneExcludedOK; - break; - default: - $result = !empty($this->inseeToInclude) - && \in_array($signalement->getInseeOccupant(), $this->inseeToInclude); - break; + return match ($this->inseeToInclude) { + 'all' => true, + 'partner_list' => $this->isPartnerListSatisfied($signalement, $partner), + default => $this->isInseeIncluded($signalement->getInseeOccupant()), + }; + } + + private function isPartnerListSatisfied(Signalement $signalement, Partner $partner): bool + { + $isZoneOK = true; + $isZoneExcludedOK = true; + $isInseeOK = $this->isInseeIncludeInPartnerList($partner, $signalement->getInseeOccupant()); + + if ($isInseeOK) { + $isZoneOK = $this->isInZone($signalement, $partner->getZones()); + if ($isZoneOK && $partner->getExcludedZones()->count() > 0) { + $isZoneExcludedOK = !$this->isInZone($signalement, $partner->getExcludedZones()); + } } - return $result; + return $isInseeOK && $isZoneOK && $isZoneExcludedOK; + } + + private function isInZone(Signalement $signalement, Collection $zones): bool + { + if (0 === $zones->count()) { + return true; + } + + foreach ($zones as $zone) { + if ($this->isSignalementInZone($signalement, $zone)) { + return true; + } + } + + return false; + } + + private function isInseeIncludeInPartnerList(Partner $partner, string $insee) + { + return !empty($partner->getInsee()) && \in_array($insee, $partner->getInsee()); + } + + private function isInseeIncluded(string $insee): bool + { + return !empty($this->inseeToInclude) && \in_array($insee, $this->inseeToInclude); } private function isSignalementInZone(Signalement $signalement, Zone $zone): bool @@ -92,38 +105,41 @@ private function isSignalementInZone(Signalement $signalement, Zone $zone): bool $parser = new Parser($zone->getArea()); $zoneArea = $parser->parse(); $signalementCoordinate = new Coordinate($signalement->getGeoloc()['lat'], $signalement->getGeoloc()['lng']); - // var_dump($signalement->getGeoloc()); - if ('POLYGON' === $zoneArea['type']) { - $polygon = $this->buildPolygon($zoneArea['value']); - // var_dump($polygon->contains($signalementCoordinate)); - if ($polygon->contains($signalementCoordinate)) { + + return match ($zoneArea['type']) { + self::TYPE_POLYGON => $this->isPointInPolygon($signalementCoordinate, $zoneArea['value']), + self::TYPE_MULTIPOLYGON => $this->isPointInMultiPolygon($signalementCoordinate, $zoneArea['value']), + self::TYPE_GEOMETRYCOLLECTION => $this->isPointInGeometryCollection($signalementCoordinate, $zoneArea['value']), + default => false, + }; + } + + private function isPointInPolygon(Coordinate $point, array $polygonData): bool + { + $polygon = $this->buildPolygon($polygonData); + + return $polygon->contains($point); + } + + private function isPointInMultiPolygon(Coordinate $point, array $multiPolygonData): bool + { + foreach ($multiPolygonData as $polygonData) { + if ($this->isPointInPolygon($point, $polygonData)) { return true; } } - if ('MULTIPOLYGON' === $zoneArea['type']) { - foreach ($zoneArea['value'] as $value) { - $polygon = $this->buildPolygon($value); - if ($polygon->contains($signalementCoordinate)) { - return true; - } + + return false; + } + + private function isPointInGeometryCollection(Coordinate $point, array $geometryCollection): bool + { + foreach ($geometryCollection as $geometry) { + if (self::TYPE_POLYGON === $geometry['type'] && $this->isPointInPolygon($point, $geometry['value'])) { + return true; } - } - if ('GEOMETRYCOLLECTION' === $zoneArea['type']) { - foreach ($zoneArea['value'] as $value) { - if ('POLYGON' === $value['type']) { - $polygon = $this->buildPolygon($value['value']); - if ($polygon->contains($signalementCoordinate)) { - return true; - } - } - if ('MULTIPOLYGON' === $value['type']) { - foreach ($value['value'] as $val) { - $polygon = $this->buildPolygon($val); - if ($polygon->contains($signalementCoordinate)) { - return true; - } - } - } + if (self::TYPE_MULTIPOLYGON === $geometry['type'] && $this->isPointInMultiPolygon($point, $geometry['value'])) { + return true; } } @@ -133,16 +149,13 @@ private function isSignalementInZone(Signalement $signalement, Zone $zone): bool private function buildPolygon(array $points): Polygon { $geofence = new Polygon(); - // var_dump($points); if (1 === \count($points) && \count($points[0]) > 2) { $points = $points[0]; } - // var_dump($points); foreach ($points as $point) { $geofence->addPoint(new Coordinate($point[1], $point[0])); } - // var_dump($geofence->getPoints()); return $geofence; } } diff --git a/tests/Functional/Specification/Affectation/CodeInseeSpecificationTest.php b/tests/Functional/Specification/Affectation/CodeInseeSpecificationTest.php index 30b0a87a7..27e36eaf5 100644 --- a/tests/Functional/Specification/Affectation/CodeInseeSpecificationTest.php +++ b/tests/Functional/Specification/Affectation/CodeInseeSpecificationTest.php @@ -29,6 +29,9 @@ class CodeInseeSpecificationTest extends KernelTestCase 'lng' => -1.455196, ]; + private const string INSEE_STMARS = '44179'; + private const string INSEE_CELLIER = '44028'; + /** * @dataProvider provideRulesAndSignalementWithZone */ @@ -75,98 +78,98 @@ public function testIsSatisfiedByWithZone( public function provideRulesAndSignalementWithZone(): \Generator { - yield 'same insee as partner - no excluded insee - same zone as geoloc, no zone excluded' => ['44179', ['44179'], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, true]; - yield 'same insee as partner - no excluded insee - same zone as geoloc, same zone as excluded' => ['44179', ['44179'], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false - yield 'same insee as partner - no excluded insee - same zone as geoloc, different zone as excluded' => ['44179', ['44179'], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, true]; - yield 'same insee as partner - no excluded insee - no zone - no zone excluded' => ['44179', ['44179'], null, $this->geolocLaBodiniere, null, null, true]; - yield 'same insee as partner - no excluded insee - no zone - same zone as excluded' => ['44179', ['44179'], null, $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; - yield 'same insee as partner - no excluded insee - no zone - different zone as excluded' => ['44179', ['44179'], null, $this->geolocLaBodiniere, null, $this->zoneBourgStMars, true]; - yield 'same insee as partner - no excluded insee - different zone as geoloc, no zone excluded' => ['44179', ['44179'], null, $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; - yield 'same insee as partner - no excluded insee - different zone as geoloc, same zone as excluded' => ['44179', ['44179'], null, $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; - yield 'same insee as partner - no excluded insee - different zone as geoloc, different zone as excluded' => ['44179', ['44179'], null, $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + yield 'same insee as partner - no excluded insee - same zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, true]; + yield 'same insee as partner - no excluded insee - same zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false + yield 'same insee as partner - no excluded insee - same zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, true]; + yield 'same insee as partner - no excluded insee - no zone - no zone excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], null, $this->geolocLaBodiniere, null, null, true]; + yield 'same insee as partner - no excluded insee - no zone - same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], null, $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; + yield 'same insee as partner - no excluded insee - no zone - different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], null, $this->geolocLaBodiniere, null, $this->zoneBourgStMars, true]; + yield 'same insee as partner - no excluded insee - different zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], null, $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; + yield 'same insee as partner - no excluded insee - different zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], null, $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + yield 'same insee as partner - no excluded insee - different zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], null, $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; // tout cela est illogique, et doit renvoyer false - yield 'same insee as partner - but excluded - same zone as geoloc, no zone excluded' => ['44179', ['44179'], ['44179'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, false]; - yield 'same insee as partner - but excluded - same zone as geoloc, same zone as excluded' => ['44179', ['44179'], ['44179'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false - yield 'same insee as partner - but excluded - same zone as geoloc, different zone as excluded' => ['44179', ['44179'], ['44179'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, false]; - yield 'same insee as partner - but excluded - no zone - no zone excluded' => ['44179', ['44179'], ['44179'], $this->geolocLaBodiniere, null, null, false]; - yield 'same insee as partner - but excluded - no zone - same zone as excluded' => ['44179', ['44179'], ['44179'], $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; - yield 'same insee as partner - but excluded - no zone - different zone as excluded' => ['44179', ['44179'], ['44179'], $this->geolocLaBodiniere, null, $this->zoneBourgStMars, false]; - yield 'same insee as partner - but excluded - different zone as geoloc, no zone excluded' => ['44179', ['44179'], ['44179'], $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; - yield 'same insee as partner - but excluded - different zone as geoloc, same zone as excluded' => ['44179', ['44179'], ['44179'], $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; - yield 'same insee as partner - but excluded - different zone as geoloc, different zone as excluded' => ['44179', ['44179'], ['44179'], $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; - - yield 'same insee as partner - another insee - same zone as geoloc, no zone excluded' => ['44179', ['44179'], ['44028'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, true]; - yield 'same insee as partner - another insee - same zone as geoloc, same zone as excluded' => ['44179', ['44179'], ['44028'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false - yield 'same insee as partner - another insee - same zone as geoloc, different zone as excluded' => ['44179', ['44179'], ['44028'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, true]; - yield 'same insee as partner - another insee - no zone - no zone excluded' => ['44179', ['44179'], ['44028'], $this->geolocLaBodiniere, null, null, true]; - yield 'same insee as partner - another insee - no zone - same zone as excluded' => ['44179', ['44179'], ['44028'], $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; - yield 'same insee as partner - another insee - no zone - different zone as excluded' => ['44179', ['44179'], ['44028'], $this->geolocLaBodiniere, null, $this->zoneBourgStMars, true]; - yield 'same insee as partner - another insee - different zone as geoloc, no zone excluded' => ['44179', ['44179'], ['44028'], $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; - yield 'same insee as partner - another insee - different zone as geoloc, same zone as excluded' => ['44179', ['44179'], ['44028'], $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; - yield 'same insee as partner - another insee - different zone as geoloc, different zone as excluded' => ['44179', ['44179'], ['44028'], $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; - - yield 'different insee than partner - no excluded insee - same zone as geoloc, no zone excluded' => ['44179', ['44028'], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, false]; - yield 'different insee than partner - no excluded insee - same zone as geoloc, same zone as excluded' => ['44179', ['44028'], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false - yield 'different insee than partner - no excluded insee - same zone as geoloc, different zone as excluded' => ['44179', ['44028'], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, false]; - yield 'different insee than partner - no excluded insee - no zone - no zone excluded' => ['44179', ['44028'], null, $this->geolocLaBodiniere, null, null, false]; - yield 'different insee than partner - no excluded insee - no zone - same zone as excluded' => ['44179', ['44028'], null, $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; - yield 'different insee than partner - no excluded insee - no zone - different zone as excluded' => ['44179', ['44028'], null, $this->geolocLaBodiniere, null, $this->zoneBourgStMars, false]; - yield 'different insee than partner - no excluded insee - different zone as geoloc, no zone excluded' => ['44179', ['44028'], null, $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; - yield 'different insee than partner - no excluded insee - different zone as geoloc, same zone as excluded' => ['44179', ['44028'], null, $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; - yield 'different insee than partner - no excluded insee - different zone as geoloc, different zone as excluded' => ['44179', ['44028'], null, $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + yield 'same insee as partner - but excluded - same zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_STMARS], $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, false]; + yield 'same insee as partner - but excluded - same zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_STMARS], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false + yield 'same insee as partner - but excluded - same zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_STMARS], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, false]; + yield 'same insee as partner - but excluded - no zone - no zone excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_STMARS], $this->geolocLaBodiniere, null, null, false]; + yield 'same insee as partner - but excluded - no zone - same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_STMARS], $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; + yield 'same insee as partner - but excluded - no zone - different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_STMARS], $this->geolocLaBodiniere, null, $this->zoneBourgStMars, false]; + yield 'same insee as partner - but excluded - different zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_STMARS], $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; + yield 'same insee as partner - but excluded - different zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_STMARS], $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + yield 'same insee as partner - but excluded - different zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_STMARS], $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + + yield 'same insee as partner - another insee - same zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_CELLIER], $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, true]; + yield 'same insee as partner - another insee - same zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_CELLIER], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false + yield 'same insee as partner - another insee - same zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_CELLIER], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, true]; + yield 'same insee as partner - another insee - no zone - no zone excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_CELLIER], $this->geolocLaBodiniere, null, null, true]; + yield 'same insee as partner - another insee - no zone - same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_CELLIER], $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; + yield 'same insee as partner - another insee - no zone - different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_CELLIER], $this->geolocLaBodiniere, null, $this->zoneBourgStMars, true]; + yield 'same insee as partner - another insee - different zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_CELLIER], $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; + yield 'same insee as partner - another insee - different zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_CELLIER], $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + yield 'same insee as partner - another insee - different zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], [self::INSEE_CELLIER], $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + + yield 'different insee than partner - no excluded insee - same zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, false]; + yield 'different insee than partner - no excluded insee - same zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false + yield 'different insee than partner - no excluded insee - same zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, false]; + yield 'different insee than partner - no excluded insee - no zone - no zone excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], null, $this->geolocLaBodiniere, null, null, false]; + yield 'different insee than partner - no excluded insee - no zone - same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], null, $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; + yield 'different insee than partner - no excluded insee - no zone - different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], null, $this->geolocLaBodiniere, null, $this->zoneBourgStMars, false]; + yield 'different insee than partner - no excluded insee - different zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], null, $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; + yield 'different insee than partner - no excluded insee - different zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], null, $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + yield 'different insee than partner - no excluded insee - different zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], null, $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; // tout cela est illogique, et doit renvoyer false - yield 'different insee than partner - but excluded - same zone as geoloc, no zone excluded' => ['44179', ['44028'], ['44179'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, false]; - yield 'different insee than partner - but excluded - same zone as geoloc, same zone as excluded' => ['44179', ['44028'], ['44179'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false - yield 'different insee than partner - but excluded - same zone as geoloc, different zone as excluded' => ['44179', ['44028'], ['44179'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, false]; - yield 'different insee than partner - but excluded - no zone - no zone excluded' => ['44179', ['44028'], ['44179'], $this->geolocLaBodiniere, null, null, false]; - yield 'different insee than partner - but excluded - no zone - same zone as excluded' => ['44179', ['44028'], ['44179'], $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; - yield 'different insee than partner - but excluded - no zone - different zone as excluded' => ['44179', ['44028'], ['44179'], $this->geolocLaBodiniere, null, $this->zoneBourgStMars, false]; - yield 'different insee than partner - but excluded - different zone as geoloc, no zone excluded' => ['44179', ['44028'], ['44179'], $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; - yield 'different insee than partner - but excluded - different zone as geoloc, same zone as excluded' => ['44179', ['44028'], ['44179'], $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; - yield 'different insee than partner - but excluded - different zone as geoloc, different zone as excluded' => ['44179', ['44028'], ['44179'], $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; - - yield 'different insee than partner - another insee excluded - same zone as geoloc, no zone excluded' => ['44179', ['44028'], ['44028'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, false]; - yield 'different insee than partner - another insee excluded - same zone as geoloc, same zone as excluded' => ['44179', ['44028'], ['44028'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false - yield 'different insee than partner - another insee excluded - same zone as geoloc, different zone as excluded' => ['44179', ['44028'], ['44028'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, false]; - yield 'different insee than partner - another insee excluded - no zone - no zone excluded' => ['44179', ['44028'], ['44028'], $this->geolocLaBodiniere, null, null, false]; - yield 'different insee than partner - another insee excluded - no zone - same zone as excluded' => ['44179', ['44028'], ['44028'], $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; - yield 'different insee than partner - another insee excluded - no zone - different zone as excluded' => ['44179', ['44028'], ['44028'], $this->geolocLaBodiniere, null, $this->zoneBourgStMars, false]; - yield 'different insee than partner - another insee excluded - different zone as geoloc, no zone excluded' => ['44179', ['44028'], ['44028'], $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; - yield 'different insee than partner - another insee excluded - different zone as geoloc, same zone as excluded' => ['44179', ['44028'], ['44028'], $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; - yield 'different insee than partner - another insee excluded - different zone as geoloc, different zone as excluded' => ['44179', ['44028'], ['44028'], $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; - - yield 'partner without insee - no excluded insee - same zone as geoloc, no zone excluded' => ['44179', [], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, false]; - yield 'partner without insee - no excluded insee - same zone as geoloc, same zone as excluded' => ['44179', [], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false - yield 'partner without insee - no excluded insee - same zone as geoloc, different zone as excluded' => ['44179', [], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, false]; - yield 'partner without insee - no excluded insee - no zone - no zone excluded' => ['44179', [], null, $this->geolocLaBodiniere, null, null, false]; - yield 'partner without insee - no excluded insee - no zone - same zone as excluded' => ['44179', [], null, $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; - yield 'partner without insee - no excluded insee - no zone - different zone as excluded' => ['44179', [], null, $this->geolocLaBodiniere, null, $this->zoneBourgStMars, false]; - yield 'partner without insee - no excluded insee - different zone as geoloc, no zone excluded' => ['44179', [], null, $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; - yield 'partner without insee - no excluded insee - different zone as geoloc, same zone as excluded' => ['44179', [], null, $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; - yield 'partner without insee - no excluded insee - different zone as geoloc, different zone as excluded' => ['44179', [], null, $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + yield 'different insee than partner - but excluded - same zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_STMARS], $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, false]; + yield 'different insee than partner - but excluded - same zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_STMARS], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false + yield 'different insee than partner - but excluded - same zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_STMARS], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, false]; + yield 'different insee than partner - but excluded - no zone - no zone excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_STMARS], $this->geolocLaBodiniere, null, null, false]; + yield 'different insee than partner - but excluded - no zone - same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_STMARS], $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; + yield 'different insee than partner - but excluded - no zone - different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_STMARS], $this->geolocLaBodiniere, null, $this->zoneBourgStMars, false]; + yield 'different insee than partner - but excluded - different zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_STMARS], $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; + yield 'different insee than partner - but excluded - different zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_STMARS], $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + yield 'different insee than partner - but excluded - different zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_STMARS], $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + + yield 'different insee than partner - another insee excluded - same zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_CELLIER], $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, false]; + yield 'different insee than partner - another insee excluded - same zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_CELLIER], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false + yield 'different insee than partner - another insee excluded - same zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_CELLIER], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, false]; + yield 'different insee than partner - another insee excluded - no zone - no zone excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_CELLIER], $this->geolocLaBodiniere, null, null, false]; + yield 'different insee than partner - another insee excluded - no zone - same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_CELLIER], $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; + yield 'different insee than partner - another insee excluded - no zone - different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_CELLIER], $this->geolocLaBodiniere, null, $this->zoneBourgStMars, false]; + yield 'different insee than partner - another insee excluded - different zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_CELLIER], $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; + yield 'different insee than partner - another insee excluded - different zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_CELLIER], $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + yield 'different insee than partner - another insee excluded - different zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], [self::INSEE_CELLIER], $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + + yield 'partner without insee - no excluded insee - same zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, false]; + yield 'partner without insee - no excluded insee - same zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false + yield 'partner without insee - no excluded insee - same zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [], null, $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, false]; + yield 'partner without insee - no excluded insee - no zone - no zone excluded' => [self::INSEE_STMARS, [], null, $this->geolocLaBodiniere, null, null, false]; + yield 'partner without insee - no excluded insee - no zone - same zone as excluded' => [self::INSEE_STMARS, [], null, $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; + yield 'partner without insee - no excluded insee - no zone - different zone as excluded' => [self::INSEE_STMARS, [], null, $this->geolocLaBodiniere, null, $this->zoneBourgStMars, false]; + yield 'partner without insee - no excluded insee - different zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [], null, $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; + yield 'partner without insee - no excluded insee - different zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [], null, $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + yield 'partner without insee - no excluded insee - different zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [], null, $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; // tout cela est illogique, et doit renvoyer false - yield 'partner without insee - but excluded - same zone as geoloc, no zone excluded' => ['44179', [], ['44179'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, false]; - yield 'partner without insee - but excluded - same zone as geoloc, same zone as excluded' => ['44179', [], ['44179'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false - yield 'partner without insee - but excluded - same zone as geoloc, different zone as excluded' => ['44179', [], ['44179'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, false]; - yield 'partner without insee - but excluded - no zone - no zone excluded' => ['44179', [], ['44179'], $this->geolocLaBodiniere, null, null, false]; - yield 'partner without insee - but excluded - no zone - same zone as excluded' => ['44179', [], ['44179'], $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; - yield 'partner without insee - but excluded - no zone - different zone as excluded' => ['44179', [], ['44179'], $this->geolocLaBodiniere, null, $this->zoneBourgStMars, false]; - yield 'partner without insee - but excluded - different zone as geoloc, no zone excluded' => ['44179', [], ['44179'], $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; - yield 'partner without insee - but excluded - different zone as geoloc, same zone as excluded' => ['44179', [], ['44179'], $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; - yield 'partner without insee - but excluded - different zone as geoloc, different zone as excluded' => ['44179', [], ['44179'], $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; - - yield 'partner without insee - another insee excluded - same zone as geoloc, no zone excluded' => ['44179', [], ['44028'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, false]; - yield 'partner without insee - another insee excluded - same zone as geoloc, same zone as excluded' => ['44179', [], ['44028'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false - yield 'partner without insee - another insee excluded - same zone as geoloc, different zone as excluded' => ['44179', [], ['44028'], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, false]; - yield 'partner without insee - another insee excluded - no zone - no zone excluded' => ['44179', [], ['44028'], $this->geolocLaBodiniere, null, null, false]; - yield 'partner without insee - another insee excluded - no zone - same zone as excluded' => ['44179', [], ['44028'], $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; - yield 'partner without insee - another insee excluded - no zone - different zone as excluded' => ['44179', [], ['44028'], $this->geolocLaBodiniere, null, $this->zoneBourgStMars, false]; - yield 'partner without insee - another insee excluded - different zone as geoloc, no zone excluded' => ['44179', [], ['44028'], $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; - yield 'partner without insee - another insee excluded - different zone as geoloc, same zone as excluded' => ['44179', [], ['44028'], $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; - yield 'partner without insee - another insee excluded - different zone as geoloc, different zone as excluded' => ['44179', [], ['44028'], $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + yield 'partner without insee - but excluded - same zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [], [self::INSEE_STMARS], $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, false]; + yield 'partner without insee - but excluded - same zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [], [self::INSEE_STMARS], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false + yield 'partner without insee - but excluded - same zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [], [self::INSEE_STMARS], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, false]; + yield 'partner without insee - but excluded - no zone - no zone excluded' => [self::INSEE_STMARS, [], [self::INSEE_STMARS], $this->geolocLaBodiniere, null, null, false]; + yield 'partner without insee - but excluded - no zone - same zone as excluded' => [self::INSEE_STMARS, [], [self::INSEE_STMARS], $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; + yield 'partner without insee - but excluded - no zone - different zone as excluded' => [self::INSEE_STMARS, [], [self::INSEE_STMARS], $this->geolocLaBodiniere, null, $this->zoneBourgStMars, false]; + yield 'partner without insee - but excluded - different zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [], [self::INSEE_STMARS], $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; + yield 'partner without insee - but excluded - different zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [], [self::INSEE_STMARS], $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + yield 'partner without insee - but excluded - different zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [], [self::INSEE_STMARS], $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + + yield 'partner without insee - another insee excluded - same zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [], [self::INSEE_CELLIER], $this->geolocLaBodiniere, $this->zoneLaBodiniere, null, false]; + yield 'partner without insee - another insee excluded - same zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [], [self::INSEE_CELLIER], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneLaBodiniere, false]; // illogique, mais à tester, doit renvoyer false + yield 'partner without insee - another insee excluded - same zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [], [self::INSEE_CELLIER], $this->geolocLaBodiniere, $this->zoneLaBodiniere, $this->zoneBourgStMars, false]; + yield 'partner without insee - another insee excluded - no zone - no zone excluded' => [self::INSEE_STMARS, [], [self::INSEE_CELLIER], $this->geolocLaBodiniere, null, null, false]; + yield 'partner without insee - another insee excluded - no zone - same zone as excluded' => [self::INSEE_STMARS, [], [self::INSEE_CELLIER], $this->geolocLaBodiniere, null, $this->zoneLaBodiniere, false]; + yield 'partner without insee - another insee excluded - no zone - different zone as excluded' => [self::INSEE_STMARS, [], [self::INSEE_CELLIER], $this->geolocLaBodiniere, null, $this->zoneBourgStMars, false]; + yield 'partner without insee - another insee excluded - different zone as geoloc, no zone excluded' => [self::INSEE_STMARS, [], [self::INSEE_CELLIER], $this->geolocLaBodiniere, $this->zoneBourgStMars, null, false]; + yield 'partner without insee - another insee excluded - different zone as geoloc, same zone as excluded' => [self::INSEE_STMARS, [], [self::INSEE_CELLIER], $this->geolocLaTourmentinerie, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; + yield 'partner without insee - another insee excluded - different zone as geoloc, different zone as excluded' => [self::INSEE_STMARS, [], [self::INSEE_CELLIER], $this->geolocLaGree, $this->zoneBourgStMars, $this->zoneBourgStMars, false]; } /** @@ -198,49 +201,49 @@ public function testIsSatisfiedByWithoutZone( public function provideRulesAndSignalementWithoutZone(): \Generator { - yield 'all - same insee as partner - no exclude' => ['44179', ['44179'], 'all', null, true]; - yield 'all - same insee as partner - but excluded' => ['44179', ['44179'], 'all', ['44179'], false]; - yield 'all - same insee as partner - another excluded' => ['44179', ['44179'], 'all', ['44028'], true]; - yield 'all - different insee than partner - no exclude' => ['44179', ['44028'], 'all', null, true]; - yield 'all - different insee than partner - but excluded' => ['44179', ['44028'], 'all', ['44179'], false]; - yield 'all - different insee than partner - another excluded' => ['44179', ['44028'], 'all', ['44028'], true]; - yield 'all - partner without insee - no exclude' => ['44179', [], 'all', null, true]; - yield 'all - partner without insee - but excluded' => ['44179', [], 'all', ['44179'], false]; - yield 'all - partner without insee - another excluded' => ['44179', [], 'all', ['44028'], true]; - - yield 'partner_list - same insee as partner - no exclusion' => ['44179', ['44179'], 'partner_list', null, true]; - yield 'partner_list - same insee as partner - but excluded' => ['44179', ['44179'], 'partner_list', ['44179'], false]; - yield 'partner_list - same insee as partner - another excluded' => ['44179', ['44179'], 'partner_list', ['44028'], true]; - yield 'partner_list - different insee than partner - no exclusion' => ['44179', ['44028'], 'partner_list', null, false]; - yield 'partner_list - different insee than partner - but excluded' => ['44179', ['44028'], 'partner_list', ['44179'], false]; - yield 'partner_list - different insee than partner - another excluded' => ['44179', ['44028'], 'partner_list', ['44028'], false]; - yield 'partner_list - partner without insee - no exclusion' => ['44179', [], 'partner_list', null, false]; - yield 'partner_list - partner without insee - but excluded' => ['44179', [], 'partner_list', ['44179'], false]; - yield 'partner_list - partner without insee - another excluded' => ['44179', [], 'partner_list', ['44028'], false]; - - yield 'array of insee with this one - same insee as partner - no exclusion' => ['44179', ['44179'], '44179', null, true]; - yield 'array of insee with this one - same insee as partner - but excluded' => ['44179', ['44179'], '44179', ['44179'], false]; - yield 'array of insee with this one - same insee as partner - another excluded' => ['44179', ['44179'], '44179', ['44028'], true]; - yield 'array of insee with this one - different insee than partner - no exclusion' => ['44179', ['44028'], '44179', null, true]; - yield 'array of insee with this one - different insee than partner - but excluded' => ['44179', ['44028'], '44179', ['44179'], false]; - yield 'array of insee with this one - different insee than partner - another excluded' => ['44179', ['44028'], '44179', ['44028'], true]; - yield 'array of insee with this one - partner without insee - no exclusion' => ['44179', [], '44179', null, true]; - yield 'array of insee with this one - partner without insee - but excluded' => ['44179', [], '44179', ['44179'], false]; - yield 'array of insee with this one - partner without insee - another excluded' => ['44179', [], '44179', ['44028'], true]; - - yield 'array of insee without this one - same insee as partner - no exclusion' => ['44179', ['44179'], '44028', null, false]; - yield 'array of insee without this one - same insee as partner - but excluded' => ['44179', ['44179'], '44028', ['44179'], false]; - yield 'array of insee without this one - same insee as partner - another excluded' => ['44179', ['44179'], '44028', ['44028'], false]; - yield 'array of insee without this one - different insee than partner - no exclusion' => ['44179', ['44028'], '44028', null, false]; - yield 'array of insee without this one - different insee than partner - but excluded' => ['44179', ['44028'], '44028', ['44179'], false]; - yield 'array of insee without this one - different insee than partner - another excluded' => ['44179', ['44028'], '44028', ['44028'], false]; - yield 'array of insee without this one - partner without insee - no exclusion' => ['44179', [], '44028', null, false]; - yield 'array of insee without this one - partner without insee - but excluded' => ['44179', [], '44028', ['44179'], false]; - yield 'array of insee without this one - partner without insee - another excluded' => ['44179', [], '44028', ['44028'], false]; + yield 'all - same insee as partner - no exclude' => [self::INSEE_STMARS, [self::INSEE_STMARS], 'all', null, true]; + yield 'all - same insee as partner - but excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], 'all', [self::INSEE_STMARS], false]; + yield 'all - same insee as partner - another excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], 'all', [self::INSEE_CELLIER], true]; + yield 'all - different insee than partner - no exclude' => [self::INSEE_STMARS, [self::INSEE_CELLIER], 'all', null, true]; + yield 'all - different insee than partner - but excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], 'all', [self::INSEE_STMARS], false]; + yield 'all - different insee than partner - another excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], 'all', [self::INSEE_CELLIER], true]; + yield 'all - partner without insee - no exclude' => [self::INSEE_STMARS, [], 'all', null, true]; + yield 'all - partner without insee - but excluded' => [self::INSEE_STMARS, [], 'all', [self::INSEE_STMARS], false]; + yield 'all - partner without insee - another excluded' => [self::INSEE_STMARS, [], 'all', [self::INSEE_CELLIER], true]; + + yield 'partner_list - same insee as partner - no exclusion' => [self::INSEE_STMARS, [self::INSEE_STMARS], 'partner_list', null, true]; + yield 'partner_list - same insee as partner - but excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], 'partner_list', [self::INSEE_STMARS], false]; + yield 'partner_list - same insee as partner - another excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], 'partner_list', [self::INSEE_CELLIER], true]; + yield 'partner_list - different insee than partner - no exclusion' => [self::INSEE_STMARS, [self::INSEE_CELLIER], 'partner_list', null, false]; + yield 'partner_list - different insee than partner - but excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], 'partner_list', [self::INSEE_STMARS], false]; + yield 'partner_list - different insee than partner - another excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], 'partner_list', [self::INSEE_CELLIER], false]; + yield 'partner_list - partner without insee - no exclusion' => [self::INSEE_STMARS, [], 'partner_list', null, false]; + yield 'partner_list - partner without insee - but excluded' => [self::INSEE_STMARS, [], 'partner_list', [self::INSEE_STMARS], false]; + yield 'partner_list - partner without insee - another excluded' => [self::INSEE_STMARS, [], 'partner_list', [self::INSEE_CELLIER], false]; + + yield 'array of insee with this one - same insee as partner - no exclusion' => [self::INSEE_STMARS, [self::INSEE_STMARS], self::INSEE_STMARS, null, true]; + yield 'array of insee with this one - same insee as partner - but excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], self::INSEE_STMARS, [self::INSEE_STMARS], false]; + yield 'array of insee with this one - same insee as partner - another excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], self::INSEE_STMARS, [self::INSEE_CELLIER], true]; + yield 'array of insee with this one - different insee than partner - no exclusion' => [self::INSEE_STMARS, [self::INSEE_CELLIER], self::INSEE_STMARS, null, true]; + yield 'array of insee with this one - different insee than partner - but excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], self::INSEE_STMARS, [self::INSEE_STMARS], false]; + yield 'array of insee with this one - different insee than partner - another excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], self::INSEE_STMARS, [self::INSEE_CELLIER], true]; + yield 'array of insee with this one - partner without insee - no exclusion' => [self::INSEE_STMARS, [], self::INSEE_STMARS, null, true]; + yield 'array of insee with this one - partner without insee - but excluded' => [self::INSEE_STMARS, [], self::INSEE_STMARS, [self::INSEE_STMARS], false]; + yield 'array of insee with this one - partner without insee - another excluded' => [self::INSEE_STMARS, [], self::INSEE_STMARS, [self::INSEE_CELLIER], true]; + + yield 'array of insee without this one - same insee as partner - no exclusion' => [self::INSEE_STMARS, [self::INSEE_STMARS], self::INSEE_CELLIER, null, false]; + yield 'array of insee without this one - same insee as partner - but excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], self::INSEE_CELLIER, [self::INSEE_STMARS], false]; + yield 'array of insee without this one - same insee as partner - another excluded' => [self::INSEE_STMARS, [self::INSEE_STMARS], self::INSEE_CELLIER, [self::INSEE_CELLIER], false]; + yield 'array of insee without this one - different insee than partner - no exclusion' => [self::INSEE_STMARS, [self::INSEE_CELLIER], self::INSEE_CELLIER, null, false]; + yield 'array of insee without this one - different insee than partner - but excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], self::INSEE_CELLIER, [self::INSEE_STMARS], false]; + yield 'array of insee without this one - different insee than partner - another excluded' => [self::INSEE_STMARS, [self::INSEE_CELLIER], self::INSEE_CELLIER, [self::INSEE_CELLIER], false]; + yield 'array of insee without this one - partner without insee - no exclusion' => [self::INSEE_STMARS, [], self::INSEE_CELLIER, null, false]; + yield 'array of insee without this one - partner without insee - but excluded' => [self::INSEE_STMARS, [], self::INSEE_CELLIER, [self::INSEE_STMARS], false]; + yield 'array of insee without this one - partner without insee - another excluded' => [self::INSEE_STMARS, [], self::INSEE_CELLIER, [self::INSEE_CELLIER], false]; // tous les cas ne sont pas testés en cas d'absence d'insee sur le signalement, car ça renvoie toujours false - yield 'all - no insee signalement' => [null, ['44028'], 'all', ['44028'], false]; - yield 'partner_list - no insee signalement - another excluded' => [null, [], 'partner_list', ['44028'], false]; - yield 'array of insee - no insee signalement - another excluded' => [null, [], '44179', ['44028'], false]; + yield 'all - no insee signalement' => [null, [self::INSEE_CELLIER], 'all', [self::INSEE_CELLIER], false]; + yield 'partner_list - no insee signalement - another excluded' => [null, [], 'partner_list', [self::INSEE_CELLIER], false]; + yield 'array of insee - no insee signalement - another excluded' => [null, [], self::INSEE_STMARS, [self::INSEE_CELLIER], false]; } }