esi_authentication = new EsiAuthentication; } public function testEsiAuthenticationInstantiation() { $this->assertInstanceOf(EsiAuthentication::class, $this->esi_authentication); } public function testFreshEsiAuthenticationInstanceIsNotValid() { $this->assertFalse($this->esi_authentication->valid()); } public function testEsiAuthenticationCanAccessAsArrayKey() { $this->assertArrayHasKey('client_id', $this->esi_authentication); } public function testEsiAuthenticationCanAccessAsObjectProperty() { $client_id = $this->esi_authentication->client_id; $this->assertNull($client_id); } public function testCanSetAndAccessConfigurationValueAsArrayKey() { $authentication = new EsiAuthentication; $authentication['test'] = 'test'; $this->assertEquals('test', $authentication['test']); } public function testCanSetAndAccessConfigurationValueAsObjectProperty() { $authentication = new EsiAuthentication; $authentication->test = 'test'; $this->assertEquals('test', $authentication->test); } public function testEsiAuthenticationContainerConstructWithValuePasses() { $authentication = new EsiAuthentication([ 'client_id' => '123', ]); $this->assertInstanceOf(EsiAuthentication::class, $authentication); } public function testEsiAuthenticationContainerConstructWithUnknownKeyFails() { $this->expectException(InvalidContainerDataException::class); new EsiAuthentication([ 'foo' => 'bar', ]); } /** * @param $key The key to check for existence * * @dataProvider providerTestRequiredKeysExists */ public function testRequiredKeysExists($key) { $authentication = new EsiAuthentication; $this->assertArrayHasKey($key, $authentication); } /** * Keys that _should_ exists in a new Configuration instance * * @return array */ public function providerTestRequiredKeysExists() { return [ ['client_id'], ['secret'], ['access_token'], ['refresh_token'], ['token_expires'], ['scopes'], ]; } public function testEsiAuthenticationContainerSetRefreshToken() { $authentication = new EsiAuthentication; $authentication->setRefreshToken('REFRESH_TOKEN'); $this->assertEquals('REFRESH_TOKEN', $authentication->refresh_token); } }