PHP Coding Standards Fixer > fix coding standard

This commit is contained in:
Meritoo
2019-04-15 21:23:49 +02:00
parent 4c6fb569bc
commit c7c96daaaf
9 changed files with 258 additions and 258 deletions

View File

@@ -46,24 +46,6 @@ class CollectionTest extends BaseTestCase
*/ */
private $simpleElements; private $simpleElements;
/**
* {@inheritdoc}
*/
protected function setUp(): void
{
parent::setUp();
$this->simpleElements = [
'lorem',
'ipsum',
123 => 'dolor',
345 => 'sit',
];
$this->emptyCollection = new Collection();
$this->simpleCollection = new Collection($this->simpleElements);
}
public function testEmptyCollection() public function testEmptyCollection()
{ {
static::assertSame(0, $this->emptyCollection->count()); static::assertSame(0, $this->emptyCollection->count());
@@ -536,4 +518,22 @@ class CollectionTest extends BaseTestCase
new \DateTime('2001-01-01'), new \DateTime('2001-01-01'),
]; ];
} }
/**
* {@inheritdoc}
*/
protected function setUp(): void
{
parent::setUp();
$this->simpleElements = [
'lorem',
'ipsum',
123 => 'dolor',
345 => 'sit',
];
$this->emptyCollection = new Collection();
$this->simpleCollection = new Collection($this->simpleElements);
}
} }

View File

@@ -30,132 +30,6 @@ class ArraysTest extends BaseTestCase
private $complexArray; private $complexArray;
private $superComplexArray; private $superComplexArray;
/**
* {@inheritdoc}
*/
protected function setUp(): void
{
parent::setUp();
$this->simpleArray = [
'Lorem',
'ipsum',
'dolor',
'sit',
'amet',
];
$this->simpleArrayWithKeys = [
'Lorem' => 'ipsum',
'dolor' => 'sit',
'amet' => 'consectetur',
];
$this->twoDimensionsArray = [
[
'lorem',
'ipsum',
'dolor',
'sit',
'amet',
],
[
'consectetur',
'adipiscing',
'elit',
],
[
'donec',
'sagittis',
'fringilla',
'eleifend',
],
];
$this->complexArray = [
'lorem' => [
'ipsum' => [
'dolor' => 'sit',
'diam' => [
'non' => 'egestas',
],
],
],
'consectetur' => 'adipiscing',
'mollis' => 1234,
2 => [],
'sit' => [
'nullam' => 'donec',
'aliquet' => [
'vitae' => [
'ligula' => 'quis',
],
],
'elit',
],
'amet' => [
'iaculis',
'primis',
],
];
$this->superComplexArray = [
'ipsum' => [
'quis' => [
'vestibulum' => [
'porta-1' => [
'turpis',
'urna',
],
'porta-2' => [
'tortor' => [
'in' => [
'dui',
'dolor' => [
'aliquam',
],
],
],
],
'porta-3' => [
1,
2,
3,
],
],
],
],
'primis' => [
[
'in',
'faucibus',
'orci',
],
[
'luctus',
'et',
'ultrices',
],
],
];
}
/**
* {@inheritdoc}
*/
protected function tearDown(): void
{
parent::tearDown();
unset(
$this->simpleArray,
$this->simpleArrayWithKeys,
$this->twoDimensionsArray,
$this->complexArray,
$this->superComplexArray
);
}
public function testConstructor() public function testConstructor()
{ {
static::assertHasNoConstructor(Arrays::class); static::assertHasNoConstructor(Arrays::class);
@@ -2679,4 +2553,130 @@ letsTest[2] = value_2;';
], ],
]; ];
} }
/**
* {@inheritdoc}
*/
protected function setUp(): void
{
parent::setUp();
$this->simpleArray = [
'Lorem',
'ipsum',
'dolor',
'sit',
'amet',
];
$this->simpleArrayWithKeys = [
'Lorem' => 'ipsum',
'dolor' => 'sit',
'amet' => 'consectetur',
];
$this->twoDimensionsArray = [
[
'lorem',
'ipsum',
'dolor',
'sit',
'amet',
],
[
'consectetur',
'adipiscing',
'elit',
],
[
'donec',
'sagittis',
'fringilla',
'eleifend',
],
];
$this->complexArray = [
'lorem' => [
'ipsum' => [
'dolor' => 'sit',
'diam' => [
'non' => 'egestas',
],
],
],
'consectetur' => 'adipiscing',
'mollis' => 1234,
2 => [],
'sit' => [
'nullam' => 'donec',
'aliquet' => [
'vitae' => [
'ligula' => 'quis',
],
],
'elit',
],
'amet' => [
'iaculis',
'primis',
],
];
$this->superComplexArray = [
'ipsum' => [
'quis' => [
'vestibulum' => [
'porta-1' => [
'turpis',
'urna',
],
'porta-2' => [
'tortor' => [
'in' => [
'dui',
'dolor' => [
'aliquam',
],
],
],
],
'porta-3' => [
1,
2,
3,
],
],
],
],
'primis' => [
[
'in',
'faucibus',
'orci',
],
[
'luctus',
'et',
'ultrices',
],
],
];
}
/**
* {@inheritdoc}
*/
protected function tearDown(): void
{
parent::tearDown();
unset(
$this->simpleArray,
$this->simpleArrayWithKeys,
$this->twoDimensionsArray,
$this->complexArray,
$this->superComplexArray
);
}
} }

View File

@@ -30,16 +30,6 @@ class ComposerTest extends BaseTestCase
*/ */
private $composerJsonPath; private $composerJsonPath;
/**
* {@inheritdoc}
*/
protected function setUp(): void
{
parent::setUp();
$this->composerJsonPath = $this->getFilePathForTesting(Composer::FILE_NAME_MAIN);
}
public function testConstructor() public function testConstructor()
{ {
static::assertHasNoConstructor(Composer::class); static::assertHasNoConstructor(Composer::class);
@@ -93,4 +83,14 @@ class ComposerTest extends BaseTestCase
'1.0.2', '1.0.2',
]; ];
} }
/**
* {@inheritdoc}
*/
protected function setUp(): void
{
parent::setUp();
$this->composerJsonPath = $this->getFilePathForTesting(Composer::FILE_NAME_MAIN);
}
} }

View File

@@ -32,28 +32,6 @@ class MiscellaneousTest extends BaseTestCase
private $stringDotSeparated; private $stringDotSeparated;
private $stringWithoutSpaces; private $stringWithoutSpaces;
/**
* {@inheritdoc}
*/
protected function setUp(): void
{
parent::setUp();
$this->stringSmall = 'Lorem ipsum dolor sit amet.';
$this->stringCommaSeparated = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
$this->stringDotSeparated = 'Etiam ullamcorper. Suspendisse a pellentesque dui, non felis.';
$this->stringWithoutSpaces = 'LoremIpsumDolorSitAmetConsecteturAdipiscingElit';
}
/**
* {@inheritdoc}
*/
protected function tearDown(): void
{
parent::tearDown();
unset($this->stringSmall, $this->stringCommaSeparated, $this->stringDotSeparated, $this->stringWithoutSpaces);
}
public function testConstructor() public function testConstructor()
{ {
static::assertHasNoConstructor(Miscellaneous::class); static::assertHasNoConstructor(Miscellaneous::class);
@@ -1464,4 +1442,26 @@ class MiscellaneousTest extends BaseTestCase
'Lorem \'commodo\' dolor sit \'egestas\'', 'Lorem \'commodo\' dolor sit \'egestas\'',
]; ];
} }
/**
* {@inheritdoc}
*/
protected function setUp(): void
{
parent::setUp();
$this->stringSmall = 'Lorem ipsum dolor sit amet.';
$this->stringCommaSeparated = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit';
$this->stringDotSeparated = 'Etiam ullamcorper. Suspendisse a pellentesque dui, non felis.';
$this->stringWithoutSpaces = 'LoremIpsumDolorSitAmetConsecteturAdipiscingElit';
}
/**
* {@inheritdoc}
*/
protected function tearDown(): void
{
parent::tearDown();
unset($this->stringSmall, $this->stringCommaSeparated, $this->stringDotSeparated, $this->stringWithoutSpaces);
}
} }

View File

@@ -28,27 +28,6 @@ class RegexTest extends BaseTestCase
private $simpleText; private $simpleText;
private $camelCaseText; private $camelCaseText;
/**
* {@inheritdoc}
*/
protected function setUp(): void
{
parent::setUp();
$this->simpleText = 'lorem ipsum dolor sit';
$simpleUppercase = ucwords($this->simpleText);
$this->camelCaseText = str_replace(' ', '', lcfirst($simpleUppercase)); // 'loremIpsumDolorSit'
}
/**
* {@inheritdoc}
*/
protected function tearDown(): void
{
parent::tearDown();
unset($this->simpleText, $this->camelCaseText);
}
public function testConstructor() public function testConstructor()
{ {
static::assertHasNoConstructor(Regex::class); static::assertHasNoConstructor(Regex::class);
@@ -2003,4 +1982,25 @@ class RegexTest extends BaseTestCase
true, true,
]; ];
} }
/**
* {@inheritdoc}
*/
protected function setUp(): void
{
parent::setUp();
$this->simpleText = 'lorem ipsum dolor sit';
$simpleUppercase = ucwords($this->simpleText);
$this->camelCaseText = str_replace(' ', '', lcfirst($simpleUppercase)); // 'loremIpsumDolorSit'
}
/**
* {@inheritdoc}
*/
protected function tearDown(): void
{
parent::tearDown();
unset($this->simpleText, $this->camelCaseText);
}
} }

View File

@@ -26,6 +26,28 @@ class XmlTest extends BaseTestCase
private $simpleXml; private $simpleXml;
private $advancedXml; private $advancedXml;
public function testConstructor()
{
static::assertHasNoConstructor(Xml::class);
}
public function testMergeNodes()
{
// An empty XMLs
$element1 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><cars />');
$element2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><employees />');
$merged = Xml::mergeNodes($element1, $element2);
self::assertEquals('', (string)$merged);
// XMLs with data
$element1 = new SimpleXMLElement($this->simpleXml);
$element2 = new SimpleXMLElement($this->advancedXml);
$merged = Xml::mergeNodes($element1, $element2);
self::assertEquals('John', (string)$merged->author[0]->first_name);
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@@ -69,26 +91,4 @@ class XmlTest extends BaseTestCase
unset($this->simpleXml, $this->advancedXml); unset($this->simpleXml, $this->advancedXml);
} }
public function testConstructor()
{
static::assertHasNoConstructor(Xml::class);
}
public function testMergeNodes()
{
// An empty XMLs
$element1 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><cars />');
$element2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><employees />');
$merged = Xml::mergeNodes($element1, $element2);
self::assertEquals('', (string)$merged);
// XMLs with data
$element1 = new SimpleXMLElement($this->simpleXml);
$element2 = new SimpleXMLElement($this->advancedXml);
$merged = Xml::mergeNodes($element1, $element2);
self::assertEquals('John', (string)$merged->author[0]->first_name);
}
} }

View File

@@ -38,15 +38,6 @@ class AddressTest extends BaseTestCase
*/ */
private $addressWithoutStreet; private $addressWithoutStreet;
protected function setUp(): void
{
parent::setUp();
$this->address = new Address('New York', '00123', '4th Avenue', '10', '200');
$this->addressWithoutFlat = new Address('San Francisco', '00456', 'Green Street', '22');
$this->addressWithoutStreet = new Address('Saint Louis', '00111', '', '1', '300');
}
public function testConstructor() public function testConstructor()
{ {
static::assertConstructorVisibilityAndArguments( static::assertConstructorVisibilityAndArguments(
@@ -105,4 +96,13 @@ class AddressTest extends BaseTestCase
static::assertSame('Green Street 22, 00456, San Francisco', (string)$this->addressWithoutFlat); static::assertSame('Green Street 22, 00456, San Francisco', (string)$this->addressWithoutFlat);
static::assertSame('00111, Saint Louis', (string)$this->addressWithoutStreet); static::assertSame('00111, Saint Louis', (string)$this->addressWithoutStreet);
} }
protected function setUp(): void
{
parent::setUp();
$this->address = new Address('New York', '00123', '4th Avenue', '10', '200');
$this->addressWithoutFlat = new Address('San Francisco', '00456', 'Green Street', '22');
$this->addressWithoutStreet = new Address('Saint Louis', '00111', '', '1', '300');
}
} }

View File

@@ -33,17 +33,6 @@ class BankAccountTest extends BaseTestCase
*/ */
private $bankAccount; private $bankAccount;
/**
* {@inheritdoc}
*/
protected function setUp(): void
{
parent::setUp();
$this->emptyBankAccount = new BankAccount('', '');
$this->bankAccount = new BankAccount('Bank of America', '1234567890');
}
public function testConstructor() public function testConstructor()
{ {
static::assertConstructorVisibilityAndArguments( static::assertConstructorVisibilityAndArguments(
@@ -71,4 +60,15 @@ class BankAccountTest extends BaseTestCase
static::assertSame('', (string)$this->emptyBankAccount); static::assertSame('', (string)$this->emptyBankAccount);
static::assertSame('Bank of America, 1234567890', (string)$this->bankAccount); static::assertSame('Bank of America, 1234567890', (string)$this->bankAccount);
} }
/**
* {@inheritdoc}
*/
protected function setUp(): void
{
parent::setUp();
$this->emptyBankAccount = new BankAccount('', '');
$this->bankAccount = new BankAccount('Bank of America', '1234567890');
}
} }

View File

@@ -35,25 +35,6 @@ class CompanyTest extends BaseTestCase
*/ */
private $companyWithoutBankAccount; private $companyWithoutBankAccount;
/**
* {@inheritdoc}
*/
protected function setUp(): void
{
parent::setUp();
$this->company = new Company(
'Test 1',
new Address('New York', '00123', '4th Avenue', '10', '200'),
new BankAccount('Bank 1', '12345')
);
$this->companyWithoutBankAccount = new Company(
'Test 2',
new Address('San Francisco', '00456', 'Green Street', '22')
);
}
public function testConstructor() public function testConstructor()
{ {
static::assertConstructorVisibilityAndArguments( static::assertConstructorVisibilityAndArguments(
@@ -98,4 +79,23 @@ class CompanyTest extends BaseTestCase
static::assertSame('Test 1, 4th Avenue 10/200, 00123, New York, Bank 1, 12345', (string)$this->company); static::assertSame('Test 1, 4th Avenue 10/200, 00123, New York, Bank 1, 12345', (string)$this->company);
static::assertSame('Test 2, Green Street 22, 00456, San Francisco', (string)$this->companyWithoutBankAccount); static::assertSame('Test 2, Green Street 22, 00456, San Francisco', (string)$this->companyWithoutBankAccount);
} }
/**
* {@inheritdoc}
*/
protected function setUp(): void
{
parent::setUp();
$this->company = new Company(
'Test 1',
new Address('New York', '00123', '4th Avenue', '10', '200'),
new BankAccount('Bank 1', '12345')
);
$this->companyWithoutBankAccount = new Company(
'Test 2',
new Address('San Francisco', '00456', 'Green Street', '22')
);
}
} }