forked from xBBCoder/xBBCode
-
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.
fix: support https://html.spec.whatwg.org/#valid-navigable-target-name …
…for target attribute #5
- Loading branch information
Showing
3 changed files
with
28 additions
and
2 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
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,26 @@ | ||
<?php | ||
|
||
namespace Xbbcode\Tests\Tag; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Xbbcode\Tag\TagAbstract; | ||
|
||
class TagAbstractTest extends TestCase | ||
{ | ||
public function testTarget(): void | ||
{ | ||
$validTargets = ['_blank', '_self', '_parent', '_top', 'any_anchor', '123']; | ||
$invalidTargets = ['_fake', '_123']; | ||
|
||
$mock = $this->getMockForAbstractClass(TagAbstract::class); | ||
$method = new \ReflectionMethod($mock, 'isValidTarget'); | ||
$method->setAccessible(true); | ||
|
||
foreach ($validTargets as $target) { | ||
self::assertTrue($method->invoke($mock, $target)); | ||
} | ||
foreach ($invalidTargets as $target) { | ||
self::assertFalse($method->invoke($mock, $target)); | ||
} | ||
} | ||
} |
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