From c7c96daaaf148bbad415aaf85c0fbd32f1d340ef Mon Sep 17 00:00:00 2001 From: Meritoo Date: Mon, 15 Apr 2019 21:23:49 +0200 Subject: [PATCH] PHP Coding Standards Fixer > fix coding standard --- tests/Collection/CollectionTest.php | 36 ++-- tests/Utilities/ArraysTest.php | 252 +++++++++++++------------- tests/Utilities/ComposerTest.php | 20 +- tests/Utilities/MiscellaneousTest.php | 44 ++--- tests/Utilities/RegexTest.php | 42 ++--- tests/Utilities/XmlTest.php | 44 ++--- tests/ValueObject/AddressTest.php | 18 +- tests/ValueObject/BankAccountTest.php | 22 +-- tests/ValueObject/CompanyTest.php | 38 ++-- 9 files changed, 258 insertions(+), 258 deletions(-) diff --git a/tests/Collection/CollectionTest.php b/tests/Collection/CollectionTest.php index 222b83c..b2d90b2 100644 --- a/tests/Collection/CollectionTest.php +++ b/tests/Collection/CollectionTest.php @@ -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); + } } diff --git a/tests/Utilities/ArraysTest.php b/tests/Utilities/ArraysTest.php index 3882298..c553f73 100644 --- a/tests/Utilities/ArraysTest.php +++ b/tests/Utilities/ArraysTest.php @@ -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 + ); + } } diff --git a/tests/Utilities/ComposerTest.php b/tests/Utilities/ComposerTest.php index 9980e62..7bf6602 100644 --- a/tests/Utilities/ComposerTest.php +++ b/tests/Utilities/ComposerTest.php @@ -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); + } } diff --git a/tests/Utilities/MiscellaneousTest.php b/tests/Utilities/MiscellaneousTest.php index 15e33cc..7f48d98 100644 --- a/tests/Utilities/MiscellaneousTest.php +++ b/tests/Utilities/MiscellaneousTest.php @@ -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); + } } diff --git a/tests/Utilities/RegexTest.php b/tests/Utilities/RegexTest.php index 9af9937..df9b925 100644 --- a/tests/Utilities/RegexTest.php +++ b/tests/Utilities/RegexTest.php @@ -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); + } } diff --git a/tests/Utilities/XmlTest.php b/tests/Utilities/XmlTest.php index 3d09c50..90bd348 100644 --- a/tests/Utilities/XmlTest.php +++ b/tests/Utilities/XmlTest.php @@ -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(''); + $element2 = new SimpleXMLElement(''); + + $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(''); - $element2 = new SimpleXMLElement(''); - - $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); - } } diff --git a/tests/ValueObject/AddressTest.php b/tests/ValueObject/AddressTest.php index e70895f..acee74c 100644 --- a/tests/ValueObject/AddressTest.php +++ b/tests/ValueObject/AddressTest.php @@ -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'); + } } diff --git a/tests/ValueObject/BankAccountTest.php b/tests/ValueObject/BankAccountTest.php index 4d48eb7..436d3e0 100644 --- a/tests/ValueObject/BankAccountTest.php +++ b/tests/ValueObject/BankAccountTest.php @@ -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'); + } } diff --git a/tests/ValueObject/CompanyTest.php b/tests/ValueObject/CompanyTest.php index 9edb320..b63dac0 100644 --- a/tests/ValueObject/CompanyTest.php +++ b/tests/ValueObject/CompanyTest.php @@ -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') + ); + } }