added database driven system configurations with admin screen (#647)

This commit is contained in:
Kevin Papst
2019-03-22 20:58:38 +01:00
committed by GitHub
parent e990ae4800
commit 13d9f8f3f7
142 changed files with 2262 additions and 64727 deletions

View File

@@ -9,6 +9,8 @@
namespace App\Tests\Twig;
use App\Configuration\ConfigLoaderInterface;
use App\Configuration\TimesheetConfiguration;
use App\Twig\MarkdownExtension;
use App\Utils\Markdown;
use PHPUnit\Framework\TestCase;
@@ -20,7 +22,9 @@ class MarkdownExtensionTest extends TestCase
{
public function testGetFilters()
{
$sut = new MarkdownExtension(new Markdown());
$loader = $this->getMockBuilder(ConfigLoaderInterface::class)->getMock();
$config = new TimesheetConfiguration($loader, ['markdown_content' => true]);
$sut = new MarkdownExtension(new Markdown(), $config);
$filters = $sut->getFilters();
$this->assertCount(2, $filters);
$this->assertEquals('md2html', $filters[0]->getName());
@@ -29,14 +33,18 @@ class MarkdownExtensionTest extends TestCase
public function testMarkdownToHtml()
{
$sut = new MarkdownExtension(new Markdown());
$loader = $this->getMockBuilder(ConfigLoaderInterface::class)->getMock();
$config = new TimesheetConfiguration($loader, ['markdown_content' => true]);
$sut = new MarkdownExtension(new Markdown(), $config);
$this->assertEquals('<p><em>test</em></p>', $sut->markdownToHtml('*test*'));
$this->assertEquals('<h1 id="foobar">foobar</h1>', $sut->markdownToHtml('# foobar'));
}
public function testTimesheetContent()
{
$sut = new MarkdownExtension(new Markdown(), false);
$loader = $this->getMockBuilder(ConfigLoaderInterface::class)->getMock();
$config = new TimesheetConfiguration($loader, ['markdown_content' => false]);
$sut = new MarkdownExtension(new Markdown(), $config);
$this->assertEquals(
"- test<br />\n- foo",
$sut->timesheetContent("- test\n- foo")
@@ -44,7 +52,8 @@ class MarkdownExtensionTest extends TestCase
$this->assertEquals('', $sut->timesheetContent(null));
$this->assertEquals('', $sut->timesheetContent(''));
$sut = new MarkdownExtension(new Markdown(), true);
$config = new TimesheetConfiguration($loader, ['markdown_content' => true]);
$sut = new MarkdownExtension(new Markdown(), $config);
$this->assertEquals(
"<ul>\n<li>test</li>\n<li>foo</li>\n</ul>\n<p>foo <strong>bar</strong></p>",
$sut->timesheetContent("- test\n- foo\n\nfoo __bar__")