mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Refactor PHPUnit bootstrap
This allows Parsedown extensions (like Parsedown Extra) to reuse existing Parsedown tests. See erusev/parsedown-extra#96 for details.
This commit is contained in:
parent
228d5f4754
commit
33a23fbfb2
@ -13,8 +13,6 @@ class CommonMarkTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
require_once(__DIR__ . '/TestParsedown.php');
|
||||
|
||||
$this->parsedown = new TestParsedown();
|
||||
$this->parsedown->setUrlsLinked(false);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class ParsedownTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function initParsedown()
|
||||
{
|
||||
$Parsedown = new Parsedown();
|
||||
$Parsedown = new TestParsedown();
|
||||
|
||||
return $Parsedown;
|
||||
}
|
||||
@ -132,15 +132,14 @@ color: red;
|
||||
<p>comment</p>
|
||||
<p><!-- html comment --></p>
|
||||
EXPECTED_HTML;
|
||||
$parsedownWithNoMarkup = new Parsedown();
|
||||
|
||||
$parsedownWithNoMarkup = new TestParsedown();
|
||||
$parsedownWithNoMarkup->setMarkupEscaped(true);
|
||||
$this->assertEquals($expectedHtml, $parsedownWithNoMarkup->text($markdownWithHtml));
|
||||
}
|
||||
|
||||
public function testLateStaticBinding()
|
||||
{
|
||||
include 'test/TestParsedown.php';
|
||||
|
||||
$parsedown = Parsedown::instance();
|
||||
$this->assertInstanceOf('Parsedown', $parsedown);
|
||||
|
||||
|
@ -1,3 +1,17 @@
|
||||
<?php
|
||||
|
||||
include 'Parsedown.php';
|
||||
// prepare composer autoloader
|
||||
if (is_file(__DIR__ . '/../vendor/autoload.php')) {
|
||||
// composer root package
|
||||
require_once(__DIR__ . '/../vendor/autoload.php');
|
||||
} elseif (is_file(__DIR__ . '/../../../../vendor/autoload.php')) {
|
||||
// composer dependency package
|
||||
require_once(__DIR__ . '/../../../../vendor/autoload.php');
|
||||
} else {
|
||||
die("Cannot find `vendor/autoload.php`. Run `composer install`.");
|
||||
}
|
||||
|
||||
// load TestParsedown class
|
||||
if (!class_exists('TestParsedown', false) && is_file('test/TestParsedown.php')) {
|
||||
require_once('test/TestParsedown.php');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user