From a3146145fda1cd0b92553e90009d275edd730690 Mon Sep 17 00:00:00 2001 From: Roy van Veldhuizen <18717340+royvanv@users.noreply.github.com> Date: Mon, 15 Nov 2021 15:16:26 +0100 Subject: [PATCH] Formatting. --- tests/TextTest.php | 105 ++++++++++++++++++++++---------------------- tests/WordsTest.php | 20 ++++----- 2 files changed, 62 insertions(+), 63 deletions(-) diff --git a/tests/TextTest.php b/tests/TextTest.php index 194ed0f..f9d8d76 100644 --- a/tests/TextTest.php +++ b/tests/TextTest.php @@ -2,7 +2,6 @@ namespace Vendeka\Text\Tests; -use Vendeka\Text\Text; use Vendeka\Text\Words; use Illuminate\Support\Str; use Illuminate\Support\Stringable; @@ -14,65 +13,65 @@ public function testNormalizeWhitespaceMethod(): void $this->assertIsString(Str::normalizeWhitespace('Instance')); $this->assertInstanceOf(Stringable::class, Str::of('Instance')->normalizeWhitespace()); - $this->assertEquals('White space', Str::normalizeWhitespace(" White\r\n space ")); - $this->assertEquals('White space', Str::of("White space\t")->normalizeWhitespace()); - } + $this->assertEquals('White space', Str::normalizeWhitespace(" White\r\n space ")); + $this->assertEquals('White space', Str::of("White space\t")->normalizeWhitespace()); + } - public function testToWordsMethod (): void - { - $this->assertInstanceOf(Words::class, Str::toWords('Instance')); - $this->assertInstanceOf(Words::class, Str::of('Instance')->toWords()); + public function testToWordsMethod(): void + { + $this->assertInstanceOf(Words::class, Str::toWords('Instance')); + $this->assertInstanceOf(Words::class, Str::of('Instance')->toWords()); + + $this->assertEquals('a dog', (string) Str::toWords('a dog')); + $this->assertEquals('a snake', Str::toWords('a_snake')->__toString()); + $this->assertEquals('a lamb', Str::toWords('a-lamb')->toString()); + $this->assertEquals('a Camel', (string) Str::toWords('aCamel')); + } - $this->assertEquals('a dog', (string) Str::toWords('a dog')); - $this->assertEquals('a snake', Str::toWords('a_snake')->__toString()); - $this->assertEquals('a lamb', Str::toWords('a-lamb')->toString()); - $this->assertEquals('a Camel', (string) Str::toWords('aCamel')); - } - - public function testUnprefixMethod (): void - { - $this->assertIsString(Str::unprefix('Instance', 'In')); - $this->assertInstanceOf(Stringable::class, Str::of('Instance')->unprefix('In')); + public function testUnprefixMethod(): void + { + $this->assertIsString(Str::unprefix('Instance', 'In')); + $this->assertInstanceOf(Stringable::class, Str::of('Instance')->unprefix('In')); - $this->assertEquals('path', Str::unprefix('path', '/')); - $this->assertEquals('path', Str::unprefix('/path', '/')); - } + $this->assertEquals('path', Str::unprefix('path', '/')); + $this->assertEquals('path', Str::unprefix('/path', '/')); + } - public function testUnsufffixMethod (): void - { - $this->assertIsString(Str::unsuffix('Instance', 'x')); - $this->assertInstanceOf(Stringable::class, Str::of('Instance')->unsuffix('x')); + public function testUnsufffixMethod(): void + { + $this->assertIsString(Str::unsuffix('Instance', 'x')); + $this->assertInstanceOf(Stringable::class, Str::of('Instance')->unsuffix('x')); - $this->assertEquals('path', Str::unsuffix('path', '/')); - $this->assertEquals('path', Str::unsuffix('path/', '/')); - } + $this->assertEquals('path', Str::unsuffix('path', '/')); + $this->assertEquals('path', Str::unsuffix('path/', '/')); + } - public function testUnwrapMethod(): void - { - $this->assertIsString(Str::unwrap('Instance', '/')); - $this->assertInstanceOf(Stringable::class, Str::of('Instance')->unwrap('/')); + public function testUnwrapMethod(): void + { + $this->assertIsString(Str::unwrap('Instance', '/')); + $this->assertInstanceOf(Stringable::class, Str::of('Instance')->unwrap('/')); - $this->assertEquals('path', Str::unwrap('path', '/')); - $this->assertEquals('path', Str::unwrap('path/', '/')); - $this->assertEquals('path', Str::unwrap('/path', '/')); - $this->assertEquals('path', Str::unwrap('/path/', '/')); - $this->assertEquals('path', Str::unwrap('path', '/x/', '/y/')); - $this->assertEquals('path', Str::unwrap('/x/path', '/x/', '/y/')); - $this->assertEquals('path', Str::unwrap('path/y/', '/x/', '/y/')); - $this->assertEquals('path', Str::unwrap('/x/path/y/', '/x/', '/y/')); - } + $this->assertEquals('path', Str::unwrap('path', '/')); + $this->assertEquals('path', Str::unwrap('path/', '/')); + $this->assertEquals('path', Str::unwrap('/path', '/')); + $this->assertEquals('path', Str::unwrap('/path/', '/')); + $this->assertEquals('path', Str::unwrap('path', '/x/', '/y/')); + $this->assertEquals('path', Str::unwrap('/x/path', '/x/', '/y/')); + $this->assertEquals('path', Str::unwrap('path/y/', '/x/', '/y/')); + $this->assertEquals('path', Str::unwrap('/x/path/y/', '/x/', '/y/')); + } - public function testWrapMethod (): void - { - $this->assertIsString(Str::wrap('Instance', '|')); - $this->assertInstanceOf(Stringable::class, Str::of('Instance')->wrap('|')); + public function testWrapMethod(): void + { + $this->assertIsString(Str::wrap('Instance', '|')); + $this->assertInstanceOf(Stringable::class, Str::of('Instance')->wrap('|')); - $this->assertEquals('/path/', Str::wrap('path', '/')); - $this->assertEquals('/path/', Str::wrap('path/', '/')); - $this->assertEquals('/path/', Str::wrap('/path', '/')); - $this->assertEquals('/path/', Str::wrap('/path/', '/')); - $this->assertEquals('/x/path/y/', Str::wrap('path', '/x/', '/y/')); - $this->assertEquals('/x/path/y/', Str::wrap('/x/path', '/x/', '/y/')); - $this->assertEquals('/x/path/y/', Str::wrap('path/y/', '/x/', '/y/')); - } + $this->assertEquals('/path/', Str::wrap('path', '/')); + $this->assertEquals('/path/', Str::wrap('path/', '/')); + $this->assertEquals('/path/', Str::wrap('/path', '/')); + $this->assertEquals('/path/', Str::wrap('/path/', '/')); + $this->assertEquals('/x/path/y/', Str::wrap('path', '/x/', '/y/')); + $this->assertEquals('/x/path/y/', Str::wrap('/x/path', '/x/', '/y/')); + $this->assertEquals('/x/path/y/', Str::wrap('path/y/', '/x/', '/y/')); + } } diff --git a/tests/WordsTest.php b/tests/WordsTest.php index d40e6f0..76b7619 100644 --- a/tests/WordsTest.php +++ b/tests/WordsTest.php @@ -14,8 +14,8 @@ public function testInstanceOfCollection(): void $this->assertInstanceOf(Collection::class, new Words([])); } - public function testToStringMethodReturnsString(): void - { + public function testToStringMethodReturnsString(): void + { // Default (space) $words = new Words('Same'); @@ -26,7 +26,7 @@ public function testToStringMethodReturnsString(): void // Custom glue $multi = new Words('multiple-words'); $this->assertEquals('multiple/words', $multi->toString('/')); - } + } public function testToStringMethodHandlesAcronymsCorrectly(): void { @@ -43,14 +43,14 @@ public function testToStringMethodHandlesDottedAcronymsCorrectly(): void $this->assertEquals('html-for-noobs', $acronyms->of()->slug()); } - public function testOfMethodReturnsStringableInstance(): void - { + public function testOfMethodReturnsStringableInstance(): void + { $this->assertInstanceOf(Stringable::class, (new Words('Stringable'))->of()); } - - public function testToArrayMethodReturnsArray(): void - { + + public function testToArrayMethodReturnsArray(): void + { $this->assertIsArray((new Words(''))->toArray()); $this->assertIsArray((new Words([]))->toArray()); - } -} \ No newline at end of file + } +}