Code style fixes

This commit is contained in:
Dmitry Khomutov 2017-01-08 00:55:56 +07:00
commit 4b49c95b20
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
8 changed files with 121 additions and 121 deletions

View file

@ -21,80 +21,80 @@ class PhpUnitOptionsTest extends \PHPUnit_Framework_TestCase
{
public function validOptionsProvider()
{
return array(
array(
array(
return [
[
[
'config' => 'tests/phpunit.xml',
'args' => '--stop-on-error --log-junit /path/to/log/',
),
array(
],
[
'stop-on-error' => '',
'log-junit' => '/path/to/log/',
'configuration' => 'tests/phpunit.xml',
),
),
array(
array(
],
],
[
[
'coverage' => '/path/to/coverage2/',
'args' => array(
'args' => [
'coverage-html' => '/path/to/coverage1/',
),
),
array(
'coverage-html' => array(
],
],
[
'coverage-html' => [
'/path/to/coverage1/',
'/path/to/coverage2/',
),
),
),
array(
array(
'directory' => array(
],
],
],
[
[
'directory' => [
'/path/to/test1/',
'/path/to/test2/',
),
'args' => array(
],
'args' => [
'coverage-html' => '/path/to/coverage1/',
),
),
array(
],
],
[
'coverage-html' => '/path/to/coverage1/',
),
),
array(
array(
'config' => array('tests/phpunit.xml'),
],
],
[
[
'config' => ['tests/phpunit.xml'],
'args' => "--testsuite=unit --bootstrap=vendor/autoload.php",
),
array(
],
[
'testsuite' => 'unit',
'bootstrap' => 'vendor/autoload.php',
'configuration' => array('tests/phpunit.xml'),
),
),
array(
array(
'config' => array('tests/phpunit.xml'),
'configuration' => ['tests/phpunit.xml'],
],
],
[
[
'config' => ['tests/phpunit.xml'],
'args' => "--testsuite='unit' --bootstrap 'vendor/autoload.php'",
),
array(
],
[
'testsuite' => 'unit',
'bootstrap' => 'vendor/autoload.php',
'configuration' => array('tests/phpunit.xml'),
),
),
array(
array(
'config' => array('tests/phpunit.xml'),
'configuration' => ['tests/phpunit.xml'],
],
],
[
[
'config' => ['tests/phpunit.xml'],
'args' => '--testsuite="unit" --bootstrap "vendor/autoload.php"',
),
array(
],
[
'testsuite' => 'unit',
'bootstrap' => 'vendor/autoload.php',
'configuration' => array('tests/phpunit.xml'),
),
),
);
'configuration' => ['tests/phpunit.xml'],
],
],
];
}
/**
@ -112,10 +112,10 @@ class PhpUnitOptionsTest extends \PHPUnit_Framework_TestCase
public function testGetters()
{
$options = new PhpUnitOptions(
array(
[
'run_from' => '/path/to/run/from',
'path' => 'subTest',
)
]
);
$this->assertEquals('/path/to/run/from', $options->getRunFrom());

View file

@ -19,11 +19,11 @@ class PhpUnitTest extends \PHPUnit_Framework_TestCase
{
public function testSingleConfigFile()
{
$options = array(
$options = [
'config' => ROOT_DIR . 'phpunit.xml'
);
];
$mockPlugin = $this->getPluginBuilder($options)->setMethods(array('runConfigFile'))->getMock();
$mockPlugin = $this->getPluginBuilder($options)->setMethods(['runConfigFile'])->getMock();
$mockPlugin->expects($this->once())->method('runConfigFile')->with(ROOT_DIR . 'phpunit.xml');
$mockPlugin->execute();
@ -31,16 +31,16 @@ class PhpUnitTest extends \PHPUnit_Framework_TestCase
public function testMultiConfigFile()
{
$options = array(
'config' => array(
$options = [
'config' => [
ROOT_DIR . 'phpunit1.xml',
ROOT_DIR . 'phpunit2.xml',
)
);
]
];
$mockPlugin = $this->getPluginBuilder($options)->setMethods(array('runConfigFile'))->getMock();
$mockPlugin = $this->getPluginBuilder($options)->setMethods(['runConfigFile'])->getMock();
$mockPlugin->expects($this->exactly(2))->method('runConfigFile')->withConsecutive(
array(ROOT_DIR . 'phpunit1.xml'), array(ROOT_DIR . 'phpunit2.xml')
[ROOT_DIR . 'phpunit1.xml'], [ROOT_DIR . 'phpunit2.xml']
);
$mockPlugin->execute();
@ -53,30 +53,30 @@ class PhpUnitTest extends \PHPUnit_Framework_TestCase
*
* @return \PHPUnit_Framework_MockObject_MockBuilder
*/
protected function getPluginBuilder($options = array())
protected function getPluginBuilder($options = [])
{
$loggerMock = $this->getMockBuilder('\Monolog\Logger')
->setConstructorArgs(array('Test'))
->setMethods(array('addRecord'))
->setConstructorArgs(['Test'])
->setMethods(['addRecord'])
->getMock();
$mockBuild = $this->getMockBuilder('\PHPCensor\Model\Build')->getMock();
$mockBuilder = $this->getMockBuilder('\PHPCensor\Builder')
->setConstructorArgs(array($mockBuild, $loggerMock))
->setMethods(array('executeCommand'))->getMock();
->setConstructorArgs([$mockBuild, $loggerMock])
->setMethods(['executeCommand'])->getMock();
return $this->getMockBuilder('PHPCensor\Plugin\PhpUnit')->setConstructorArgs(
array($mockBuilder, $mockBuild, $options)
[$mockBuilder, $mockBuild, $options]
);
}
public function testSingleDir()
{
$options = array(
$options = [
'directory' => '/test/directory/one'
);
];
$mockPlugin = $this->getPluginBuilder($options)->setMethods(array('runDir'))->getMock();
$mockPlugin = $this->getPluginBuilder($options)->setMethods(['runDir'])->getMock();
$mockPlugin->expects($this->once())->method('runDir')->with('/test/directory/one');
$mockPlugin->execute();
@ -84,16 +84,16 @@ class PhpUnitTest extends \PHPUnit_Framework_TestCase
public function testMultiDir()
{
$options = array(
'directory' => array(
$options = [
'directory' => [
'/test/directory/one',
'/test/directory/two',
)
);
]
];
$mockPlugin = $this->getPluginBuilder($options)->setMethods(array('runDir'))->getMock();
$mockPlugin = $this->getPluginBuilder($options)->setMethods(['runDir'])->getMock();
$mockPlugin->expects($this->exactly(2))->method('runDir')->withConsecutive(
array('/test/directory/one'), array('/test/directory/two')
['/test/directory/one'], ['/test/directory/two']
);
$mockPlugin->execute();
@ -101,11 +101,11 @@ class PhpUnitTest extends \PHPUnit_Framework_TestCase
public function testProcessResultsFromConfig()
{
$options = array(
$options = [
'config' => ROOT_DIR . 'phpunit.xml'
);
];
$mockPlugin = $this->getPluginBuilder($options)->setMethods(array('processResults'))->getMock();
$mockPlugin = $this->getPluginBuilder($options)->setMethods(['processResults'])->getMock();
$mockPlugin->expects($this->once())->method('processResults')->with($this->isType('string'));
$mockPlugin->execute();
@ -113,11 +113,11 @@ class PhpUnitTest extends \PHPUnit_Framework_TestCase
public function testProcessResultsFromDir()
{
$options = array(
$options = [
'directory' => ROOT_DIR . 'Tests'
);
];
$mockPlugin = $this->getPluginBuilder($options)->setMethods(array('processResults'))->getMock();
$mockPlugin = $this->getPluginBuilder($options)->setMethods(['processResults'])->getMock();
$mockPlugin->expects($this->once())->method('processResults')->with($this->isType('string'));
$mockPlugin->execute();