Skip to content

Commit

Permalink
Fix 5.4/5.5 compatibility & apply CS
Browse files Browse the repository at this point in the history
  • Loading branch information
emri99 committed May 27, 2017
1 parent be9b199 commit bc8e8c8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
6 changes: 0 additions & 6 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ return PhpCsFixer\Config::create()
// '@PHP56Migration' => true, // to prepare PHP56 migration
'array_syntax' => ['syntax' => 'long'],
'combine_consecutive_unsets' => true,
'general_phpdoc_annotation_remove' => [
// one should use PHPUnit methods to set up expected exception instead of annotations
'expectedException',
'expectedExceptionMessage',
'expectedExceptionMessageRegExp'
],
'header_comment' => ['header' => $header],
'heredoc_to_nowdoc' => true,
'no_extra_consecutive_blank_lines' => [
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ before_script:
- travis_retry composer self-update
- travis_retry composer install --prefer-source --no-interaction

script:
script:
- vendor/bin/phpunit

25 changes: 13 additions & 12 deletions tests/GitlabApiClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ public function testOptions()
{
$client = new SUT(self::BASE_PATH, array(
'new_option' => 'value',
'timeout' => 666
'timeout' => 666,
));
$this->assertEquals('value', $client->getOption('new_option'));
$this->assertEquals(666, $client->getOption('timeout'));
$this->expectException("InvalidArgumentException");
$this->expectException('InvalidArgumentException');
$client->getOption('missing-option');
}

Expand All @@ -227,12 +227,12 @@ public function testHeaders()
'HEADER1' => 'VALUE1',
'HEADER2' => 'VALUE2',
'HEADER3' => 'VALUE3',
'HEADER4' => 'VALUE4'
'HEADER4' => 'VALUE4',
), $datas);

return true;
}),
$this->anything()
$this->anything(),
),
// next call must have only global ones
array(
Expand All @@ -247,21 +247,20 @@ public function testHeaders()

return true;
}),
$this->anything()
$this->anything(),
)
)
->willReturn(new Response(200, '', '', array()));


$sut
->setHeaders(array(
'HEADER1' => 'VALUE1',
'HEADER2' => 'VALUE2'
'HEADER2' => 'VALUE2',
))
->path(2)
->get(array(), array(
'HEADER3' => 'VALUE3',
'HEADER4' => 'VALUE4'
'HEADER4' => 'VALUE4',
));
$sut->path(2)->get();

Expand Down Expand Up @@ -292,19 +291,21 @@ public function testHeaders()
->authenticate('my-precious-token', SUT::AUTH_OAUTH_TOKEN, 'im sudoers')
->setHeaders(array(
'Authorization' => 'VALUE1',
'HEADER2' => 'VALUE2'
'HEADER2' => 'VALUE2',
))
->path(2)
->get(array(), array(
'HEADER3' => 'VALUE3',
'HEADER4' => 'VALUE4'
'HEADER4' => 'VALUE4',
));
}

/**
* @expectedExceptionMessage scalar expected
* @expectedException \InvalidArgumentException
*/
public function testIncorrectPath()
{
$this->expectExceptionMessage('scalar expected');
$this->expectException('InvalidArgumentException');
$this->getMockedSUT()->path(array('array' => 'not accepted here'));
}

Expand Down

0 comments on commit bc8e8c8

Please sign in to comment.