assertNotNull( new IAMCredentials('iam-selector', 'iam-token') ); } } class IAMUpdateMetadataCallbackTest extends TestCase { public function testUpdateMetadataFunc() { $selector = 'iam-selector'; $token = 'iam-token'; $iam = new IAMCredentials( $selector, $token ); $update_metadata = $iam->getUpdateMetadataFunc(); $this->assertInternalType('callable', $update_metadata); $actual_metadata = call_user_func($update_metadata, $metadata = array('foo' => 'bar')); $this->assertArrayHasKey(IAMCredentials::SELECTOR_KEY, $actual_metadata); $this->assertEquals( $actual_metadata[IAMCredentials::SELECTOR_KEY], $selector); $this->assertArrayHasKey(IAMCredentials::TOKEN_KEY, $actual_metadata); $this->assertEquals( $actual_metadata[IAMCredentials::TOKEN_KEY], $token); } }