/** * @covers OAuth2\Client::__construct() */ public function testConstructorBuildsClient() { // client id and secret should be assigned $this->assertEquals('abc', $this->client->getId()); $this->assertEquals('def', $this->client->getSecret()); // client site should be assigned $this->assertEquals(['base_url' => 'https://api.example.com'], $this->client->site); // connection baseUrl should be assigned $this->assertEquals('https://api.example.com', $this->client->connection->getBaseUrl()); // exceptions in request_opts should be true $this->assertTrue($this->client->options['request_opts']['exceptions']); // allows true/false exceptions in request_opts $client = new \OAuth2\Client('abc', 'def', ['site' => 'https://api.example.com', 'request_opts' => ['exceptions' => false]]); $this->assertFalse($client->options['request_opts']['exceptions']); $client = new \OAuth2\Client('abc', 'def', ['site' => 'https://api.example.com', 'request_opts' => ['exceptions' => true]]); $this->assertTrue($client->options['request_opts']['exceptions']); // allow GET/POST for token_method option $client = new \OAuth2\Client('abc', 'def', array('site' => 'https://api.example.com', 'token_method' => 'GET')); $this->assertEquals('GET', $client->options['token_method']); $client = new \OAuth2\Client('abc', 'def', array('site' => 'https://api.example.com', 'token_method' => 'POST')); $this->assertEquals('POST', $client->options['token_method']); }