generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
9 additions
and
16 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 |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
use Attribute; | ||
|
||
#[Attribute(Attribute::TARGET_CLASS)] | ||
final readonly class Unsafe {} | ||
readonly class Unsafe {} |
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 |
---|---|---|
|
@@ -5,13 +5,6 @@ | |
use Mokhosh\Muddle\Strategies\Link; | ||
use Mokhosh\Muddle\Strategies\Text; | ||
|
||
it('works with basic unsafe strategies', function () { | ||
expect(Muddle::text('[email protected]')) | ||
->toBe('[email protected]') | ||
->and(Muddle::link('[email protected]')) | ||
->toBe('<a href="mailto:[email protected]">[email protected]</a>'); | ||
}); | ||
|
||
it('gets strategies from config', function () { | ||
Config::set('muddle.strategy.text', Text\Entities::class); | ||
Config::set('muddle.strategy.link', Link\Entities::class); | ||
|
@@ -20,22 +13,22 @@ | |
->not->toBe('[email protected]') | ||
->and((new Text\Entities)->unmuddle($entitizedText)) | ||
->toBe('[email protected]') | ||
->and($entitizedLink = Muddle::link('[email protected]')) | ||
->not->toBe('<a href="mailto:[email protected]">[email protected]</a>') | ||
->and($entitizedLink = Muddle::link('[email protected]', 'email')) | ||
->not->toBe('<a href="mailto:[email protected]">email</a>') | ||
->and(html_entity_decode($entitizedLink)) | ||
->toBe('<a href="mailto:[email protected]">[email protected]</a>'); | ||
->toBe('<a href="mailto:[email protected]">email</a>'); | ||
}); | ||
|
||
it('can change strategies on the fly', function () { | ||
$entitizedText = Muddle::strategy(text: new Text\Entities)->text('[email protected]'); | ||
$entitizedLink = Muddle::strategy(link: new Link\Entities)->link('[email protected]'); | ||
$entitizedLink = Muddle::strategy(link: new Link\Entities)->link('[email protected]', 'email'); | ||
|
||
expect($entitizedText) | ||
->not->toBe('[email protected]') | ||
->and((new Text\Entities)->unmuddle($entitizedText)) | ||
->toBe('[email protected]') | ||
->and($entitizedLink) | ||
->not->toBe('<a href="mailto:[email protected]">[email protected]</a>') | ||
->not->toBe('<a href="mailto:[email protected]">email</a>') | ||
->and(html_entity_decode($entitizedLink)) | ||
->toBe('<a href="mailto:[email protected]">[email protected]</a>'); | ||
->toBe('<a href="mailto:[email protected]">email</a>'); | ||
}); |
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 |
---|---|---|
|
@@ -12,6 +12,6 @@ | |
|
||
expect($muddle->text('[email protected]')) | ||
->toBe('[email protected]') | ||
->and($muddle->link('[email protected]')) | ||
->toBe('<a href="mailto:[email protected]">[email protected]</a>'); | ||
->and($muddle->link('[email protected]', 'email')) | ||
->toBe('<a href="mailto:[email protected]">email</a>'); | ||
}); |