Skip to content

Commit

Permalink
Fixed tests (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell authored Feb 8, 2021
1 parent 31c356a commit 3a3fd2d
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/Oauth1Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ public function testSignsPlainText()
$request = $container[0]['request'];

$this->assertTrue($request->hasHeader('Authorization'));
$this->assertThat($request->getHeader('Authorization')[0], Assert::stringContains('oauth_signature_method="PLAINTEXT"',false),'');
$this->assertThat($request->getHeader('Authorization')[0], Assert::stringContains('oauth_signature="',false),'');
$this->assertThat($request->getHeader('Authorization')[0], Assert::stringContains('oauth_signature_method="PLAINTEXT"', false), '');
$this->assertThat($request->getHeader('Authorization')[0], Assert::stringContains('oauth_signature="', false), '');
}

public function testSignsOauthRequestsInHeader()
Expand Down Expand Up @@ -129,7 +129,7 @@ public function testSignsOauthRequestsInHeader()
'oauth_signature_method', 'oauth_timestamp', 'oauth_token',
'oauth_version'];
foreach ($check as $name) {
$this->assertThat($request->getHeader('Authorization')[0], Assert::stringContains($name . '=',false),'');
$this->assertThat($request->getHeader('Authorization')[0], Assert::stringContains($name . '=', false), '');
}
}

Expand Down Expand Up @@ -199,7 +199,7 @@ public function testOnlyTouchesWhenAuthConfigIsOauth()
*/
public function testValidatesRequestMethod()
{
if (method_exists($this,'expectException')) {
if (method_exists($this, 'expectException')) {
$this->expectException(\InvalidArgumentException::class);
}

Expand All @@ -223,7 +223,7 @@ public function testValidatesRequestMethod()
*/
public function testExceptionOnSignatureError()
{
if (method_exists($this,'expectException')) {
if (method_exists($this, 'expectException')) {
$this->expectException(\RuntimeException::class);
}

Expand Down Expand Up @@ -266,7 +266,7 @@ public function testDoesNotAddEmptyValuesToAuthorization()
$request = $container[0]['request'];

$this->assertTrue($request->hasHeader('Authorization'));
$this->assertThat($request->getHeader('Authorization')[0], Assert::logicalNot(Assert::stringContains('oauth_token=',false)),'');
$this->assertThat($request->getHeader('Authorization')[0], Assert::logicalNot(Assert::stringContains('oauth_token=', false)), '');
}

public function testRandomParametersAreNotAutomaticallyAdded()
Expand All @@ -293,7 +293,7 @@ public function testRandomParametersAreNotAutomaticallyAdded()
$request = $container[0]['request'];

$this->assertTrue($request->hasHeader('Authorization'));
$this->assertThat($request->getHeader('Authorization')[0], Assert::logicalNot(Assert::stringContains('foo=bar',false)),'');
$this->assertThat($request->getHeader('Authorization')[0], Assert::logicalNot(Assert::stringContains('foo=bar', false)), '');
}

public function testAllowsRealm()
Expand All @@ -320,7 +320,7 @@ public function testAllowsRealm()
$request = $container[0]['request'];

$this->assertTrue($request->hasHeader('Authorization'));
$this->assertThat($request->getHeader('Authorization')[0], Assert::stringContains('OAuth realm="foo",',false),'');
$this->assertThat($request->getHeader('Authorization')[0], Assert::stringContains('OAuth realm="foo",', false), '');
}

public function testTwitterIntegration()
Expand Down Expand Up @@ -394,7 +394,7 @@ public function testTwitterStreamingIntegration()
'stream' => true
]);
$body = $response->getBody()->getContents();
$this->assertThat(strtolower($body), Assert::stringContains('bieber',false),'');
$this->assertThat(strtolower($body), Assert::stringContains('bieber', false), '');
$this->assertNotEmpty(json_decode($body, true));
} catch (ClientException $e) {
if ($e->getResponse()->getStatusCode() == 429) {
Expand Down Expand Up @@ -429,7 +429,7 @@ public function testSignsHmacSha256()
$request = $container[0]['request'];

$this->assertTrue($request->hasHeader('Authorization'));
$this->assertContains('oauth_signature_method="HMAC-SHA256"', $request->getHeader('Authorization')[0]);
$this->assertContains('oauth_signature="', $request->getHeader('Authorization')[0]);
$this->assertThat($request->getHeader('Authorization')[0], Assert::stringContains('oauth_signature_method="HMAC-SHA256"', false), '');
$this->assertThat($request->getHeader('Authorization')[0], Assert::stringContains('oauth_signature="', false), '');
}
}

0 comments on commit 3a3fd2d

Please sign in to comment.