Move test/CommonMarkTest.php to test/CommonMarkTestStrict.php

Add parameter `$id` to CommonMark tests
This commit is contained in:
Daniel Rudolf 2016-10-12 02:01:40 +02:00
parent be671e72a3
commit 2423644d72
No known key found for this signature in database
GPG Key ID: A061F02CD8DE4538
2 changed files with 9 additions and 5 deletions

View File

@ -5,7 +5,7 @@
*
* @link http://commonmark.org/ CommonMark
*/
class CommonMarkTest extends PHPUnit_Framework_TestCase
class CommonMarkTestStrict extends PHPUnit_Framework_TestCase
{
const SPEC_URL = 'https://raw.githubusercontent.com/jgm/stmd/master/spec.txt';
@ -19,11 +19,12 @@ class CommonMarkTest extends PHPUnit_Framework_TestCase
/**
* @dataProvider data
* @param $id
* @param $section
* @param $markdown
* @param $expectedHtml
*/
public function testExample($section, $markdown, $expectedHtml)
public function testExample($id, $section, $markdown, $expectedHtml)
{
$actualHtml = $this->parsedown->text($markdown);
$this->assertEquals($expectedHtml, $actualHtml);
@ -46,12 +47,14 @@ class CommonMarkTest extends PHPUnit_Framework_TestCase
preg_match_all('/^`{32} example\n((?s).*?)\n\.\n((?s).*?)\n`{32}$|^#{1,6} *(.*?)$/m', $spec, $matches, PREG_SET_ORDER);
$data = array();
$currentId = 0;
$currentSection = '';
foreach ($matches as $match) {
if (isset($match[3])) {
$currentSection = $match[3];
} else {
$data[] = array(
'id' => ++$currentId,
'section' => $currentSection,
'markdown' => str_replace('→', "\t", $match[1]),
'expectedHtml' => str_replace('→', "\t", $match[2])

View File

@ -1,5 +1,5 @@
<?php
require_once(__DIR__ . '/CommonMarkTest.php');
require_once(__DIR__ . '/CommonMarkTestStrict.php');
/**
* Test Parsedown against the CommonMark spec, but less aggressive
@ -13,7 +13,7 @@ require_once(__DIR__ . '/CommonMarkTest.php');
*
* @link http://commonmark.org/ CommonMark
*/
class CommonMarkTestWeak extends CommonMarkTest
class CommonMarkTestWeak extends CommonMarkTestStrict
{
protected $textLevelElementRegex;
@ -30,11 +30,12 @@ class CommonMarkTestWeak extends CommonMarkTest
/**
* @dataProvider data
* @param $id
* @param $section
* @param $markdown
* @param $expectedHtml
*/
public function testExample($section, $markdown, $expectedHtml)
public function testExample($id, $section, $markdown, $expectedHtml)
{
$expectedHtml = $this->cleanupHtml($expectedHtml);