factory = new GrantFactory(); } /** * @covers phpOMS\Auth\OAuth2\Grant\GrantFactory * @group framework */ public function testGrantGet() : void { $grant = $this->factory->getGrant('AuthorizationCode'); self::assertInstanceOf(AuthorizationCode::class, $grant); } /** * @covers phpOMS\Auth\OAuth2\Grant\GrantFactory * @group framework */ public function testGrantInputOutput() : void { $grant = new class() extends GrantAbstract { protected function getName() : string { return 'TestGrant'; } protected function getRequiredRequestParameters() : array { return ['test']; } }; $this->factory->setGrant('test', $grant); self::assertInstanceOf(\get_class($grant), $this->factory->getGrant('test')); } /** * @covers phpOMS\Auth\OAuth2\Grant\GrantFactory * @group framework */ public function testInvalidGrantGet() : void { $this->expectException(\Exception::class); $this->factory->getGrant('invalid'); } }