-
Notifications
You must be signed in to change notification settings - Fork 7
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
1 parent
27a69ed
commit c565acf
Showing
4 changed files
with
152 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,31 @@ | ||
<?php | ||
|
||
namespace phpunit\Models\Configuration; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use PHPUnuhi\Models\Configuration\Marker; | ||
|
||
class MarkerTest extends TestCase | ||
{ | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function testStart(): void | ||
{ | ||
$marker = new Marker('<', '>'); | ||
|
||
$this->assertEquals('<', $marker->getStart()); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function testEnd(): void | ||
{ | ||
$marker = new Marker('<', '>'); | ||
|
||
$this->assertEquals('>', $marker->getEnd()); | ||
} | ||
|
||
} |
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,51 @@ | ||
<?php | ||
|
||
namespace phpunit\Models\Configuration; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use PHPUnuhi\Models\Configuration\Protection; | ||
|
||
class ProtectionTest extends TestCase | ||
{ | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function testAddMarker(): void | ||
{ | ||
$protection = new Protection(); | ||
|
||
$protection->addMarker('<', '>'); | ||
$protection->addMarker('[', ']'); | ||
|
||
$this->assertEquals('<', $protection->getMarkers()[0]->getStart()); | ||
$this->assertEquals('[', $protection->getMarkers()[1]->getStart()); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function testAddTerm(): void | ||
{ | ||
$protection = new Protection(); | ||
|
||
$protection->addTerm('device'); | ||
|
||
$this->assertEquals('device', $protection->getTerms()[0]); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function testAddTermDuplicateSkipped(): void | ||
{ | ||
$protection = new Protection(); | ||
|
||
$protection->addTerm('hardware'); | ||
$protection->addTerm('device'); | ||
$protection->addTerm('device'); | ||
|
||
$this->assertCount(2, $protection->getTerms()); | ||
} | ||
|
||
} |
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,31 @@ | ||
<?php | ||
|
||
namespace phpunit\Models\Configuration; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use PHPUnuhi\Models\Configuration\Rule; | ||
|
||
class RuleTest extends TestCase | ||
{ | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function testName(): void | ||
{ | ||
$rule = new Rule('color-rule', 'black'); | ||
|
||
$this->assertEquals('color-rule', $rule->getName()); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
public function testValue(): void | ||
{ | ||
$rule = new Rule('color-rule', 'black'); | ||
|
||
$this->assertEquals('black', $rule->getValue()); | ||
} | ||
|
||
} |
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