-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix isset magic function for Getter method and add test for setter trait
- Loading branch information
Showing
3 changed files
with
70 additions
and
1 deletion.
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
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,44 @@ | ||
<?php | ||
|
||
namespace Soheilrt\AdobeConnectClient\Tests\Unit\Traits; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
class SetterTraitTest extends TestCase | ||
{ | ||
private $setter; | ||
|
||
public function test_has_property() | ||
{ | ||
$this->assertTrue(isset($this->setter->privateProperty)); | ||
$this->assertEquals('private property', $this->setter->privateProperty); | ||
|
||
$this->assertFalse(isset($this->setter->NotAvailableProperty)); | ||
$this->assertNull($this->setter->NotAvailableProp); | ||
} | ||
|
||
public function test_has_attribute() | ||
{ | ||
$this->assertTrue(isset($this->setter->property_attribute)); | ||
$this->assertEquals('attribute value', $this->setter->property_attribute); | ||
|
||
$this->assertFalse(isset($this->setter->not_exists_attribute)); | ||
$this->assertNull($this->setter->Not_exists_attribute); | ||
} | ||
|
||
public function test_getter() | ||
{ | ||
$this->assertTrue(isset($this->setter->propertyGetter)); | ||
$this->assertEquals('getter value', $this->setter->PropertyGetter); | ||
|
||
$this->assertFalse(isset($this->setter->propertyNotExistsGetter)); | ||
$this->assertNull($this->setter->propertyNotExistsGetter); | ||
} | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->setter = new SetterTraitTestClass(); | ||
} | ||
} | ||
|
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 | ||
|
||
|
||
namespace Soheilrt\AdobeConnectClient\Tests\Unit\Traits; | ||
|
||
|
||
use Soheilrt\AdobeConnectClient\Client\Traits\Setter; | ||
|
||
class SetterTraitTestClass | ||
{ | ||
use Setter; | ||
|
||
private $privateProperty='private property'; | ||
|
||
public function __construct() | ||
{ | ||
$this->{$this->getQualifiedAttributeName('property_attribute')}='attribute value'; | ||
} | ||
|
||
public function getPropertyGetter():string | ||
{ | ||
return 'getter value'; | ||
} | ||
|
||
} |