generated from helsingborg-stad/Wordpress-Plugin-Boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BaseController buildAttributes throws error when attribute value is n…
…ot a string (#310) * fix: BaseController buildAttributes throws if attribute value not string * refactor: BaseController buildAttributes * refactor: BaseController buildAttributes
- Loading branch information
Showing
2 changed files
with
34 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
use ComponentLibrary\Component\BaseController; | ||
|
||
class BaseControllerTest extends PHPUnit\Framework\TestCase | ||
{ | ||
public function testBuildAttributesReturnsAllAttributesAsString() | ||
{ | ||
$attributes = ['One' => 'one', 'Two' => 'two']; | ||
$this->assertEquals('One="one" Two="two"', BaseController::buildAttributes($attributes)); | ||
} | ||
|
||
public function testBuildAttributesOnlyHandlesAttributeStringValues() | ||
{ | ||
$attributes = ['One' => ['foo']]; | ||
$this->assertEquals('', BaseController::buildAttributes($attributes)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters