for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Lichtenwallner (https://lichtenwallner.at)
*
* @see https://github.com/jolicht/markdown-cms for the canonical source repository
* @license https://github.com/jolicht/markdown-cms/blob/master/LICENSE MIT
* @copyright Copyright (c) Johannes Lichtenwallner
*/
declare(strict_types = 1);
namespace JolichtTest\MarkdownCms\Parser\Observer;
use PHPUnit\Framework\TestCase;
use Jolicht\MarkdownCms\Parser\Observer\SaveContentConfigObserver;
use Zend\Config\Writer\PhpArray;
class SaveContentConfigObserverTest extends TestCase
{
private $observer, $configWriter;
Only declaring a single property per statement allows you to later on add doc comments more easily.
It is also recommended by PSR2, so it is a common style that many people expect.
protected function setUp()
$this->configWriter = new PhpArray();
$this->observer = new SaveContentConfigObserver($this->configWriter, __DIR__ . '/_files/markdown-cms.global.php');
}
public function testGetConfigWriter()
$this->assertSame($this->configWriter, $this->observer->getConfigWriter());
public function testGetTargetPath()
$this->assertSame(__DIR__ . '/_files/markdown-cms.global.php', $this->observer->getTargetPath());
public function testInvoke()
$targetPath =$this->observer->getTargetPath();
if (file_exists($targetPath)) {
unlink($targetPath);
$config = [
'markdown_cms' => [
'testKey' => 'testEntry'
]
];
$this->observer->__invoke($config);
$this->assertFileExists($targetPath);
$this->assertEquals($config, include $targetPath);
Only declaring a single property per statement allows you to later on add doc comments more easily.
It is also recommended by PSR2, so it is a common style that many people expect.