Skip to content

Commit

Permalink
Separate the test suites; tag legacy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
colinodell committed Jul 19, 2020
1 parent 6e0c814 commit 27ecf75
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 4 deletions.
7 changes: 5 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="league/commonmark Test Suite">
<directory>tests</directory>
<testsuite name="league/commonmark Functional Tests">
<directory>tests/functional</directory>
</testsuite>
<testsuite name="league/commonmark Unit Tests">
<directory>tests/unit</directory>
</testsuite>
</testsuites>
<filter>
Expand Down
1 change: 1 addition & 0 deletions src/Reference/Reference.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function getTitle(): string
* @return string
*
* @deprecated Use TextNormalizer::normalize() instead
* @group legacy
*/
public static function normalizeReference(string $string): string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public function dataProviderForTestHeadingPermalinksWithCustomOptions()
yield ["Test\n----", '<h2>Test<a id="custom-prefix-test" href="#test" name="test" class="custom-class" aria-hidden="true" title="Link">¶ 🦄️ &lt;3 You</a></h2>'];
}

/**
* @group legacy
*/
public function testHeadingPermalinksWithDeprecatedInnerContents()
{
$environment = Environment::createCommonMarkEnvironment();
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/ConverterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
use League\CommonMark\Converter;
use PHPUnit\Framework\TestCase;

/**
* @group legacy
*/
class ConverterTest extends TestCase
{
public function testInvokeReturnsSameOutputAsConvertToHtml()
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/Extension/Autolink/InlineMentionParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

/**
* @deprecated
*
* @group legacy
*/
final class InlineMentionParserTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

/**
* @deprecated
*
* @group legacy
*/
final class DefaultSlugGeneratorTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
use League\CommonMark\Extension\TableOfContents\TableOfContents as DeprecatedTableOfContents;
use PHPUnit\Framework\TestCase;

/**
* @group legacy
*/
final class TableOfContentsDeprecationTest extends TestCase
{
/**
Expand Down
37 changes: 35 additions & 2 deletions tests/unit/Util/ArrayCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public function testGetIterator()
$this->assertEquals($array, $iterator->getArrayCopy());
}

/**
* @group legacy
*/
public function testAdd()
{
$collection = new ArrayCollection();
Expand All @@ -64,6 +67,9 @@ public function testAdd()
$this->assertEquals(['foo', 'bar'], $collection->toArray());
}

/**
* @group legacy
*/
public function testSet()
{
$collection = new ArrayCollection(['foo']);
Expand All @@ -76,6 +82,9 @@ public function testSet()
$this->assertEquals(['foo', 'foo' => 2], $collection->toArray());
}

/**
* @group legacy
*/
public function testGet()
{
$collection = new ArrayCollection(['foo' => 1, 'bar']);
Expand All @@ -85,6 +94,9 @@ public function testGet()
$this->assertNull($collection->get('bar'));
}

/**
* @group legacy
*/
public function testRemove()
{
$collection = new ArrayCollection(['foo' => 1, 'bar', 'baz']);
Expand All @@ -106,6 +118,9 @@ public function testRemove()
$this->assertEquals([], $collection->toArray());
}

/**
* @group legacy
*/
public function testRemoveNulls()
{
$collection = new ArrayCollection(['foo' => null]);
Expand All @@ -119,6 +134,9 @@ public function testRemoveNulls()
$this->assertEquals([], $collection->toArray());
}

/**
* @group legacy
*/
public function testIsEmpty()
{
$collection = new ArrayCollection();
Expand All @@ -135,6 +153,9 @@ public function testIsEmpty()
$this->assertFalse($collection->isEmpty());
}

/**
* @group legacy
*/
public function testContains()
{
$object = new \stdClass();
Expand All @@ -155,6 +176,9 @@ public function testContains()
$this->assertFalse($collection->contains('FOO'));
}

/**
* @group legacy
*/
public function testIndexOf()
{
$object = new \stdClass();
Expand All @@ -175,6 +199,9 @@ public function testIndexOf()
$this->assertTrue(false === $collection->indexOf('FOO'));
}

/**
* @group legacy
*/
public function testContainsKey()
{
$collection = new ArrayCollection(['foo' => 1, 'bar']);
Expand All @@ -197,10 +224,10 @@ public function testCount()
$collection = new ArrayCollection(['foo']);
$this->assertEquals(1, $collection->count());

$collection->add('bar');
$collection[] = 'bar';
$this->assertEquals(2, $collection->count());

$collection->remove(0);
unset($collection[0]);
$this->assertEquals(1, $collection->count());
}

Expand Down Expand Up @@ -320,6 +347,9 @@ public function testToArray()
$this->assertEquals([2 => 1, 'foo'], $collection->toArray());
}

/**
* @group legacy
*/
public function testReplaceWith()
{
$collection = new ArrayCollection(['foo' => 1, 'bar']);
Expand All @@ -330,6 +360,9 @@ public function testReplaceWith()
$this->assertEquals(['baz', 42], $replaced->toArray());
}

/**
* @group legacy
*/
public function testRemoveGaps()
{
$collection = new ArrayCollection(['', true, false, null, [], 0, '0', 1]);
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/Util/Html5EntitiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use League\CommonMark\Util\Html5Entities;
use PHPUnit\Framework\TestCase;

/**
* @group legacy
*/
class Html5EntitiesTest extends TestCase
{
public function testEntityToChar()
Expand Down

0 comments on commit 27ecf75

Please sign in to comment.