project = new Project($organization, 'Test', 'test', $french); $this->web = new Platform($this->project, 'Web', 'web', PlatformKind::Web, MessageFormat::I18next); $this->ios = new Platform($this->project, 'iOS', 'ios', PlatformKind::Ios, MessageFormat::Icu); } public function testArchivedPlatformLeavesTheActiveList(): void { self::assertCount(2, $this->project->getActivePlatforms()); $this->ios->archive(); self::assertSame([$this->web], $this->project->getActivePlatforms()); // …mais reste dans la liste complète : c'est ce qui permet de la // rétablir, et de comprendre pourquoi des clés lui sont rattachées. self::assertCount(2, $this->project->getPlatforms()); } public function testRestoringBringsThePlatformBack(): void { $this->ios->archive(); $this->ios->restore(); self::assertCount(2, $this->project->getActivePlatforms()); self::assertFalse($this->ios->isArchived()); self::assertNull($this->ios->getArchivedAt()); } public function testArchivingIsIdempotent(): void { $this->ios->archive(); $first = $this->ios->getArchivedAt(); $this->ios->archive(); // La date ne bouge pas : c'est celle du retrait, pas celle du dernier // clic. La réécrire ferait mentir la ligne « archivée le … ». self::assertSame($first, $this->ios->getArchivedAt()); } public function testArchivedPlatformRefusesPush(): void { self::assertTrue($this->web->canAcceptPush()); $this->web->archive(); // Accepter un `sync` sur une plateforme sortie de scène recréerait // silencieusement des clés que plus personne ne livrera. self::assertFalse($this->web->canAcceptPush()); } public function testFormatWithoutParserNeverAcceptsPush(): void { $backend = new Platform($this->project, 'API', 'api', PlatformKind::Backend, MessageFormat::Symfony); self::assertFalse($backend->canAcceptPush()); } }