Skip to content

Commit

Permalink
Fixed tests. (#79)
Browse files Browse the repository at this point in the history
* Fixed tests.
  • Loading branch information
terabytesoftw committed Jan 25, 2023
1 parent 07d740a commit 9cb67d9
Show file tree
Hide file tree
Showing 16 changed files with 98 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Expand Up @@ -28,4 +28,4 @@ jobs:
os: >-
['ubuntu-latest', 'windows-latest']
php: >-
['7.4', '8.0', '8.1']
['8.0', '8.1']
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Expand Up @@ -28,4 +28,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['7.4', '8.0', '8.1']
['8.0', '8.1']
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -18,11 +18,11 @@
"source": "https://github.com/yiisoft/yii-bulma"
},
"require": {
"php": "^7.4|^8.0",
"php": "^8.0",
"yiisoft/arrays": "^2.0|^3.0",
"yiisoft/assets": "^2.0",
"yiisoft/html": "^2.0|^3.0",
"yiisoft/widget": "^1.0"
"yiisoft/widget": "^2.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
Expand Down
6 changes: 1 addition & 5 deletions phpunit.xml.dist
Expand Up @@ -2,12 +2,8 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" colors="true" verbose="true" bootstrap="vendor/autoload.php" failOnRisky="true" failOnWarning="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory>./</directory>
<directory>./src</directory>
</include>
<exclude>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
</coverage>
<php>
<ini name="error_reporting" value="-1"/>
Expand Down
4 changes: 2 additions & 2 deletions src/Breadcrumbs.php
Expand Up @@ -210,7 +210,7 @@ public function itemTemplate(string $value): self
return $new;
}

protected function run(): string
public function render(): string
{
if (empty($this->items)) {
return '';
Expand All @@ -234,8 +234,8 @@ protected function run(): string
Html::closeTag('ul') . PHP_EOL;

return $customTag
->addAttributes($attributes)
->content($content)
->attributes($attributes)
->encode(false)
->render();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Dropdown.php
Expand Up @@ -381,7 +381,7 @@ public function submenuAttributes(array $values): self
/**
* @throws CircularReferenceException|InvalidConfigException|NotFoundException|NotInstantiableException
*/
protected function run(): string
public function render(): string
{
return $this->renderDropdown();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Menu.php
Expand Up @@ -337,7 +337,7 @@ public function urlTemplate(string $value): self
*
* @return string the result of Widget execution to be outputted.
*/
protected function run(): string
public function render(): string
{
$items = $this->normalizeItems($this->items);

Expand Down Expand Up @@ -599,7 +599,7 @@ private function renderMenu(array $items): string
$content .= Html::closeTag('ul') . PHP_EOL;

return $customTag
->attributes($attributes)
->addAttributes($attributes)
->content($content)
->encode(false)
->render();
Expand Down
26 changes: 13 additions & 13 deletions src/Message.php
Expand Up @@ -299,7 +299,7 @@ public function withoutHeader(bool $value): self
return $new;
}

protected function run(): string
public function render(): string
{
return $this->renderMessage();
}
Expand Down Expand Up @@ -332,10 +332,10 @@ private function renderCloseButton(): string
}

return Button::tag()
->attributes($closeButtonAttributes)
->content($label)
->encode(false)
->render() . PHP_EOL;
->attributes($closeButtonAttributes)
->content($label)
->encode(false)
->render() . PHP_EOL;
}

private function renderHeader(): string
Expand All @@ -359,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;
Expand Down Expand Up @@ -407,9 +407,9 @@ private function renderMessageBody(): string
}

return Div::tag()
->attributes($bodyAttributes)
->content($body)
->encode(false)
->render() . PHP_EOL;
->attributes($bodyAttributes)
->content($body)
->encode(false)
->render() . PHP_EOL;
}
}
2 changes: 1 addition & 1 deletion src/Modal.php
Expand Up @@ -360,7 +360,7 @@ public function begin(): ?string
return $html;
}

protected function run(): string
public function render(): string
{
$html = Html::closeTag('div') . PHP_EOL; // .modal-content
$html .= Html::closeTag('div'); // .modal
Expand Down
20 changes: 10 additions & 10 deletions src/ModalCard.php
Expand Up @@ -558,7 +558,7 @@ public function begin(): ?string
return $html;
}

protected function run(): string
public function render(): string
{
$html = $this->renderBodyEnd() . "\n";
$html .= $this->renderFooter() . "\n";
Expand Down Expand Up @@ -621,8 +621,8 @@ private function renderCloseButton(): string
}

return Button::tag()
->attributes($closeButtonAttributes)
->render() . PHP_EOL;
->attributes($closeButtonAttributes)
->render() . PHP_EOL;
}

/**
Expand Down Expand Up @@ -663,19 +663,19 @@ private function renderHeader(): string
Html::addCssClass($titleAttributes, $this->titleClass);

$content .= P::tag()
->attributes($titleAttributes)
->content($this->title)
->render() . PHP_EOL;
->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;
}

/**
Expand Down
34 changes: 17 additions & 17 deletions src/Nav.php
Expand Up @@ -167,7 +167,7 @@ public function withoutActivateItems(): self
/**
* @throws CircularReferenceException|InvalidConfigException|NotFoundException|NotInstantiableException
*/
protected function run(): string
public function render(): string
{
return $this->renderNav();
}
Expand All @@ -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;
}

/**
Expand Down Expand Up @@ -279,9 +279,9 @@ private function renderLabelItem(

if ($iconText !== '' || $iconCssClass !== '') {
$html = Span::tag()
->attributes($iconAttributes)
->addAttributes($iconAttributes)
->content(CustomTag::name('i')
->class($iconCssClass)
->addClass($iconCssClass)
->content($iconText)
->encode(false)
->render())
Expand Down Expand Up @@ -419,19 +419,19 @@ private function renderNav(): string

if ($this->enclosedByStartMenu) {
$links = PHP_EOL . Div::tag()
->class($this->startCssClass)
->content($links)
->encode(false)
->render() .
->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() .
->class($this->endCssClass)
->content($links)
->encode(false)
->render() .
PHP_EOL;
}

Expand Down
44 changes: 22 additions & 22 deletions src/NavBar.php
Expand Up @@ -341,7 +341,7 @@ public function role(string $value): self
return $new;
}

protected function run(): string
public function render(): string
{
return Html::closeTag('nav');
}
Expand Down Expand Up @@ -372,11 +372,11 @@ private function renderNavBarBrand(): string
->url($this->brandImage)
->render();
$brand = PHP_EOL . A::tag()
->class($this->itemCssClass)
->content($brandImage)
->encode(false)
->url($this->brandUrl)
->render();
->class($this->itemCssClass)
->content($brandImage)
->encode(false)
->url($this->brandUrl)
->render();
}

if ($this->brandText !== '') {
Expand All @@ -388,25 +388,25 @@ private function renderNavBarBrand(): string

if (empty($this->brandUrl)) {
$brand = PHP_EOL . Span::tag()
->attributes($this->brandTextAttributes)
->class($this->itemCssClass)
->content($brandText)
->render();
->addAttributes($this->brandTextAttributes)
->addClass($this->itemCssClass)
->content($brandText)
->render();
} else {
$brand = PHP_EOL . A::tag()
->class($this->itemCssClass)
->content($brandText)
->encode(false)
->url($this->brandUrl)
->render();
->addClass($this->itemCssClass)
->content($brandText)
->encode(false)
->url($this->brandUrl)
->render();
}
}

$brand .= $this->renderNavBarBurger();

return Div::tag()
->attributes($this->brandAttributes)
->class($this->brandCssClass)
->addAttributes($this->brandAttributes)
->addClass($this->brandCssClass)
->content($brand)
->encode(false)
->render();
Expand Down Expand Up @@ -440,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;
->addAttributes($burgerAttributes)
->addClass($this->burgerCssClass)
->content($this->buttonLinkContent)
->encode(false)
->render() . PHP_EOL;
}
}
26 changes: 13 additions & 13 deletions src/Panel.php
Expand Up @@ -285,7 +285,7 @@ public function template(string $value): self
return $new;
}

protected function run(): string
public function render(): string
{
$attributes = $this->attributes;

Expand Down Expand Up @@ -320,9 +320,9 @@ private function renderHeading(): string
Html::addCssClass($headingAttributes, $this->headingClass);

return P::tag()
->attributes($headingAttributes)
->content($this->heading)
->render() . PHP_EOL;
->attributes($headingAttributes)
->content($this->heading)
->render() . PHP_EOL;
}

return '';
Expand All @@ -342,10 +342,10 @@ 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;
->attributes($tabsAttributes)
->content(PHP_EOL . $tabs)
->encode(false)
->render() . PHP_EOL;
}

return '';
Expand Down Expand Up @@ -440,12 +440,12 @@ private function renderItem(array $item): string

if ($icon !== '') {
$icon = PHP_EOL . I::tag()
->attributes(['aria-hidden' => 'true'])
->class($icon) . PHP_EOL;
->attributes(['aria-hidden' => 'true'])
->class($icon) . PHP_EOL;
$label = PHP_EOL . Span::tag()
->attributes($labelAttributes)
->content($icon)
->encode(false) . PHP_EOL .
->attributes($labelAttributes)
->content($icon)
->encode(false) . PHP_EOL .
$label . PHP_EOL;
}

Expand Down

0 comments on commit 9cb67d9

Please sign in to comment.