Added tests for BlogListGenerator
This commit is contained in:
parent
00d3149360
commit
b775ab99eb
1 changed files with 23 additions and 3 deletions
|
@ -1,12 +1,22 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'PHPUnit/Autoload.php';
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
require_once 'res/php/BlogListGenerator.php';
|
require 'res/php/BlogListGenerator.php';
|
||||||
use mmk2410\rbe\BlogListGenerator\BlogListGenerator as BlogListGenerator;
|
use mmk2410\rbe\BlogListGenerator\BlogListGenerator as BlogListGenerator;
|
||||||
|
|
||||||
class BlogListGeneratorTest extends \PHPUnit_Framework_TestCase
|
class BlogListGeneratorTest extends TestCase
|
||||||
{
|
{
|
||||||
|
public function testListBlog()
|
||||||
|
{
|
||||||
|
$this->assertEquals("<a class='nav-item' href='./?blog=example'>Example</a>",
|
||||||
|
BlogListGenerator::listBlog("./blogs/", "example.md", "Example Blog")
|
||||||
|
);
|
||||||
|
$this->assertEquals("<a class='nav-item' href='https://mmk2410.org/rangitaki/docs/'>Docs</a>",
|
||||||
|
BlogListGenerator::listBlog("./blogs/", "external.md", "Example Blog")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testGetName()
|
public function testGetName()
|
||||||
{
|
{
|
||||||
$this->assertEquals("Example", BlogListGenerator::getName("blogs/example.md"));
|
$this->assertEquals("Example", BlogListGenerator::getName("blogs/example.md"));
|
||||||
|
@ -16,4 +26,14 @@ class BlogListGeneratorTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$this->assertEquals(5, BlogListGenerator::getArticleAmount("example"));
|
$this->assertEquals(5, BlogListGenerator::getArticleAmount("example"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGetExternaleLink()
|
||||||
|
{
|
||||||
|
$this->assertEquals(null,
|
||||||
|
BlogListGenerator::getExternalLink("example.md", '.')
|
||||||
|
);
|
||||||
|
$this->assertEquals("https://mmk2410.org/rangitaki/docs/",
|
||||||
|
BlogListGenerator::getExternalLink("external.md", '.')
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue