id()); self::assertSame('Pods', $integration->label()); self::assertSame([], $integration->abilities()); self::assertEquals([PodsCompatibility::profile()], $integration->compatibilities()); } public function testBootHooksTheOrphanCleanupIntoTheProfileLoad(): void { $integration = new PodsIntegration(); $integration->boot(); self::assertNotFalse(has_action(CompatibilityTab::LOAD_ACTION, [$integration, 'removeOrphans'])); } public function testNoCleanupForAnotherProfile(): void { Functions\expect('get_posts')->never(); Functions\when('current_user_can')->justReturn(true); (new PodsIntegration(static fn (): bool => true))->removeOrphans('divi'); $this->addToAssertionCount(1); } public function testNoCleanupWithoutPods(): void { Functions\expect('get_posts')->never(); Functions\when('current_user_can')->justReturn(true); (new PodsIntegration(static fn (): bool => false))->removeOrphans('pods'); $this->addToAssertionCount(1); } public function testNoCleanupWithoutTheCapability(): void { Functions\expect('get_posts')->never(); Functions\when('current_user_can')->justReturn(false); (new PodsIntegration(static fn (): bool => true))->removeOrphans('pods'); $this->addToAssertionCount(1); } public function testCleansUpForTheAdministratorWithPods(): void { Functions\when('current_user_can')->justReturn(true); Functions\when('get_post_types')->justReturn(['post' => 'post']); Functions\expect('get_posts')->once()->andReturn([]); (new PodsIntegration(static fn (): bool => true))->removeOrphans('pods'); } public function testIsAvailableOnlyWithPods(): void { self::assertSame(defined('PODS_VERSION'), (new PodsIntegration())->isAvailable()); } /** An available integration without abilities is no tool group, but it is an active integration. */ public function testAnAvailableIntegrationWithoutAbilitiesIsNoGroupButIsNamedAsActive(): void { $pods = new class implements Integration { public function id(): string { return 'pods'; } public function label(): string { return 'Pods'; } public function isAvailable(): bool { return true; } public function abilities(): array { return []; } }; $registry = new IntegrationRegistry($pods); self::assertSame([], $registry->grouped()); self::assertSame([], $registry->groupMap()); self::assertStringContainsString('Aktive Integrationen: pods.', (new InstructionsBuilder($registry))->build()); } }