diff --git a/docs/modal.md b/docs/modal.md index c88d45b..23327f5 100644 --- a/docs/modal.md +++ b/docs/modal.md @@ -92,8 +92,13 @@ JS; $this->registerJs($modalJS); ?> -id('modal')->begin() . - Div::tag()->class('box')->content('Say hello...')->render() . PHP_EOL . +id('modal') + ->begin() . + Div::tag() + ->class('box') + ->content('Say hello...') + ->render() . PHP_EOL . Modal::end() ?> ``` diff --git a/docs/modalcard.md b/docs/modalcard.md index 5389912..f043a31 100644 --- a/docs/modalcard.md +++ b/docs/modalcard.md @@ -56,8 +56,12 @@ $this->registerJs($modalJS); footer( - Button::tag()->class('button is-success')->content('Save changes') . - Button::tag()->class('button is-danger is-outline')->content('Cancel') + Button::tag() + ->class('button is-success') + ->content('Save changes') . + Button::tag() + ->class('button is-danger is-outline') + ->content('Cancel') ) ->title('Modal title.') ->begin() ?> diff --git a/src/Breadcrumbs.php b/src/Breadcrumbs.php index 7891151..bc63efb 100644 --- a/src/Breadcrumbs.php +++ b/src/Breadcrumbs.php @@ -233,7 +233,11 @@ protected function run(): string implode('', $this->renderItems()) . Html::closeTag('ul') . PHP_EOL; - return $customTag->content($content)->attributes($attributes)->encode(false)->render(); + return $customTag + ->content($content) + ->attributes($attributes) + ->encode(false) + ->render(); } private function renderIcon(?string $icon, array $iconAttributes): string @@ -243,7 +247,9 @@ private function renderIcon(?string $icon, array $iconAttributes): string if ($icon !== null) { $html = Span::tag() ->attributes($iconAttributes) - ->content(I::tag()->attributes(['class' => $icon, 'aria-hidden' => 'true'])->render()) + ->content(I::tag() + ->attributes(['class' => $icon, 'aria-hidden' => 'true']) + ->render()) ->encode($this->encode) ->render(); } @@ -295,11 +301,18 @@ private function renderItem(array $item, string $template): string $icon = $this->renderIcon($icon, $iconAttributes); if ($icon !== '') { - $label = $icon . Span::tag()->content($label)->render(); + $label = $icon . Span::tag() + ->content($label) + ->render(); } $link = $url !== null - ? A::tag()->attributes($item)->content($label)->url($url)->encode($encode)->render() : $label; + ? A::tag() + ->attributes($item) + ->content($label) + ->url($url) + ->encode($encode) + ->render() : $label; return strtr($template, ['{link}' => $link, '{label}' => $label, '{icon}' => $icon]); } diff --git a/src/Dropdown.php b/src/Dropdown.php index 75cc482..eb50400 100644 --- a/src/Dropdown.php +++ b/src/Dropdown.php @@ -428,35 +428,35 @@ private function renderDropdownButton(string $id): string $buttonAttributes['aria-controls'] = $id; return Button::tag() - ->attributes($buttonAttributes) - ->content( - $this->renderLabelButton( - $this->buttonLabel, - $this->buttonLabelAttributes, - $this->buttonIconText, - $this->buttonIconCssClass, - $this->buttonIconAttributes, + ->attributes($buttonAttributes) + ->content( + $this->renderLabelButton( + $this->buttonLabel, + $this->buttonLabelAttributes, + $this->buttonIconText, + $this->buttonIconCssClass, + $this->buttonIconAttributes, + ) ) - ) - ->encode(false) - ->render() . PHP_EOL; + ->encode(false) + ->render() . PHP_EOL; } private function renderDropdownButtonLink(): string { return A::tag() - ->class($this->itemCssClass) - ->content( - $this->renderLabelButton( - $this->buttonLabel, - $this->buttonLabelAttributes, - $this->buttonIconText, - $this->buttonIconCssClass, - $this->buttonIconAttributes, + ->class($this->itemCssClass) + ->content( + $this->renderLabelButton( + $this->buttonLabel, + $this->buttonLabelAttributes, + $this->buttonIconText, + $this->buttonIconCssClass, + $this->buttonIconAttributes, + ) ) - ) - ->encode(false) - ->render() . PHP_EOL; + ->encode(false) + ->render() . PHP_EOL; } /** @@ -496,10 +496,10 @@ private function renderDropdownTrigger(string $id): string } return Div::tag() - ->class($this->triggerCssClass) - ->content(PHP_EOL . $button) - ->encode(false) - ->render() . PHP_EOL . $this->renderDropdownMenu($id); + ->class($this->triggerCssClass) + ->content(PHP_EOL . $button) + ->encode(false) + ->render() . PHP_EOL . $this->renderDropdownMenu($id); } /** @@ -516,7 +516,9 @@ private function renderItems(): string /** @var array|string $item */ foreach ($this->items as $item) { if ($item === '-') { - $lines[] = CustomTag::name('hr')->class($this->dividerCssClass)->render(); + $lines[] = CustomTag::name('hr') + ->class($this->dividerCssClass) + ->render(); } else { if (!isset($item['label'])) { throw new InvalidArgumentException('The "label" option is required.'); @@ -571,7 +573,9 @@ private function renderItems(): string if ($items === []) { if ($itemLabel === '-') { - $content = CustomTag::name('hr')->class($this->dividerCssClass)->render(); + $content = CustomTag::name('hr') + ->class($this->dividerCssClass) + ->render(); } elseif ($enclose === false) { $content = $itemLabel; } elseif ($url === '') { @@ -620,17 +624,21 @@ private function renderLabelButton( if ($label !== '') { $html = PHP_EOL . Span::tag() - ->attributes($labelAttributes) - ->content($label) - ->encode(false) - ->render(); + ->attributes($labelAttributes) + ->content($label) + ->encode(false) + ->render(); } if ($iconText !== '' || $iconCssClass !== '') { $html .= PHP_EOL . Span::tag() ->attributes($iconAttributes) - ->content(CustomTag::name('i')->class($iconCssClass)->content($iconText)->encode(false)->render()) + ->content(CustomTag::name('i') + ->class($iconCssClass) + ->content($iconText) + ->encode(false) + ->render()) ->encode(false) ->render(); } @@ -649,7 +657,11 @@ private function renderLabelItem( if ($iconText !== '' || $iconCssClass !== '') { $html = Span::tag() ->attributes($iconAttributes) - ->content(CustomTag::name('i')->class($iconCssClass)->content($iconText)->encode(false)->render()) + ->content(CustomTag::name('i') + ->class($iconCssClass) + ->content($iconText) + ->encode(false) + ->render()) ->encode(false) ->render(); } diff --git a/src/Menu.php b/src/Menu.php index f8866ca..998ef82 100644 --- a/src/Menu.php +++ b/src/Menu.php @@ -491,8 +491,10 @@ private function renderItems(array $items): string } } elseif (!empty($menu)) { $lines[] = $tag === null - ? $menu - : Html::tag($tag, $menu, $attributes)->encode(false)->render(); + ? $menu + : Html::tag($tag, $menu, $attributes) + ->encode(false) + ->render(); } } @@ -551,7 +553,10 @@ private function renderItem(array $item, array $linkAttributes): string return strtr( $labelTemplate, - ['{label}' => P::tag()->class('menu-label')->content($label)->render() . PHP_EOL] + ['{label}' => P::tag() + ->class('menu-label') + ->content($label) + ->render() . PHP_EOL] ); } @@ -560,7 +565,9 @@ private function renderIcon(string $icon, array $iconAttributes): string return $icon !== '' ? Span::tag() ->attributes($iconAttributes) - ->content(I::tag()->class($icon)->render()) + ->content(I::tag() + ->class($icon) + ->render()) ->encode(false) ->render() : ''; @@ -591,6 +598,10 @@ private function renderMenu(array $items): string $content .= PHP_EOL . $this->renderItems($items) . PHP_EOL; $content .= Html::closeTag('ul') . PHP_EOL; - return $customTag->attributes($attributes)->content($content)->encode(false)->render(); + return $customTag + ->attributes($attributes) + ->content($content) + ->encode(false) + ->render(); } } diff --git a/src/Message.php b/src/Message.php index 721a5cf..a6e741e 100644 --- a/src/Message.php +++ b/src/Message.php @@ -21,7 +21,10 @@ * For example, * * ```php - * headerColor('success')->header('System info')->body('Say hello...') ?> + * headerColor('success') + * ->header('System info') + * ->body('Say hello...') ?> * ``` * * @link https://bulma.io/documentation/components/message/ @@ -318,13 +321,21 @@ private function renderCloseButton(): string Html::addCssClass($closeButtonAttributes, $this->buttonCssClass); unset($closeButtonAttributes['label']); - $label = Span::tag()->attributes($buttonSpanAttributes)->content('×')->encode(false)->render(); + $label = Span::tag() + ->attributes($buttonSpanAttributes) + ->content('×') + ->encode(false) + ->render(); if ($this->size !== '') { Html::addCssClass($closeButtonAttributes, $this->size); } - return Button::tag()->attributes($closeButtonAttributes)->content($label)->encode(false)->render() . PHP_EOL; + return Button::tag() + ->attributes($closeButtonAttributes) + ->content($label) + ->encode(false) + ->render() . PHP_EOL; } private function renderHeader(): string @@ -348,10 +359,10 @@ private function renderHeader(): string if ($this->withoutHeader === false) { $html = Div::tag() - ->attributes($headerAttributes) - ->content($headerMessage) - ->encode(false) - ->render() . PHP_EOL; + ->attributes($headerAttributes) + ->content($headerMessage) + ->encode(false) + ->render() . PHP_EOL; } return $html; @@ -395,6 +406,10 @@ private function renderMessageBody(): string $body = PHP_EOL . $body . PHP_EOL; } - return Div::tag()->attributes($bodyAttributes)->content($body)->encode(false)->render() . PHP_EOL; + return Div::tag() + ->attributes($bodyAttributes) + ->content($body) + ->encode(false) + ->render() . PHP_EOL; } } diff --git a/src/Modal.php b/src/Modal.php index 6f55ae7..c2bcd95 100644 --- a/src/Modal.php +++ b/src/Modal.php @@ -392,7 +392,10 @@ private function renderToggleButton(string $id): string Html::addCssClass($toggleButtonAttributes, $this->buttonClass); - return Button::tag()->attributes($toggleButtonAttributes)->content($this->toggleButtonLabel)->render(); + return Button::tag() + ->attributes($toggleButtonAttributes) + ->content($this->toggleButtonLabel) + ->render(); } /** @@ -411,6 +414,8 @@ private function renderCloseButton(): string Html::addCssClass($closeButtonAttributes, $this->closeButtonClass); - return Button::tag()->attributes($closeButtonAttributes)->render(); + return Button::tag() + ->attributes($closeButtonAttributes) + ->render(); } } diff --git a/src/ModalCard.php b/src/ModalCard.php index 9e2bdec..1011318 100644 --- a/src/ModalCard.php +++ b/src/ModalCard.php @@ -575,7 +575,9 @@ protected function run(): string */ private function renderBackgroundTransparentOverlay(): string { - return Div::tag()->class($this->backgroundClass)->render(); + return Div::tag() + ->class($this->backgroundClass) + ->render(); } /** @@ -618,7 +620,9 @@ private function renderCloseButton(): string Html::addCssClass($closeButtonAttributes, $this->closeButtonSize); } - return Button::tag()->attributes($closeButtonAttributes)->render() . PHP_EOL; + return Button::tag() + ->attributes($closeButtonAttributes) + ->render() . PHP_EOL; } /** @@ -637,7 +641,11 @@ private function renderFooter(): string Html::addCssClass($footerAttributes, $this->footerClass); - return CustomTag::name('footer')->attributes($footerAttributes)->content($footer)->encode(false)->render(); + return CustomTag::name('footer') + ->attributes($footerAttributes) + ->content($footer) + ->encode(false) + ->render(); } /** @@ -654,17 +662,20 @@ private function renderHeader(): string Html::addCssClass($headerAttributes, $this->headerClass); Html::addCssClass($titleAttributes, $this->titleClass); - $content .= P::tag()->attributes($titleAttributes)->content($this->title)->render() . PHP_EOL; + $content .= P::tag() + ->attributes($titleAttributes) + ->content($this->title) + ->render() . PHP_EOL; if ($this->withoutCloseButton === false) { $content .= $this->renderCloseButton(); } return CustomTag::name('header') - ->attributes($headerAttributes) - ->content(PHP_EOL . $content) - ->encode(false) - ->render() . PHP_EOL; + ->attributes($headerAttributes) + ->content(PHP_EOL . $content) + ->encode(false) + ->render() . PHP_EOL; } /** @@ -695,6 +706,9 @@ private function renderToggleButton(string $id): string Html::addCssClass($toggleButtonAttributes, $this->buttonClass); - return Button::tag()->attributes($toggleButtonAttributes)->content($this->toggleButtonLabel)->render(); + return Button::tag() + ->attributes($toggleButtonAttributes) + ->content($this->toggleButtonLabel) + ->render(); } } diff --git a/src/Nav.php b/src/Nav.php index 9eb9c7c..cdaf3c5 100644 --- a/src/Nav.php +++ b/src/Nav.php @@ -188,12 +188,12 @@ protected function run(): string private function renderDropdown(array $items): string { return Dropdown::widget() - ->cssClass('navbar-dropdown') - ->dividerCssClass('navbar-divider') - ->enclosedByContainer() - ->itemCssClass('navbar-item') - ->items($items) - ->render() . PHP_EOL; + ->cssClass('navbar-dropdown') + ->dividerCssClass('navbar-divider') + ->enclosedByContainer() + ->itemCssClass('navbar-item') + ->items($items) + ->render() . PHP_EOL; } /** @@ -280,7 +280,11 @@ private function renderLabelItem( if ($iconText !== '' || $iconCssClass !== '') { $html = Span::tag() ->attributes($iconAttributes) - ->content(CustomTag::name('i')->class($iconCssClass)->content($iconText)->encode(false)->render()) + ->content(CustomTag::name('i') + ->class($iconCssClass) + ->content($iconText) + ->encode(false) + ->render()) ->encode(false) ->render(); } @@ -364,8 +368,17 @@ private function renderItem(array $item): string $items = $this->isChildActive($items, $active); $dropdown = PHP_EOL . $this->renderDropdown($items); - $a = A::tag()->attributes($urlAttributes)->content($itemLabel)->encode(false)->url($url)->render(); - $div = Div::tag()->attributes($dropdownAttributes)->content($dropdown)->encode(false)->render(); + $a = A::tag() + ->attributes($urlAttributes) + ->content($itemLabel) + ->encode(false) + ->url($url) + ->render(); + $div = Div::tag() + ->attributes($dropdownAttributes) + ->content($dropdown) + ->encode(false) + ->render(); $html = Div::tag() ->attributes($attributes) ->content(PHP_EOL . $a . PHP_EOL . $div . PHP_EOL) @@ -375,7 +388,12 @@ private function renderItem(array $item): string if ($html === '') { Html::addCssClass($urlAttributes, 'navbar-item'); - $html = A::tag()->attributes($urlAttributes)->content($itemLabel)->url($url)->encode(false)->render(); + $html = A::tag() + ->attributes($urlAttributes) + ->content($itemLabel) + ->url($url) + ->encode(false) + ->render(); } return $html; @@ -400,21 +418,29 @@ private function renderNav(): string $links = PHP_EOL . implode(PHP_EOL, $items) . PHP_EOL; if ($this->enclosedByStartMenu) { - $links = PHP_EOL . Div::tag()->class($this->startCssClass)->content($links)->encode(false)->render() . + $links = PHP_EOL . Div::tag() + ->class($this->startCssClass) + ->content($links) + ->encode(false) + ->render() . PHP_EOL; } if ($this->enclosedByEndMenu) { - $links = PHP_EOL . Div::tag()->class($this->endCssClass)->content($links)->encode(false)->render() . + $links = PHP_EOL . Div::tag() + ->class($this->endCssClass) + ->content($links) + ->encode(false) + ->render() . PHP_EOL; } return $this->items !== [] - ? Div::tag() + ? Div::tag() ->class($this->menuCssClass) ->content($links) ->encode(false) ->render() - : ''; + : ''; } } diff --git a/src/NavBar.php b/src/NavBar.php index f22d729..49620c2 100644 --- a/src/NavBar.php +++ b/src/NavBar.php @@ -367,13 +367,16 @@ private function renderNavBarBrand(): string $brandImage = ''; if ($this->brandImage !== '') { - $brandImage = Img::tag()->attributes($this->brandImageAttributes)->url($this->brandImage)->render(); - $brand = PHP_EOL . A::tag() - ->class($this->itemCssClass) - ->content($brandImage) - ->encode(false) - ->url($this->brandUrl) + $brandImage = Img::tag() + ->attributes($this->brandImageAttributes) + ->url($this->brandImage) ->render(); + $brand = PHP_EOL . A::tag() + ->class($this->itemCssClass) + ->content($brandImage) + ->encode(false) + ->url($this->brandUrl) + ->render(); } if ($this->brandText !== '') { @@ -385,17 +388,17 @@ private function renderNavBarBrand(): string if (empty($this->brandUrl)) { $brand = PHP_EOL . Span::tag() - ->attributes($this->brandTextAttributes) - ->class($this->itemCssClass) - ->content($brandText) - ->render(); + ->attributes($this->brandTextAttributes) + ->class($this->itemCssClass) + ->content($brandText) + ->render(); } else { $brand = PHP_EOL . A::tag() - ->class($this->itemCssClass) - ->content($brandText) - ->encode(false) - ->url($this->brandUrl) - ->render(); + ->class($this->itemCssClass) + ->content($brandText) + ->encode(false) + ->url($this->brandUrl) + ->render(); } } @@ -421,9 +424,15 @@ private function renderNavBarBurger(): string $burgerAttributes = $this->burgerAttributes; if ($this->buttonLinkContent === '') { $this->buttonLinkContent = PHP_EOL . - Span::tag()->attributes(['aria-hidden' => 'true'])->render() . PHP_EOL . - Span::tag()->attributes(['aria-hidden' => 'true'])->render() . PHP_EOL . - Span::tag()->attributes(['aria-hidden' => 'true'])->render() . PHP_EOL; + Span::tag() + ->attributes(['aria-hidden' => 'true']) + ->render() . PHP_EOL . + Span::tag() + ->attributes(['aria-hidden' => 'true']) + ->render() . PHP_EOL . + Span::tag() + ->attributes(['aria-hidden' => 'true']) + ->render() . PHP_EOL; } $burgerAttributes['aria-expanded'] = $this->buttonLinkAriaExpanded; @@ -431,10 +440,10 @@ private function renderNavBarBurger(): string $burgerAttributes['role'] = $this->buttonLinkRole; return PHP_EOL . A::tag() - ->attributes($burgerAttributes) - ->class($this->burgerCssClass) - ->content($this->buttonLinkContent) - ->encode(false) - ->render() . PHP_EOL; + ->attributes($burgerAttributes) + ->class($this->burgerCssClass) + ->content($this->buttonLinkContent) + ->encode(false) + ->render() . PHP_EOL; } } diff --git a/src/Panel.php b/src/Panel.php index e4d1466..367d151 100644 --- a/src/Panel.php +++ b/src/Panel.php @@ -319,7 +319,10 @@ private function renderHeading(): string if (!empty($this->heading)) { Html::addCssClass($headingAttributes, $this->headingClass); - return P::tag()->attributes($headingAttributes)->content($this->heading)->render() . PHP_EOL; + return P::tag() + ->attributes($headingAttributes) + ->content($this->heading) + ->render() . PHP_EOL; } return ''; @@ -338,7 +341,11 @@ private function renderTabs(string $id): string Html::addCssClass($tabsAttributes, $this->tabClass); - return P::tag()->attributes($tabsAttributes)->content(PHP_EOL . $tabs)->encode(false)->render() . PHP_EOL; + return P::tag() + ->attributes($tabsAttributes) + ->content(PHP_EOL . $tabs) + ->encode(false) + ->render() . PHP_EOL; } return ''; @@ -391,7 +398,11 @@ private function renderTab(int $index, array $item, string $id): string $this->tabItems[$index] = $tabsItems; } - return A::tag()->attributes($urlAttributes)->content($label)->encode(false)->render(); + return A::tag() + ->attributes($urlAttributes) + ->content($label) + ->encode(false) + ->render(); } private function renderItem(array $item): string @@ -428,12 +439,21 @@ private function renderItem(array $item): string Html::addCssClass($labelAttributes, $this->iconClass); if ($icon !== '') { - $icon = PHP_EOL . I::tag()->attributes(['aria-hidden' => 'true'])->class($icon) . PHP_EOL; - $label = PHP_EOL . Span::tag()->attributes($labelAttributes)->content($icon)->encode(false) . PHP_EOL . - $label . PHP_EOL; + $icon = PHP_EOL . I::tag() + ->attributes(['aria-hidden' => 'true']) + ->class($icon) . PHP_EOL; + $label = PHP_EOL . Span::tag() + ->attributes($labelAttributes) + ->content($icon) + ->encode(false) . PHP_EOL . + $label . PHP_EOL; } - return A::tag()->attributes($urlAttributes)->content($label)->encode(false)->render(); + return A::tag() + ->attributes($urlAttributes) + ->content($label) + ->encode(false) + ->render(); } /** diff --git a/src/ProgressBar.php b/src/ProgressBar.php index 8c8ed61..7cd0e8d 100644 --- a/src/ProgressBar.php +++ b/src/ProgressBar.php @@ -188,7 +188,10 @@ protected function run(): string $content = $attributes['value'] > 0 ? $attributes['value'] . '%' : ''; } - return CustomTag::name('progress')->attributes($attributes)->content($content)->render(); + return CustomTag::name('progress') + ->attributes($attributes) + ->content($content) + ->render(); } private function build(array $attributes): array diff --git a/src/Tabs.php b/src/Tabs.php index f2e4e4e..2b4d2f6 100644 --- a/src/Tabs.php +++ b/src/Tabs.php @@ -327,11 +327,11 @@ protected function run(): string } return Div::tag() - ->attributes($attributes) - ->content(PHP_EOL . $this->renderItems() . PHP_EOL) - ->id($id) - ->encode(false) - ->render() . $this->renderTabsContent(); + ->attributes($attributes) + ->content(PHP_EOL . $this->renderItems() . PHP_EOL) + ->id($id) + ->encode(false) + ->render() . $this->renderTabsContent(); } private function renderItems(): string @@ -362,7 +362,9 @@ private function renderItems(): string $renderItems .= PHP_EOL . $this->renderItem($index, $item); } - return Html::tag('ul', $renderItems . PHP_EOL, $this->itemsAttributes)->encode(false)->render(); + return Html::tag('ul', $renderItems . PHP_EOL, $this->itemsAttributes) + ->encode(false) + ->render(); } /** @@ -441,9 +443,15 @@ private function renderItem(int $index, array $item): string return Html::tag( 'li', - A::tag()->attributes($urlAttributes)->content($label)->encode(false)->render(), + A::tag() + ->attributes($urlAttributes) + ->content($label) + ->encode(false) + ->render(), $attributes - )->encode(false)->render(); + ) + ->encode(false) + ->render(); } private function renderIcon(string $label, string $icon, array $iconAttributes): string @@ -455,10 +463,14 @@ private function renderIcon(string $label, string $icon, array $iconAttributes): $elements = [ Span::tag() ->attributes($iconAttributes) - ->content(I::tag()->attributes(['class' => $icon, 'aria-hidden' => 'true'])->render()) + ->content(I::tag() + ->attributes(['class' => $icon, 'aria-hidden' => 'true']) + ->render()) ->encode(false) ->render(), - Span::tag()->content($label)->render(), + Span::tag() + ->content($label) + ->render(), ]; if ($rightSide === true) { @@ -484,10 +496,10 @@ private function renderTabsContent(): string if (!empty($this->tabsContent)) { $html .= PHP_EOL . Div::tag() - ->attributes($tabsContentAttributes) - ->content(PHP_EOL . implode(PHP_EOL, $tabsContent) . PHP_EOL) - ->encode(false) - ->render(); + ->attributes($tabsContentAttributes) + ->content(PHP_EOL . implode(PHP_EOL, $tabsContent) . PHP_EOL) + ->encode(false) + ->render(); } return $html; diff --git a/tests/BreadcrumbsTest.php b/tests/BreadcrumbsTest.php index bdc4ebe..24d9eef 100644 --- a/tests/BreadcrumbsTest.php +++ b/tests/BreadcrumbsTest.php @@ -30,7 +30,10 @@ public function testAriaLabel(): void HTML; $this->assertEqualsWithoutLE( $expected, - Breadcrumbs::widget()->ariaLabel('main')->items([['label' => 'About', 'url' => '/about']])->render(), + Breadcrumbs::widget() + ->ariaLabel('main') + ->items([['label' => 'About', 'url' => '/about']]) + ->render(), ); } @@ -81,7 +84,8 @@ public function testEncodeLabels(): void 'label' => 'Setting Profile', 'url' => '/about', ], - ])->render(), + ]) + ->render(), ); $expected = << 'Setting Profile', 'url' => '/about', ], - ])->render(), + ]) + ->render(), ); } @@ -307,7 +312,9 @@ public function testItemTemplateActive(): void */ public function testLinksEmpty(): void { - $this->assertempty(Breadcrumbs::widget()->items([])->render()); + $this->assertempty(Breadcrumbs::widget() + ->items([]) + ->render()); } /** @@ -324,7 +331,9 @@ public function testLinksEmptyUrl(): void HTML; - $this->assertEqualsWithoutLE($expected, Breadcrumbs::widget()->items(['label' => 'about'])->render()); + $this->assertEqualsWithoutLE($expected, Breadcrumbs::widget() + ->items(['label' => 'about']) + ->render()); } /** @@ -389,7 +398,8 @@ public function testRender(): void ['label' => 'Components', 'url' => '/components'], ['label' => 'Breadcrumb'], ], - )->render(), + ) + ->render(), ); } diff --git a/tests/DropdownTest.php b/tests/DropdownTest.php index 10be49a..ac0b2dc 100644 --- a/tests/DropdownTest.php +++ b/tests/DropdownTest.php @@ -472,7 +472,9 @@ public function testMissingLabel(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('The "label" option is required.'); - Dropdown::widget()->items([['url' => '#test']])->render(); + Dropdown::widget() + ->items([['url' => '#test']]) + ->render(); } /** @@ -640,7 +642,7 @@ public function testRenderSubmenu(): void 'submenu' => true, ], ]) - ->render(), + ->render(), ); } diff --git a/tests/MenuTest.php b/tests/MenuTest.php index c513a41..644810d 100644 --- a/tests/MenuTest.php +++ b/tests/MenuTest.php @@ -50,7 +50,7 @@ public function testActiveItemClosure(): void 'active' => false, ], ]) - ->render() + ->render() ); } @@ -95,8 +95,8 @@ public function testActivateItems(): void ], ], ]) - ->lastItemCssClass('testMe') - ->render() + ->lastItemCssClass('testMe') + ->render() ); $expected = <<lastItemCssClass('testMe') - ->render() + ->render() ); } @@ -535,7 +535,9 @@ public function testItemsClassAsString(): void public function testItemsEmpty(): void { $this->setInaccessibleProperty(new Html(), 'generateIdCounter', []); - $html = Menu::widget()->items([])->render(); + $html = Menu::widget() + ->items([]) + ->render(); $this->assertEmpty($html); } @@ -552,7 +554,9 @@ public function testItemsEmptyLabel(): void HTML; - $this->assertEqualsWithoutLE($expected, Menu::widget()->items([['url' => '#']])->render()); + $this->assertEqualsWithoutLE($expected, Menu::widget() + ->items([['url' => '#']]) + ->render()); } /** @@ -842,7 +846,9 @@ public function testRender(): void HTML; $this->assertEqualsWithoutLE( $expected, - Menu::widget()->items([['label' => 'Login', 'url' => 'auth/login']])->render() + Menu::widget() + ->items([['label' => 'Login', 'url' => 'auth/login']]) + ->render() ); } } diff --git a/tests/MessageTest.php b/tests/MessageTest.php index b2217f5..fca25b7 100644 --- a/tests/MessageTest.php +++ b/tests/MessageTest.php @@ -158,7 +158,9 @@ public function testHeaderColorException(): void $this->expectExceptionMessage( 'Invalid color. Valid values are: "is-primary", "is-link", "is-info", "is-success", "is-warning", "is-danger", "is-dark".' ); - Message::widget()->headerColor('is-non-existent')->render(); + Message::widget() + ->headerColor('is-non-existent') + ->render(); } /** @@ -297,7 +299,9 @@ public function testSizeException(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Invalid size. Valid values are: "is-small", "is-medium", "is-large".'); - Message::widget()->size('is-non-existent')->render(); + Message::widget() + ->size('is-non-existent') + ->render(); } /** diff --git a/tests/ModalCardTest.php b/tests/ModalCardTest.php index e87cbf6..769a60f 100644 --- a/tests/ModalCardTest.php +++ b/tests/ModalCardTest.php @@ -47,8 +47,12 @@ public function testAttributes(): void ModalCard::widget() ->attributes(['class' => 'bg-white']) ->footer( - Button::tag()->class('button is-success')->content('Save changes') . PHP_EOL . - Button::tag()->class('button is-danger is-outline')->content('Cancel') + Button::tag() + ->class('button is-success') + ->content('Save changes') . PHP_EOL . + Button::tag() + ->class('button is-danger is-outline') + ->content('Cancel') ) ->title('Modal title.') ->begin() . @@ -89,8 +93,12 @@ public function testBodyAttributes(): void ModalCard::widget() ->bodyAttributes(['class' => 'bg-white']) ->footer( - Button::tag()->class('button is-success')->content('Save changes') . PHP_EOL . - Button::tag()->class('button is-danger is-outline')->content('Cancel') + Button::tag() + ->class('button is-success') + ->content('Save changes') . PHP_EOL . + Button::tag() + ->class('button is-danger is-outline') + ->content('Cancel') ) ->title('Modal title.') ->begin() . @@ -131,8 +139,12 @@ public function testCardAttributes(): void ModalCard::widget() ->cardAttributes(['class' => 'bg-white']) ->footer( - Button::tag()->class('button is-success')->content('Save changes') . PHP_EOL . - Button::tag()->class('button is-danger is-outline')->content('Cancel') + Button::tag() + ->class('button is-success') + ->content('Save changes') . PHP_EOL . + Button::tag() + ->class('button is-danger is-outline') + ->content('Cancel') ) ->title('Modal title.') ->begin() . @@ -173,8 +185,12 @@ public function testCloseButtonAttributes(): void ModalCard::widget() ->closeButtonAttributes(['disabled' => true]) ->footer( - Button::tag()->class('button is-success')->content('Save changes') . PHP_EOL . - Button::tag()->class('button is-danger is-outline')->content('Cancel') + Button::tag() + ->class('button is-success') + ->content('Save changes') . PHP_EOL . + Button::tag() + ->class('button is-danger is-outline') + ->content('Cancel') ) ->title('Modal title.') ->begin() . @@ -216,8 +232,12 @@ public function testCloseButtonCssClass(): void ->closeButtonAttributes(['disabled' => true]) ->closeButtonCssClass('button is-danger is-outline') ->footer( - Button::tag()->class('button is-success')->content('Save changes') . PHP_EOL . - Button::tag()->class('button is-danger is-outline')->content('Cancel') + Button::tag() + ->class('button is-success') + ->content('Save changes') . PHP_EOL . + Button::tag() + ->class('button is-danger is-outline') + ->content('Cancel') ) ->title('Modal title.') ->begin() . @@ -258,8 +278,12 @@ public function testCloseButtonSize(): void ModalCard::widget() ->closeButtonSize(ModalCard::SIZE_LARGE) ->footer( - Button::tag()->class('button is-success')->content('Save changes') . PHP_EOL . - Button::tag()->class('button is-danger is-outline')->content('Cancel') + Button::tag() + ->class('button is-success') + ->content('Save changes') . PHP_EOL . + Button::tag() + ->class('button is-danger is-outline') + ->content('Cancel') ) ->title('Modal title.') ->begin() . @@ -279,7 +303,9 @@ public function testExceptionToggleButtonColor(): void $this->expectExceptionMessage( 'Invalid color. Valid values are: "is-primary", "is-link", "is-info", "is-success", "is-warning", "is-danger", "is-dark".' ); - ModalCard::widget()->toggleButtonColor('is-non-existent')->begin(); + ModalCard::widget() + ->toggleButtonColor('is-non-existent') + ->begin(); } /** @@ -289,7 +315,9 @@ public function testExceptionToggleButtonSize(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Invalid size. Valid values are: "is-small", "is-medium", "is-large".'); - ModalCard::widget()->toggleButtonSize('is-non-existent')->begin(); + ModalCard::widget() + ->toggleButtonSize('is-non-existent') + ->begin(); } /** @@ -299,7 +327,9 @@ public function testExceptionToggleCloseButtonSize(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Invalid size. Valid values are: "is-small", "is-medium", "is-large".'); - ModalCard::widget()->closeButtonSize('is-non-existent')->begin(); + ModalCard::widget() + ->closeButtonSize('is-non-existent') + ->begin(); } /** @@ -331,8 +361,12 @@ public function testFooterAttributes(): void $expected, ModalCard::widget() ->footer( - Button::tag()->class('button is-success')->content('Save changes') . PHP_EOL . - Button::tag()->class('button is-danger is-outline')->content('Cancel') + Button::tag() + ->class('button is-success') + ->content('Save changes') . PHP_EOL . + Button::tag() + ->class('button is-danger is-outline') + ->content('Cancel') ) ->footerAttributes(['class' => 'bg-transparent']) ->title('Modal title.') @@ -373,8 +407,12 @@ public function testHeaderOptions(): void $expected, ModalCard::widget() ->footer( - Button::tag()->class('button is-success')->content('Save changes') . PHP_EOL . - Button::tag()->class('button is-danger is-outline')->content('Cancel') + Button::tag() + ->class('button is-success') + ->content('Save changes') . PHP_EOL . + Button::tag() + ->class('button is-danger is-outline') + ->content('Cancel') ) ->headerAttributes(['class' => 'bg-info']) ->title('Modal title.') @@ -452,8 +490,12 @@ public function testTitleAttributes(): void ModalCard::widget() ->bodyAttributes(['class' => 'bg-white']) ->footer( - Button::tag()->class('button is-success')->content('Save changes') . PHP_EOL . - Button::tag()->class('button is-danger is-outline')->content('Cancel') + Button::tag() + ->class('button is-success') + ->content('Save changes') . PHP_EOL . + Button::tag() + ->class('button is-danger is-outline') + ->content('Cancel') ) ->title('Modal title.') ->titleAttributes(['class' => 'text-info']) @@ -494,8 +536,12 @@ public function testToggleButtonAttributes(): void $expected, ModalCard::widget() ->footer( - Button::tag()->class('button is-success')->content('Save changes') . PHP_EOL . - Button::tag()->class('button is-danger is-outline')->content('Cancel') + Button::tag() + ->class('button is-success') + ->content('Save changes') . PHP_EOL . + Button::tag() + ->class('button is-danger is-outline') + ->content('Cancel') ) ->title('Modal title.') ->toggleButtonAttributes(['disabled' => true]) @@ -536,8 +582,12 @@ public function testToggleButtonColor(): void $expected, ModalCard::widget() ->footer( - Button::tag()->class('button is-success')->content('Save changes') . PHP_EOL . - Button::tag()->class('button is-danger is-outline')->content('Cancel') + Button::tag() + ->class('button is-success') + ->content('Save changes') . PHP_EOL . + Button::tag() + ->class('button is-danger is-outline') + ->content('Cancel') ) ->title('Modal title.') ->toggleButtonColor(ModalCard::COLOR_SUCCESS) @@ -578,8 +628,12 @@ public function testToggleButtonLabel(): void $expected, ModalCard::widget() ->footer( - Button::tag()->class('button is-success')->content('Save changes') . PHP_EOL . - Button::tag()->class('button is-danger is-outline')->content('Cancel') + Button::tag() + ->class('button is-success') + ->content('Save changes') . PHP_EOL . + Button::tag() + ->class('button is-danger is-outline') + ->content('Cancel') ) ->title('Modal title.') ->toggleButtonLabel('Launch modal') @@ -620,8 +674,12 @@ public function testToggleButtonSize(): void $expected, ModalCard::widget() ->footer( - Button::tag()->class('button is-success')->content('Save changes') . PHP_EOL . - Button::tag()->class('button is-danger is-outline')->content('Cancel') + Button::tag() + ->class('button is-success') + ->content('Save changes') . PHP_EOL . + Button::tag() + ->class('button is-danger is-outline') + ->content('Cancel') ) ->title('Modal title.') ->toggleButtonSize(ModalCard::SIZE_LARGE) @@ -664,8 +722,12 @@ public function testRender(): void $expected, ModalCard::widget() ->footer( - Button::tag()->class('button is-success')->content('Save changes') . PHP_EOL . - Button::tag()->class('button is-danger is-outline')->content('Cancel') + Button::tag() + ->class('button is-success') + ->content('Save changes') . PHP_EOL . + Button::tag() + ->class('button is-danger is-outline') + ->content('Cancel') ) ->title('Modal title.') ->begin() . @@ -704,8 +766,12 @@ public function testWithoutCloseButton(): void $expected, ModalCard::widget() ->footer( - Button::tag()->class('button is-success')->content('Save changes') . PHP_EOL . - Button::tag()->class('button is-danger is-outline')->content('Cancel') + Button::tag() + ->class('button is-success') + ->content('Save changes') . PHP_EOL . + Button::tag() + ->class('button is-danger is-outline') + ->content('Cancel') ) ->title('Modal title.') ->withoutCloseButton(true) @@ -745,8 +811,12 @@ public function testWithoutToggleButton(): void $expected, ModalCard::widget() ->footer( - Button::tag()->class('button is-success')->content('Save changes') . PHP_EOL . - Button::tag()->class('button is-danger is-outline')->content('Cancel') + Button::tag() + ->class('button is-success') + ->content('Save changes') . PHP_EOL . + Button::tag() + ->class('button is-danger is-outline') + ->content('Cancel') ) ->title('Modal title.') ->withoutToggleButton(true) diff --git a/tests/ModalTest.php b/tests/ModalTest.php index 2936585..50921aa 100644 --- a/tests/ModalTest.php +++ b/tests/ModalTest.php @@ -33,8 +33,12 @@ public function testAttributes(): void HTML; $this->assertEqualsWithoutLE( $expected, - Modal::widget()->attributes(['class' => 'widescreen'])->begin() . - Div::tag()->class('box')->content('Say hello...') . PHP_EOL . + Modal::widget() + ->attributes(['class' => 'widescreen']) + ->begin() . + Div::tag() + ->class('box') + ->content('Say hello...') . PHP_EOL . Modal::end(), ); } @@ -56,7 +60,9 @@ public function testBackgroundClass(): void HTML; $this->assertEqualsWithoutLE( $expected, - Modal::widget()->backgroundClass('test-class')->begin() . Modal::end(), + Modal::widget() + ->backgroundClass('test-class') + ->begin() . Modal::end(), ); } @@ -77,7 +83,9 @@ public function testButtonClass(): void HTML; $this->assertEqualsWithoutLE( $expected, - Modal::widget()->buttonClass('test-class')->begin() . Modal::end(), + Modal::widget() + ->buttonClass('test-class') + ->begin() . Modal::end(), ); } @@ -98,7 +106,9 @@ public function testCloseButtonAttributes(): void HTML; $this->assertEqualsWithoutLE( $expected, - Modal::widget()->closeButtonAttributes(['class' => 'some-class'])->begin() . Modal::end(), + Modal::widget() + ->closeButtonAttributes(['class' => 'some-class']) + ->begin() . Modal::end(), ); } @@ -119,7 +129,9 @@ public function testCloseButtonSize(): void HTML; $this->assertEqualsWithoutLE( $expected, - Modal::widget()->closeButtonSize(Modal::SIZE_LARGE)->begin() . Modal::end(), + Modal::widget() + ->closeButtonSize(Modal::SIZE_LARGE) + ->begin() . Modal::end(), ); } @@ -140,7 +152,9 @@ public function testContentAttributes(): void HTML; $this->assertEqualsWithoutLE( $expected, - Modal::widget()->contentAttributes(['class' => 'some-class'])->begin() . Modal::end(), + Modal::widget() + ->contentAttributes(['class' => 'some-class']) + ->begin() . Modal::end(), ); } @@ -161,7 +175,9 @@ public function testContentClass(): void HTML; $this->assertEqualsWithoutLE( $expected, - Modal::widget()->contentClass('test-class')->begin() . Modal::end(), + Modal::widget() + ->contentClass('test-class') + ->begin() . Modal::end(), ); } @@ -239,7 +255,9 @@ public function testModalClass(): void HTML; $this->assertEqualsWithoutLE( $expected, - Modal::widget()->modalClass('test-class')->begin() . Modal::end(), + Modal::widget() + ->modalClass('test-class') + ->begin() . Modal::end(), ); } @@ -262,7 +280,10 @@ public function testRender(): void $this->assertEqualsWithoutLE( $expected, Modal::widget()->begin() . - Div::tag()->class('box')->content('Say hello...')->render() . PHP_EOL . + Div::tag() + ->class('box') + ->content('Say hello...') + ->render() . PHP_EOL . Modal::end(), ); } @@ -284,7 +305,9 @@ public function testToggleButtonAttributes(): void HTML; $this->assertEqualsWithoutLE( $expected, - Modal::widget()->toggleButtonAttributes(['class' => 'testMe'])->begin() . Modal::end(), + Modal::widget() + ->toggleButtonAttributes(['class' => 'testMe']) + ->begin() . Modal::end(), ); } @@ -305,7 +328,9 @@ public function testToggleButtonColor(): void HTML; $this->assertEqualsWithoutLE( $expected, - Modal::widget()->toggleButtonColor(Modal::COLOR_INFO)->begin() . Modal::end(), + Modal::widget() + ->toggleButtonColor(Modal::COLOR_INFO) + ->begin() . Modal::end(), ); } @@ -326,7 +351,9 @@ public function testToggleButtonLabel(): void HTML; $this->assertEqualsWithoutLE( $expected, - Modal::widget()->toggleButtonLabel('Click to open.')->begin() . Modal::end(), + Modal::widget() + ->toggleButtonLabel('Click to open.') + ->begin() . Modal::end(), ); } @@ -347,7 +374,9 @@ public function testToggleButtonSize(): void HTML; $this->assertEqualsWithoutLE( $expected, - Modal::widget()->toggleButtonSize(Modal::SIZE_LARGE)->begin() . Modal::end(), + Modal::widget() + ->toggleButtonSize(Modal::SIZE_LARGE) + ->begin() . Modal::end(), ); } @@ -365,7 +394,9 @@ public function testWithoutCloseButton(): void HTML; - $this->assertEqualsWithoutLE($expected, Modal::widget()->withoutCloseButton(true)->begin() . Modal::end()); + $this->assertEqualsWithoutLE($expected, Modal::widget() + ->withoutCloseButton(true) + ->begin() . Modal::end()); } /** @@ -382,6 +413,8 @@ public function testWithoutToggleButton(): void HTML; - $this->assertEqualsWithoutLE($expected, Modal::widget()->withoutToggleButton(true)->begin() . Modal::end()); + $this->assertEqualsWithoutLE($expected, Modal::widget() + ->withoutToggleButton(true) + ->begin() . Modal::end()); } } diff --git a/tests/NavBarTest.php b/tests/NavBarTest.php index e032354..a2c4c46 100644 --- a/tests/NavBarTest.php +++ b/tests/NavBarTest.php @@ -32,7 +32,9 @@ public function testAriaLabel(): void HTML; $this->assertEqualsWithoutLE( $expected, - NavBar::widget()->ariaLabel('main')->begin() . NavBar::end() + NavBar::widget() + ->ariaLabel('main') + ->begin() . NavBar::end() ); } @@ -55,7 +57,9 @@ public function testBrandAttributes(): void HTML; $this->assertEqualsWithoutLE( $expected, - NavBar::widget()->brandAttributes(['class' => 'text-danger'])->begin() . NavBar::end() + NavBar::widget() + ->brandAttributes(['class' => 'text-danger']) + ->begin() . NavBar::end() ); } @@ -78,7 +82,9 @@ public function testBrandCssClass(): void HTML; $this->assertEqualsWithoutLE( $expected, - NavBar::widget()->brandCssClass('has-text-center navbar-brand')->begin() . NavBar::end() + NavBar::widget() + ->brandCssClass('has-text-center navbar-brand') + ->begin() . NavBar::end() ); } @@ -129,7 +135,9 @@ public function testBrandText(): void HTML; - $this->assertEqualsWithoutLE($expected, NavBar::widget()->brandText('My Project')->begin() . NavBar::end()); + $this->assertEqualsWithoutLE($expected, NavBar::widget() + ->brandText('My Project') + ->begin() . NavBar::end()); } /** @@ -210,7 +218,9 @@ public function testBurgerAttributes(): void HTML; $this->assertEqualsWithoutLE( $expected, - NavBar::widget()->burgerAttributes(['class' => 'has-text-center'])->begin() . NavBar::end() + NavBar::widget() + ->burgerAttributes(['class' => 'has-text-center']) + ->begin() . NavBar::end() ); } @@ -233,7 +243,9 @@ public function testBurgerCssClass(): void HTML; $this->assertEqualsWithoutLE( $expected, - NavBar::widget()->burgerCssClass('has-text-center navbar-burguer')->begin() . NavBar::end() + NavBar::widget() + ->burgerCssClass('has-text-center navbar-burguer') + ->begin() . NavBar::end() ); } @@ -256,7 +268,9 @@ public function testButtonLinkAriaExpanded(): void HTML; $this->assertEqualsWithoutLE( $expected, - NavBar::widget()->buttonLinkAriaExpanded('true')->begin() . NavBar::end() + NavBar::widget() + ->buttonLinkAriaExpanded('true') + ->begin() . NavBar::end() ); } @@ -279,7 +293,9 @@ public function testButtonLinkAriaLabelText(): void HTML; $this->assertEqualsWithoutLE( $expected, - NavBar::widget()->buttonLinkAriaLabelText('menu-text')->begin() . NavBar::end() + NavBar::widget() + ->buttonLinkAriaLabelText('menu-text') + ->begin() . NavBar::end() ); } @@ -324,7 +340,9 @@ public function testButtonLinkRole(): void HTML; $this->assertEqualsWithoutLE( $expected, - NavBar::widget()->buttonLinkRole('button-text')->begin() . NavBar::end() + NavBar::widget() + ->buttonLinkRole('button-text') + ->begin() . NavBar::end() ); } @@ -347,7 +365,9 @@ public function testCssClass(): void HTML; $this->assertEqualsWithoutLE( $expected, - NavBar::widget()->cssClass('has-text-danger navbar')->begin() . NavBar::end() + NavBar::widget() + ->cssClass('has-text-danger navbar') + ->begin() . NavBar::end() ); } @@ -368,7 +388,9 @@ public function testId(): void HTML; - $this->assertEqualsWithoutLE($expected, NavBar::widget()->id('id-test')->begin() . NavBar::end()); + $this->assertEqualsWithoutLE($expected, NavBar::widget() + ->id('id-test') + ->begin() . NavBar::end()); } /** @@ -467,7 +489,9 @@ public function testRole(): void HTML; $this->assertEqualsWithoutLE( $expected, - NavBar::widget()->role('navigation-text')->begin() . NavBar::end() + NavBar::widget() + ->role('navigation-text') + ->begin() . NavBar::end() ); } } diff --git a/tests/NavTest.php b/tests/NavTest.php index b3fabdf..06ef03e 100644 --- a/tests/NavTest.php +++ b/tests/NavTest.php @@ -97,7 +97,8 @@ public function testDropdown(): void ['label' => 'Components', 'url' => '#'], ], ], - ])->render(), + ]) + ->render(), ); } @@ -144,7 +145,8 @@ public function testDropdownWithDropdownAttributes(): void ], 'visible' => false, ], - ])->render(), + ]) + ->render(), ); } @@ -241,7 +243,9 @@ public function testEncodeLabels(): void HTML; $this->assertEqualsWithoutLE( $expected, - Nav::widget()->items([['label' => 'a & b', 'encode' => true]])->render(), + Nav::widget() + ->items([['label' => 'a & b', 'encode' => true]]) + ->render(), ); } @@ -341,8 +345,8 @@ public function testIcon(): void ], [ 'label' => 'Admin' . Img::tag() - ->attributes(['class' => 'img-rounded', 'aria-expanded' => 'false']) - ->url('../../docs/images/icon-avatar.png'), + ->attributes(['class' => 'img-rounded', 'aria-expanded' => 'false']) + ->url('../../docs/images/icon-avatar.png'), 'items' => [ ['label' => 'Logout', 'url' => '/auth/logout'], ], @@ -406,7 +410,8 @@ public function testImplicitActiveSubItems(): void ['label' => 'Page3', 'content' => 'Page3', 'url' => '/site/page3', 'active' => true], ], ], - ])->render(), + ]) + ->render(), ); } @@ -434,7 +439,9 @@ public function testMissingLabel(): void $this->setInaccessibleProperty(new Html(), 'generateIdCounter', []); $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('The "label" option is required.'); - Nav::widget()->items([['content' => 'Page1']])->render(); + Nav::widget() + ->items([['content' => 'Page1']]) + ->render(); } /** @@ -450,7 +457,9 @@ public function testRender(): void HTML; $this->assertEqualsWithoutLE( $expected, - Nav::widget()->items([['label' => 'Page1', 'url' => '#']])->render(), + Nav::widget() + ->items([['label' => 'Page1', 'url' => '#']]) + ->render(), ); } @@ -467,7 +476,9 @@ public function testRenderItemsDisabled(): void HTML; $this->assertEqualsWithoutLE( $expected, - Nav::widget()->items([['label' => 'a & b', 'disabled' => true]])->render(), + Nav::widget() + ->items([['label' => 'a & b', 'disabled' => true]]) + ->render(), ); } @@ -491,7 +502,9 @@ public function testRenderItemsEmpty(): void ->render() ); - $this->assertEmpty(Nav::widget()->items([])->render()); + $this->assertEmpty(Nav::widget() + ->items([]) + ->render()); } /** @@ -505,6 +518,8 @@ public function testRenderItemsWithoutUrl(): void Page1 HTML; - $this->assertEqualsWithoutLE($expected, Nav::widget()->items([['label' => 'Page1']])->render()); + $this->assertEqualsWithoutLE($expected, Nav::widget() + ->items([['label' => 'Page1']]) + ->render()); } } diff --git a/tests/PanelTest.php b/tests/PanelTest.php index 708974c..0c9e1ec 100644 --- a/tests/PanelTest.php +++ b/tests/PanelTest.php @@ -24,7 +24,9 @@ public function testAttributes(): void HTML; - $this->assertEqualsWithoutLE($expected, Panel::widget()->attributes(['class' => 'my-class'])->render()); + $this->assertEqualsWithoutLE($expected, Panel::widget() + ->attributes(['class' => 'my-class']) + ->render()); } /** @@ -65,7 +67,10 @@ public function testColor(): void HTML; $this->assertEqualsWithoutLE( $expected, - Panel::widget()->heading('Repositories')->color(Panel::COLOR_PRIMARY)->render(), + Panel::widget() + ->heading('Repositories') + ->color(Panel::COLOR_PRIMARY) + ->render(), ); } @@ -84,7 +89,10 @@ public function testCssClass(): void HTML; $this->assertEqualsWithoutLE( $expected, - Panel::widget()->cssClass('test-class')->tabs([['label' => 'all']])->render() + Panel::widget() + ->cssClass('test-class') + ->tabs([['label' => 'all']]) + ->render() ); } @@ -97,7 +105,9 @@ public function testExceptionColor(): void $this->expectExceptionMessage( 'Invalid color. Valid values are: "is-primary is-link is-info is-success is-warning is-danger is-dark".' ); - Panel::widget()->color('is-non-existent')->render(); + Panel::widget() + ->color('is-non-existent') + ->render(); } /** @@ -111,7 +121,9 @@ public function testHeading(): void

Repositories

HTML; - $this->assertEqualsWithoutLE($expected, Panel::widget()->heading('Repositories')->render()); + $this->assertEqualsWithoutLE($expected, Panel::widget() + ->heading('Repositories') + ->render()); } /** @@ -127,7 +139,10 @@ public function testHeadingClass(): void HTML; $this->assertEqualsWithoutLE( $expected, - Panel::widget()->heading('Repositories')->headingClass('test-class')->render() + Panel::widget() + ->heading('Repositories') + ->headingClass('test-class') + ->render() ); } @@ -144,7 +159,10 @@ public function testHeadingAttributes(): void HTML; $this->assertEqualsWithoutLE( $expected, - Panel::widget()->heading('Repositories')->headingAttributes(['class' => 'my-class'])->render(), + Panel::widget() + ->heading('Repositories') + ->headingAttributes(['class' => 'my-class']) + ->render(), ); } @@ -178,7 +196,9 @@ public function testImmutability(): void public function testItemMissigLabel(): void { $this->expectException(InvalidArgumentException::class); - Panel::widget()->tabs([['label' => 'All', 'items' => [['icon' => 'fas fa-book']]]])->render(); + Panel::widget() + ->tabs([['label' => 'All', 'items' => [['icon' => 'fas fa-book']]]]) + ->render(); } /** @@ -488,7 +508,9 @@ public function testTabActive(): void public function testTabMissigLabel(): void { $this->expectException(InvalidArgumentException::class); - Panel::widget()->tabs([[]])->render(); + Panel::widget() + ->tabs([[]]) + ->render(); } /** diff --git a/tests/ProgressBarTest.php b/tests/ProgressBarTest.php index fbd2eb1..e12f487 100644 --- a/tests/ProgressBarTest.php +++ b/tests/ProgressBarTest.php @@ -25,7 +25,9 @@ public function testAttributes(): void HTML; $this->assertEqualsWithoutLE( $expected, - ProgressBar::widget()->attributes(['class' => 'has-background-black'])->render(), + ProgressBar::widget() + ->attributes(['class' => 'has-background-black']) + ->render(), ); } @@ -38,7 +40,9 @@ public function testColor(): void $expected = << HTML; - $this->assertEqualsWithoutLE($expected, ProgressBar::widget()->color(ProgressBar::COLOR_PRIMARY)->render()); + $this->assertEqualsWithoutLE($expected, ProgressBar::widget() + ->color(ProgressBar::COLOR_PRIMARY) + ->render()); } /** @@ -50,7 +54,9 @@ public function testExceptionColor(): void $this->expectExceptionMessage( 'Invalid color. Valid values are: "is-primary", "is-link", "is-info", "is-success", "is-warning", "is-danger", "is-dark".' ); - ProgressBar::widget()->color('is-non-existent')->render(); + ProgressBar::widget() + ->color('is-non-existent') + ->render(); } /** @@ -60,7 +66,9 @@ public function testExceptionSize(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Invalid size. Valid values are: "is-small", "is-medium", "is-large".'); - ProgressBar::widget()->size('is-non-existent')->render(); + ProgressBar::widget() + ->size('is-non-existent') + ->render(); } /** @@ -88,7 +96,9 @@ public function testMax(): void $expected = << HTML; - $this->assertEqualsWithoutLE($expected, ProgressBar::widget()->maxValue(50)->render()); + $this->assertEqualsWithoutLE($expected, ProgressBar::widget() + ->maxValue(50) + ->render()); } /** @@ -99,7 +109,9 @@ public function testMaxException(): void $this->setInaccessibleProperty(new Html(), 'generateIdCounter', []); $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Invalid max value. It must be between 0 and 100.'); - ProgressBar::widget()->maxValue(150)->render(); + ProgressBar::widget() + ->maxValue(150) + ->render(); } /** @@ -111,7 +123,9 @@ public function testPercent(): void $expected = <<75% HTML; - $this->assertEqualsWithoutLE($expected, ProgressBar::widget()->value(75)->render()); + $this->assertEqualsWithoutLE($expected, ProgressBar::widget() + ->value(75) + ->render()); } /** @@ -123,7 +137,9 @@ public function testSize(): void $expected = << HTML; - $this->assertEqualsWithoutLE($expected, ProgressBar::widget()->size(ProgressBar::SIZE_LARGE)->render()); + $this->assertEqualsWithoutLE($expected, ProgressBar::widget() + ->size(ProgressBar::SIZE_LARGE) + ->render()); } /** @@ -146,7 +162,9 @@ public function testValueExceptionWithLessThanZero(): void $this->setInaccessibleProperty(new Html(), 'generateIdCounter', []); $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Invalid value. It must be between 0 and 100.'); - ProgressBar::widget()->value(-1)->render(); + ProgressBar::widget() + ->value(-1) + ->render(); } /** @@ -157,7 +175,9 @@ public function testValueExceptionWithGreaterZero(): void $this->setInaccessibleProperty(new Html(), 'generateIdCounter', []); $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Invalid value. It must be between 0 and 100.'); - ProgressBar::widget()->value(150)->render(); + ProgressBar::widget() + ->value(150) + ->render(); } /** @@ -169,7 +189,10 @@ public function testWithZeroValues(): void $expected = << HTML; - $this->assertEqualsWithoutLE($expected, ProgressBar::widget()->value(0)->maxValue(0)->render()); + $this->assertEqualsWithoutLE($expected, ProgressBar::widget() + ->value(0) + ->maxValue(0) + ->render()); } /** @@ -181,6 +204,9 @@ public function testWithNullValues(): void $expected = << HTML; - $this->assertEqualsWithoutLE($expected, ProgressBar::widget()->value(null)->maxValue(null)->render()); + $this->assertEqualsWithoutLE($expected, ProgressBar::widget() + ->value(null) + ->maxValue(null) + ->render()); } } diff --git a/tests/TabsTest.php b/tests/TabsTest.php index e1d6e89..2655ff2 100644 --- a/tests/TabsTest.php +++ b/tests/TabsTest.php @@ -43,7 +43,9 @@ public function testAlignment(): void HTML; - $this->assertEqualsWithoutLE($expected, Tabs::widget()->alignment(Tabs::ALIGNMENT_CENTERED)->render()); + $this->assertEqualsWithoutLE($expected, Tabs::widget() + ->alignment(Tabs::ALIGNMENT_CENTERED) + ->render()); } public function testAttributes(): void @@ -55,7 +57,9 @@ public function testAttributes(): void HTML; - $this->assertEqualsWithoutLE($expected, Tabs::widget()->attributes(['class' => 'some-class'])->render()); + $this->assertEqualsWithoutLE($expected, Tabs::widget() + ->attributes(['class' => 'some-class']) + ->render()); } public function testCurrentPath(): void @@ -77,7 +81,7 @@ public function testCurrentPath(): void ['label' => 'Tab 1', 'url' => 'site/index'], ['label' => 'Tab 2', 'url' => 'site/contact'], ]) - ->render() + ->render() ); } @@ -125,19 +129,25 @@ public function testEncode(): void public function testExceptionSize(): void { $this->expectException(InvalidArgumentException::class); - Tabs::widget()->size('is-non-existent')->render(); + Tabs::widget() + ->size('is-non-existent') + ->render(); } public function testExceptionAlignment(): void { $this->expectException(InvalidArgumentException::class); - Tabs::widget()->alignment('is-non-existent')->render(); + Tabs::widget() + ->alignment('is-non-existent') + ->render(); } public function testExceptionStyle(): void { $this->expectException(InvalidArgumentException::class); - Tabs::widget()->style('is-non-existent')->render(); + Tabs::widget() + ->style('is-non-existent') + ->render(); } public function testIcon(): void @@ -295,7 +305,9 @@ public function testItemsAttributes(): void public function testMissingLabel(): void { $this->expectException(InvalidArgumentException::class); - Tabs::widget()->items([['content' => 'Some text about music']])->render(); + Tabs::widget() + ->items([['content' => 'Some text about music']]) + ->render(); } public function testRender(): void @@ -319,7 +331,9 @@ public function testSize(): void HTML; - $this->assertEqualsWithoutLE($expected, Tabs::widget()->size(Tabs::SIZE_LARGE)->render()); + $this->assertEqualsWithoutLE($expected, Tabs::widget() + ->size(Tabs::SIZE_LARGE) + ->render()); } public function testStyle(): void @@ -331,7 +345,9 @@ public function testStyle(): void HTML; - $this->assertEqualsWithoutLE($expected, Tabs::widget()->style(Tabs::STYLE_TOGGLE_ROUNDED)->render()); + $this->assertEqualsWithoutLE($expected, Tabs::widget() + ->style(Tabs::STYLE_TOGGLE_ROUNDED) + ->render()); } public function testTabsContent(): void