Ejemplo n.º 1
0
 public function testHeadersOfRequestAreStocked()
 {
     $definition = (include 'fixtures/headers.php');
     $userValues = ['name' => 'john_doe', 'age' => 30, 'metadata' => ['hair_color' => 'brown'], 'other' => 'blah'];
     $expected = ['X-Foo-Name' => $userValues['name'], 'age' => $userValues['age'], 'X-Meta-hair_color' => $userValues['metadata']['hair_color']];
     $actual = $this->serializer->serialize($userValues, Operation::toParamArray($definition['params']));
     $this->assertEquals($expected, $actual);
 }
Ejemplo n.º 2
0
 public function test_it_nests_object_keys_according_to_path()
 {
     $api = new IdentityV3Api();
     $params = Operation::toParamArray($api->postTokens()['params']);
     $user = ['name' => 'foo', 'password' => 'bar', 'domain' => ['name' => 'default']];
     $scope = ['project' => ['id' => 'baz']];
     $userValues = ['user' => $user, 'scope' => $scope, 'methods' => ['password']];
     $expected = ['auth' => ['identity' => ['methods' => ['password'], 'password' => ['user' => $user]], 'scope' => $scope]];
     $this->assertEquals($expected, $this->serializer->serialize($userValues, $params));
 }