Skip to content

Commit

Permalink
Merge pull request #16 from pinkary-project/test/add-missing-br-provi…
Browse files Browse the repository at this point in the history
…der-tests

test: add missing `BrProviderParsable`  tests
  • Loading branch information
nunomaduro authored Mar 21, 2024
2 parents 584c0c4 + b6fb26f commit 512ff10
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
*/
public function parse(string $content): string
{
return (string) preg_replace('/\n/', '</br>', $content);
return (string) preg_replace('/\n/', '<br>', $content);
}
}
15 changes: 15 additions & 0 deletions tests/Unit/Services/ContentProvidersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

declare(strict_types=1);

test('brs', function (string $content, string $parsed) {
$provider = new App\Services\ParsableContentProviders\BrProviderParsable();

expect($provider->parse($content))->toBe($parsed);
})->with([
[
'content' => "Check this:\nHello, World!",
'parsed' => 'Check this:<br>Hello, World!',
],
[
'content' => "Check this:\n\nHello, World!\n",
'parsed' => 'Check this:<br><br>Hello, World!<br>',
],
]);

test('links', function (string $content, string $parsed) {
$provider = new App\Services\ParsableContentProviders\LinkProviderParsable();

Expand Down

0 comments on commit 512ff10

Please sign in to comment.