-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
110 additions
and
0 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,48 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the core-library package. | ||
* | ||
* (c) 2021 WEBEWEB | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace WBW\Library\Traits\Strings; | ||
|
||
/** | ||
* String icon trait. | ||
* | ||
* @author webeweb <https://github.com/webeweb/> | ||
* @package WBW\Library\Traits\Strings | ||
*/ | ||
trait StringIconTrait { | ||
|
||
/** | ||
* Icon. | ||
* | ||
* @var string|null | ||
*/ | ||
protected $icon; | ||
|
||
/** | ||
* Get the icon. | ||
* | ||
* @return string|null Returns the icon. | ||
*/ | ||
public function getIcon(): ?string { | ||
return $this->icon; | ||
} | ||
|
||
/** | ||
* Set the icon. | ||
* | ||
* @param string|null $icon The icon. | ||
* @return self Returns this instance. | ||
*/ | ||
public function setIcon(?string $icon): self { | ||
$this->icon = $icon; | ||
return $this; | ||
} | ||
} |
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,25 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the core-library package. | ||
* | ||
* (c) 2021 WEBEWEB | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace WBW\Library\Traits\Tests\Fixtures\Strings; | ||
|
||
use WBW\Library\Traits\Strings\StringIconTrait; | ||
|
||
/** | ||
* Test string icon trait. | ||
* | ||
* @author webeweb <https://github.com/webeweb/> | ||
* @package WBW\Library\Traits\Tests\Fixtures\Strings | ||
*/ | ||
class TestStringIconTrait { | ||
|
||
use StringIconTrait; | ||
} |
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,37 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the core-library package. | ||
* | ||
* (c) 2021 WEBEWEB | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace WBW\Library\Traits\Tests\Strings; | ||
|
||
use WBW\Library\Traits\Tests\AbstractTestCase; | ||
use WBW\Library\Traits\Tests\Fixtures\Strings\TestStringIconTrait; | ||
|
||
/** | ||
* String icon trait test. | ||
* | ||
* @author webeweb <https://github.com/webeweb/> | ||
* @package WBW\Library\Traits\Tests\Strings | ||
*/ | ||
class StringIconTraitTest extends AbstractTestCase { | ||
|
||
/** | ||
* Tests the setIcon() method. | ||
* | ||
* @return void | ||
*/ | ||
public function testSetIcon(): void { | ||
|
||
$obj = new TestStringIconTrait(); | ||
|
||
$obj->setIcon("icon"); | ||
$this->assertEquals("icon", $obj->getIcon()); | ||
} | ||
} |