mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Expand public API of Components
Ref: https://github.com/erusev/parsedown/issues/694
This commit is contained in:
24
tests/src/Components/Blocks/BlockQuoteTest.php
Normal file
24
tests/src/Components/Blocks/BlockQuoteTest.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Blocks;
|
||||
|
||||
use Erusev\Parsedown\Components\Blocks\BlockQuote;
|
||||
use Erusev\Parsedown\Parsing\Context;
|
||||
use Erusev\Parsedown\Parsing\Line;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class BlockQuoteTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testBlockQuoteAPI()
|
||||
{
|
||||
$BlockQuote = BlockQuote::build(new Context(new Line('> foo'), ''), new State);
|
||||
|
||||
$this->assertSame('foo', $BlockQuote->contents(new State)[0][0]->text());
|
||||
}
|
||||
}
|
27
tests/src/Components/Blocks/FencedCodeTest.php
Normal file
27
tests/src/Components/Blocks/FencedCodeTest.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Blocks;
|
||||
|
||||
use Erusev\Parsedown\Components\Blocks\FencedCode;
|
||||
use Erusev\Parsedown\Parsing\Context;
|
||||
use Erusev\Parsedown\Parsing\Line;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class FencedCodeTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testFencedCodeAPI()
|
||||
{
|
||||
$FencedCode = FencedCode::build(new Context(new Line('```foo'), ''), new State);
|
||||
$FencedCode = $FencedCode->advance(new Context(new Line('bar'), ''), new State);
|
||||
$FencedCode = $FencedCode->advance(new Context(new Line('```'), ''), new State);
|
||||
|
||||
$this->assertSame('foo', $FencedCode->infostring());
|
||||
$this->assertSame("bar\n", $FencedCode->code());
|
||||
}
|
||||
}
|
25
tests/src/Components/Blocks/HeaderTest.php
Normal file
25
tests/src/Components/Blocks/HeaderTest.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Blocks;
|
||||
|
||||
use Erusev\Parsedown\Components\Blocks\Header;
|
||||
use Erusev\Parsedown\Parsing\Context;
|
||||
use Erusev\Parsedown\Parsing\Line;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class HeaderTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testHeaderAPI()
|
||||
{
|
||||
$Header = Header::build(new Context(new Line('## foo'), ''), new State);
|
||||
|
||||
$this->assertSame('foo', $Header->text());
|
||||
$this->assertSame(2, $Header->level());
|
||||
}
|
||||
}
|
24
tests/src/Components/Blocks/IndentedCodeTest.php
Normal file
24
tests/src/Components/Blocks/IndentedCodeTest.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Blocks;
|
||||
|
||||
use Erusev\Parsedown\Components\Blocks\IndentedCode;
|
||||
use Erusev\Parsedown\Parsing\Context;
|
||||
use Erusev\Parsedown\Parsing\Line;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class IndentedCodeTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testIndentedCodeAPI()
|
||||
{
|
||||
$IndentedCode = IndentedCode::build(new Context(new Line(' foo'), ''), new State);
|
||||
|
||||
$this->assertSame("foo\n", $IndentedCode->code());
|
||||
}
|
||||
}
|
24
tests/src/Components/Blocks/MarkupTest.php
Normal file
24
tests/src/Components/Blocks/MarkupTest.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Blocks;
|
||||
|
||||
use Erusev\Parsedown\Components\Blocks\Markup;
|
||||
use Erusev\Parsedown\Parsing\Context;
|
||||
use Erusev\Parsedown\Parsing\Line;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class MarkupTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testMarkupAPI()
|
||||
{
|
||||
$Markup = Markup::build(new Context(new Line('<pre>'), ''), new State);
|
||||
|
||||
$this->assertSame('<pre>', $Markup->html());
|
||||
}
|
||||
}
|
24
tests/src/Components/Blocks/ParagraphTest.php
Normal file
24
tests/src/Components/Blocks/ParagraphTest.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Blocks;
|
||||
|
||||
use Erusev\Parsedown\Components\Blocks\Paragraph;
|
||||
use Erusev\Parsedown\Parsing\Context;
|
||||
use Erusev\Parsedown\Parsing\Line;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class ParagraphTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testParagraphAPI()
|
||||
{
|
||||
$Paragraph = Paragraph::build(new Context(new Line('foo'), ''), new State);
|
||||
|
||||
$this->assertSame('foo', $Paragraph->text());
|
||||
}
|
||||
}
|
27
tests/src/Components/Blocks/SetextHeaderTest.php
Normal file
27
tests/src/Components/Blocks/SetextHeaderTest.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Blocks;
|
||||
|
||||
use Erusev\Parsedown\Components\Blocks\Paragraph;
|
||||
use Erusev\Parsedown\Components\Blocks\SetextHeader;
|
||||
use Erusev\Parsedown\Parsing\Context;
|
||||
use Erusev\Parsedown\Parsing\Line;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class SetextHeaderTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testSetextHeaderAPI()
|
||||
{
|
||||
$Paragraph = Paragraph::build(new Context(new Line('foo'), ''), new State);
|
||||
$SetextHeader = SetextHeader::build(new Context(new Line('==='), ''), new State, $Paragraph);
|
||||
|
||||
$this->assertSame('foo', $SetextHeader->text());
|
||||
$this->assertSame(1, $SetextHeader->level());
|
||||
}
|
||||
}
|
32
tests/src/Components/Blocks/TListTest.php
Normal file
32
tests/src/Components/Blocks/TListTest.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Blocks;
|
||||
|
||||
use Erusev\Parsedown\Components\Blocks\TList;
|
||||
use Erusev\Parsedown\Parsing\Context;
|
||||
use Erusev\Parsedown\Parsing\Line;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class TListTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testTListAPI()
|
||||
{
|
||||
$List = TList::build(new Context(new Line('* foo'), ''), new State);
|
||||
|
||||
$this->assertSame('foo', $List->items(new State)[0][0][0]->text());
|
||||
$this->assertSame('ul', $List->type());
|
||||
$this->assertSame(null, $List->listStart());
|
||||
|
||||
$List = TList::build(new Context(new Line('00100. foo'), ''), new State);
|
||||
|
||||
$this->assertSame('foo', $List->items(new State)[0][0][0]->text());
|
||||
$this->assertSame('ol', $List->type());
|
||||
$this->assertSame(100, $List->listStart());
|
||||
}
|
||||
}
|
34
tests/src/Components/Blocks/TableTest.php
Normal file
34
tests/src/Components/Blocks/TableTest.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Blocks;
|
||||
|
||||
use Erusev\Parsedown\Components\Blocks\Paragraph;
|
||||
use Erusev\Parsedown\Components\Blocks\Table;
|
||||
use Erusev\Parsedown\Parsing\Context;
|
||||
use Erusev\Parsedown\Parsing\Line;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class TableTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testTableAPI()
|
||||
{
|
||||
$Paragraph = Paragraph::build(new Context(new Line('foo | bar'), ''), new State);
|
||||
$Table = Table::build(new Context(new Line('--- | :---'), ''), new State, $Paragraph);
|
||||
$Table = $Table->advance(new Context(new Line('baz | boo'), ''), new State);
|
||||
|
||||
$this->assertSame('foo', $Table->headerRow(new State)[0][0]->text());
|
||||
$this->assertSame('bar', $Table->headerRow(new State)[1][0]->text());
|
||||
|
||||
$this->assertSame('baz', $Table->rows(new State)[0][0][0]->text());
|
||||
$this->assertSame('boo', $Table->rows(new State)[0][1][0]->text());
|
||||
|
||||
$this->assertSame(null, $Table->alignments()[0]);
|
||||
$this->assertSame('left', $Table->alignments()[1]);
|
||||
}
|
||||
}
|
23
tests/src/Components/Inlines/CodeTest.php
Normal file
23
tests/src/Components/Inlines/CodeTest.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Inlines;
|
||||
|
||||
use Erusev\Parsedown\Components\Inlines\Code;
|
||||
use Erusev\Parsedown\Parsing\Excerpt;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class CodeTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testCodeAPI()
|
||||
{
|
||||
$Code = Code::build(new Excerpt('`foo`', 0), new State);
|
||||
|
||||
$this->assertSame('foo', $Code->text());
|
||||
}
|
||||
}
|
29
tests/src/Components/Inlines/EmailTest.php
Normal file
29
tests/src/Components/Inlines/EmailTest.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Inlines;
|
||||
|
||||
use Erusev\Parsedown\Components\Inlines\Email;
|
||||
use Erusev\Parsedown\Parsing\Excerpt;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class EmailTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testEmailAPI()
|
||||
{
|
||||
$Email = Email::build(new Excerpt('<foo@bar.com>', 0), new State);
|
||||
|
||||
$this->assertSame('foo@bar.com', $Email->text());
|
||||
$this->assertSame('mailto:foo@bar.com', $Email->url());
|
||||
|
||||
$Email = Email::build(new Excerpt('<mailto:foo@bar.com>', 0), new State);
|
||||
|
||||
$this->assertSame('mailto:foo@bar.com', $Email->text());
|
||||
$this->assertSame('mailto:foo@bar.com', $Email->url());
|
||||
}
|
||||
}
|
27
tests/src/Components/Inlines/EmphasisTest.php
Normal file
27
tests/src/Components/Inlines/EmphasisTest.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Inlines;
|
||||
|
||||
use Erusev\Parsedown\Components\Inlines\Emphasis;
|
||||
use Erusev\Parsedown\Parsing\Excerpt;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class EmphasisTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testEmphasisAPI()
|
||||
{
|
||||
$Emphasis = Emphasis::build(new Excerpt('*foo*', 0), new State);
|
||||
|
||||
$this->assertSame('foo', $Emphasis->text());
|
||||
|
||||
$Emphasis = Emphasis::build(new Excerpt('**foo**', 0), new State);
|
||||
|
||||
$this->assertSame('foo', $Emphasis->text());
|
||||
}
|
||||
}
|
23
tests/src/Components/Inlines/EscapeSequenceTest.php
Normal file
23
tests/src/Components/Inlines/EscapeSequenceTest.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Inlines;
|
||||
|
||||
use Erusev\Parsedown\Components\Inlines\EscapeSequence;
|
||||
use Erusev\Parsedown\Parsing\Excerpt;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class EscapeSequenceTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testEscapeSequenceAPI()
|
||||
{
|
||||
$EscapeSequence = EscapeSequence::build(new Excerpt('\`', 0), new State);
|
||||
|
||||
$this->assertSame('`', $EscapeSequence->char());
|
||||
}
|
||||
}
|
31
tests/src/Components/Inlines/ImageTest.php
Normal file
31
tests/src/Components/Inlines/ImageTest.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Inlines;
|
||||
|
||||
use Erusev\Parsedown\Components\Inlines\Image;
|
||||
use Erusev\Parsedown\Parsing\Excerpt;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class ImageTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testImageAPI()
|
||||
{
|
||||
$Image = Image::build(new Excerpt('', 0), new State);
|
||||
|
||||
$this->assertSame('foo', $Image->label());
|
||||
$this->assertSame('https://example.com', $Image->url());
|
||||
$this->assertSame(null, $Image->title());
|
||||
|
||||
$Image = Image::build(new Excerpt('', 0), new State);
|
||||
|
||||
$this->assertSame('foo', $Image->label());
|
||||
$this->assertSame('https://example.com', $Image->url());
|
||||
$this->assertSame("bar", $Image->title());
|
||||
}
|
||||
}
|
31
tests/src/Components/Inlines/LinkTest.php
Normal file
31
tests/src/Components/Inlines/LinkTest.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Inlines;
|
||||
|
||||
use Erusev\Parsedown\Components\Inlines\Link;
|
||||
use Erusev\Parsedown\Parsing\Excerpt;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class LinkTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testLinkAPI()
|
||||
{
|
||||
$Link = Link::build(new Excerpt('[foo](https://example.com)', 0), new State);
|
||||
|
||||
$this->assertSame('foo', $Link->label());
|
||||
$this->assertSame('https://example.com', $Link->url());
|
||||
$this->assertSame(null, $Link->title());
|
||||
|
||||
$Link = Link::build(new Excerpt('[foo](https://example.com "bar")', 0), new State);
|
||||
|
||||
$this->assertSame('foo', $Link->label());
|
||||
$this->assertSame('https://example.com', $Link->url());
|
||||
$this->assertSame("bar", $Link->title());
|
||||
}
|
||||
}
|
23
tests/src/Components/Inlines/MarkupTest.php
Normal file
23
tests/src/Components/Inlines/MarkupTest.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Inlines;
|
||||
|
||||
use Erusev\Parsedown\Components\Inlines\Markup;
|
||||
use Erusev\Parsedown\Parsing\Excerpt;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class MarkupTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testMarkupAPI()
|
||||
{
|
||||
$Markup = Markup::build(new Excerpt('<foo>', 0), new State);
|
||||
|
||||
$this->assertSame('<foo>', $Markup->html());
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ namespace Erusev\Parsedown\Tests\Components\Inlines;
|
||||
|
||||
use Erusev\Parsedown\Components\Inlines\PlainText;
|
||||
use Erusev\Parsedown\Parsing\Excerpt;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class PlainTextTest extends TestCase
|
||||
@ -13,9 +14,9 @@ final class PlainTextTest extends TestCase
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testPlainTextText()
|
||||
public function testPlainTextAPI()
|
||||
{
|
||||
$Plaintext = Plaintext::build(new Excerpt('foo', 0));
|
||||
$Plaintext = Plaintext::build(new Excerpt('foo', 0), new State);
|
||||
|
||||
$this->assertSame('foo', $Plaintext->text());
|
||||
}
|
||||
|
27
tests/src/Components/Inlines/SpecialCharacterTest.php
Normal file
27
tests/src/Components/Inlines/SpecialCharacterTest.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Inlines;
|
||||
|
||||
use Erusev\Parsedown\Components\Inlines\SpecialCharacter;
|
||||
use Erusev\Parsedown\Parsing\Excerpt;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class SpecialCharacterTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testSpecialCharacterAPI()
|
||||
{
|
||||
$SpecialCharacter = SpecialCharacter::build(new Excerpt(' ', 0), new State);
|
||||
|
||||
$this->assertSame('nbsp', $SpecialCharacter->charCode());
|
||||
|
||||
$SpecialCharacter = SpecialCharacter::build(new Excerpt('C;', 0), new State);
|
||||
|
||||
$this->assertSame('#3C', $SpecialCharacter->charCode());
|
||||
}
|
||||
}
|
23
tests/src/Components/Inlines/StrikethroughTest.php
Normal file
23
tests/src/Components/Inlines/StrikethroughTest.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Inlines;
|
||||
|
||||
use Erusev\Parsedown\Components\Inlines\Strikethrough;
|
||||
use Erusev\Parsedown\Parsing\Excerpt;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class StrikethroughTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testStrikethroughAPI()
|
||||
{
|
||||
$Strikethrough = Strikethrough::build(new Excerpt('~~foo~~', 0), new State);
|
||||
|
||||
$this->assertSame('foo', $Strikethrough->text());
|
||||
}
|
||||
}
|
23
tests/src/Components/Inlines/UrlTagTest.php
Normal file
23
tests/src/Components/Inlines/UrlTagTest.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Inlines;
|
||||
|
||||
use Erusev\Parsedown\Components\Inlines\UrlTag;
|
||||
use Erusev\Parsedown\Parsing\Excerpt;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class UrlTagTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testUrlTagAPI()
|
||||
{
|
||||
$UrlTag = UrlTag::build(new Excerpt('<https://example.com>', 0), new State);
|
||||
|
||||
$this->assertSame('https://example.com', $UrlTag->url());
|
||||
}
|
||||
}
|
23
tests/src/Components/Inlines/UrlTest.php
Normal file
23
tests/src/Components/Inlines/UrlTest.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Erusev\Parsedown\Tests\Components\Inlines;
|
||||
|
||||
use Erusev\Parsedown\Components\Inlines\Url;
|
||||
use Erusev\Parsedown\Parsing\Excerpt;
|
||||
use Erusev\Parsedown\State;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class UrlTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @throws \PHPUnit\Framework\ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public function testUrlAPI()
|
||||
{
|
||||
$Url = Url::build(new Excerpt('https://example.com', 0), new State);
|
||||
|
||||
$this->assertSame('https://example.com', $Url->url());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user