This repository has been archived on 2022-02-10. You can view files and clone it, but cannot push or open issues or pull requests.
rangitaki/tests/BlogListGeneratorTest.php

40 lines
1.2 KiB
PHP
Raw Normal View History

2016-06-04 09:59:11 +02:00
<?php
2016-12-30 00:05:40 +01:00
use PHPUnit\Framework\TestCase;
2016-12-29 21:54:37 +01:00
2016-12-30 00:05:40 +01:00
require 'res/php/BlogListGenerator.php';
2016-12-29 21:54:37 +01:00
use mmk2410\rbe\BlogListGenerator\BlogListGenerator as BlogListGenerator;
2016-06-04 09:59:11 +02:00
2016-12-30 00:05:40 +01:00
class BlogListGeneratorTest extends TestCase
2016-06-04 09:59:11 +02:00
{
2016-12-30 00:05:40 +01:00
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")
);
}
2016-06-04 09:59:11 +02:00
public function testGetName()
{
$this->assertEquals("Example", BlogListGenerator::getName("blogs/example.md"));
}
public function testGetArticleAmount()
{
$this->assertEquals(5, BlogListGenerator::getArticleAmount("example"));
}
2016-12-30 00:05:40 +01:00
public function testGetExternaleLink()
{
$this->assertEquals(null,
BlogListGenerator::getExternalLink("example.md", '.')
);
$this->assertEquals("https://mmk2410.org/rangitaki/docs/",
BlogListGenerator::getExternalLink("external.md", '.')
);
}
2016-06-04 09:59:11 +02:00
}