mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
PHP Coding Standards Fixer > fix coding standard
This commit is contained in:
@@ -46,24 +46,6 @@ class CollectionTest extends BaseTestCase
|
||||
*/
|
||||
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()
|
||||
{
|
||||
static::assertSame(0, $this->emptyCollection->count());
|
||||
@@ -536,4 +518,22 @@ class CollectionTest extends BaseTestCase
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,132 +30,6 @@ class ArraysTest extends BaseTestCase
|
||||
private $complexArray;
|
||||
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()
|
||||
{
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,16 +30,6 @@ class ComposerTest extends BaseTestCase
|
||||
*/
|
||||
private $composerJsonPath;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->composerJsonPath = $this->getFilePathForTesting(Composer::FILE_NAME_MAIN);
|
||||
}
|
||||
|
||||
public function testConstructor()
|
||||
{
|
||||
static::assertHasNoConstructor(Composer::class);
|
||||
@@ -93,4 +83,14 @@ class ComposerTest extends BaseTestCase
|
||||
'1.0.2',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->composerJsonPath = $this->getFilePathForTesting(Composer::FILE_NAME_MAIN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,28 +32,6 @@ class MiscellaneousTest extends BaseTestCase
|
||||
private $stringDotSeparated;
|
||||
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()
|
||||
{
|
||||
static::assertHasNoConstructor(Miscellaneous::class);
|
||||
@@ -1464,4 +1442,26 @@ class MiscellaneousTest extends BaseTestCase
|
||||
'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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,27 +28,6 @@ class RegexTest extends BaseTestCase
|
||||
private $simpleText;
|
||||
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()
|
||||
{
|
||||
static::assertHasNoConstructor(Regex::class);
|
||||
@@ -2003,4 +1982,25 @@ class RegexTest extends BaseTestCase
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,28 @@ class XmlTest extends BaseTestCase
|
||||
private $simpleXml;
|
||||
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}
|
||||
*/
|
||||
@@ -69,26 +91,4 @@ class XmlTest extends BaseTestCase
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,15 +38,6 @@ class AddressTest extends BaseTestCase
|
||||
*/
|
||||
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()
|
||||
{
|
||||
static::assertConstructorVisibilityAndArguments(
|
||||
@@ -105,4 +96,13 @@ class AddressTest extends BaseTestCase
|
||||
static::assertSame('Green Street 22, 00456, San Francisco', (string)$this->addressWithoutFlat);
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,17 +33,6 @@ class BankAccountTest extends BaseTestCase
|
||||
*/
|
||||
private $bankAccount;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->emptyBankAccount = new BankAccount('', '');
|
||||
$this->bankAccount = new BankAccount('Bank of America', '1234567890');
|
||||
}
|
||||
|
||||
public function testConstructor()
|
||||
{
|
||||
static::assertConstructorVisibilityAndArguments(
|
||||
@@ -71,4 +60,15 @@ class BankAccountTest extends BaseTestCase
|
||||
static::assertSame('', (string)$this->emptyBankAccount);
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,25 +35,6 @@ class CompanyTest extends BaseTestCase
|
||||
*/
|
||||
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()
|
||||
{
|
||||
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 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')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user