/**
  * {@inheritdoc}
  */
 public function createDir($dirname, Config $config)
 {
     $response = $this->client->createFolder($dirname);
     $responseContent = json_decode((string) $response->getBody());
     $result = new FlysystemMetadata(FlysystemMetadata::TYPE_DIRECTORY, $dirname);
     $this->updateFlysystemMetadataFromResponseContent($result, $responseContent);
     return $result->toArray();
 }
 public function testCreateFolder()
 {
     $client = $this->getMockBuilder('\\GuzzleHttp\\Client')->getMock();
     $accessToken = '123456789';
     $content = json_encode(['name' => 'pictures', 'folder' => new \StdClass(), '@name.conflictBehavior' => 'fail']);
     $assertRequest = function ($request) use($accessToken, $content) {
         return $request instanceof Request && $request->getMethod() == 'POST' && $request->getUri()->getHost() == 'api.onedrive.com' && $request->getUri()->getPath() == '/v1.0/drive/root:/documents:/children' && $request->getHeader('authorization') == ['bearer ' . $accessToken] && $request->getHeader('content-type') == ['application/json'] && (string) $request->getBody() == $content;
     };
     $response = new Response(200, [], 'test response');
     $client->expects($this->once())->method('send')->with($this->callback($assertRequest))->willReturn($response);
     $oneDriveClient = new OneDriveClient($accessToken, $client);
     $result = $oneDriveClient->createFolder('documents/pictures');
     $this->assertEquals($response, $result);
 }