add more unit tests and normalize the "__toString" methods v2

This commit is contained in:
Lars Moelleken
2020-09-03 02:06:24 +02:00
parent 7b7c22ddc3
commit 4e6d7ecd03
3 changed files with 65 additions and 8 deletions
+46
View File
@@ -93,6 +93,52 @@ class ExampleTest extends TestCase
$this->assertEquals(5, $tag->getLineCount());
}
/**
* @covers ::create
* @covers ::__toString
*/
public function testStringRepresentationIsReturned() : void
{
$tag = Example::create('"example1.php" 10 5 test text');
$this->assertSame('"example1.php" 10 5 test text', (string) $tag);
// ---
$tag = Example::create('file://example1.php');
$this->assertSame('file://example1.php', (string) $tag);
// ---
$tag = Example::create('0 foo bar');
$this->assertSame('0 foo bar', (string) $tag);
// ---
$tag = Example::create('$redisCluster->pttl(\'key\');');
$this->assertSame('$redisCluster->pttl(\'key\');', (string) $tag);
// ---
$tag = Example::create(' "example1.php" 10 5 test text ');
$this->assertSame('"example1.php" 10 5 test text', (string) $tag);
}
/**
* @covers ::create
* @covers ::__toString
*/
public function testStringRepresentationIsReturnedWithoutDescription() : void
{
$tag = Example::create('');
$this->assertSame('', (string) $tag);
}
/**
* @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag
*