diff --git a/.travis.yml b/.travis.yml
index 7a8ba35..f2f310e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,4 +25,4 @@ install:
script:
- vendor/bin/phpunit
- vendor/bin/phpunit test/CommonMarkTestWeak.php || true
- - '[ -z "$TRAVIS_TAG" ] || [ "$TRAVIS_TAG" == "$(php -r "require(\"Parsedown.php\"); echo Parsedown::version;")" ]'
+ - '[ -z "$TRAVIS_TAG" ] || [ "$TRAVIS_TAG" == "$(php -r "require(\"vendor/autoload.php\"); echo Erusev\Parsedown\Parsedown::version;")" ]'
diff --git a/composer.json b/composer.json
index f8b40f8..301a6f6 100644
--- a/composer.json
+++ b/composer.json
@@ -20,14 +20,9 @@
"phpunit/phpunit": "^4.8.35"
},
"autoload": {
- "psr-0": {"Parsedown": ""}
+ "psr-4": {"Erusev\\Parsedown\\": "src/"}
},
"autoload-dev": {
- "psr-0": {
- "TestParsedown": "test/",
- "ParsedownTest": "test/",
- "CommonMarkTest": "test/",
- "CommonMarkTestWeak": "test/"
- }
+ "psr-4": {"Erusev\\Parsedown\\Tests\\": "tests/"}
}
}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 4fe3177..6b39037 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -2,7 +2,7 @@
foobar
';
$expectedSafeMarkup = '
<p>foobar</p>
';
- $unsafeExtension = new UnsafeExtension;
+ $unsafeExtension = new SampleExtensions\UnsafeExtension;
$actualMarkup = $unsafeExtension->text($markdown);
$this->assertEquals($expectedMarkup, $actualMarkup);
@@ -81,7 +84,7 @@ class ParsedownTest extends TestCase
$expectedMarkup = 'foobar
';
$expectedSafeMarkup = $expectedMarkup;
- $unsafeExtension = new TrustDelegatedExtension;
+ $unsafeExtension = new SampleExtensions\TrustDelegatedExtension;
$actualMarkup = $unsafeExtension->text($markdown);
$this->assertEquals($expectedMarkup, $actualMarkup);
@@ -98,7 +101,7 @@ class ParsedownTest extends TestCase
foreach ($this->dirs as $dir)
{
- $Folder = new DirectoryIterator($dir);
+ $Folder = new \DirectoryIterator($dir);
foreach ($Folder as $File)
{
@@ -182,16 +185,16 @@ EXPECTED_HTML;
public function testLateStaticBinding()
{
$parsedown = Parsedown::instance();
- $this->assertInstanceOf('Parsedown', $parsedown);
+ $this->assertInstanceOf(Parsedown::class, $parsedown);
// After instance is already called on Parsedown
// subsequent calls with the same arguments return the same instance
$sameParsedown = TestParsedown::instance();
- $this->assertInstanceOf('Parsedown', $sameParsedown);
+ $this->assertInstanceOf(Parsedown::class, $sameParsedown);
$this->assertSame($parsedown, $sameParsedown);
$testParsedown = TestParsedown::instance('test late static binding');
- $this->assertInstanceOf('TestParsedown', $testParsedown);
+ $this->assertInstanceOf(TestParsedown::class, $testParsedown);
$sameInstanceAgain = TestParsedown::instance('test late static binding');
$this->assertSame($testParsedown, $sameInstanceAgain);
diff --git a/test/SampleExtensions.php b/tests/SampleExtensions/TrustDelegatedExtension.php
similarity index 50%
rename from test/SampleExtensions.php
rename to tests/SampleExtensions/TrustDelegatedExtension.php
index e855c71..04cfee8 100644
--- a/test/SampleExtensions.php
+++ b/tests/SampleExtensions/TrustDelegatedExtension.php
@@ -1,25 +1,12 @@
$text";
+namespace Erusev\Parsedown\Tests\SampleExtensions;
- return $Block;
- }
-}
+use Erusev\Parsedown\Tests\TestParsedown;
-
-class TrustDelegatedExtension extends Parsedown
+class TrustDelegatedExtension extends TestParsedown
{
protected function blockFencedCodeComplete($Block)
{
diff --git a/tests/SampleExtensions/UnsafeExtension.php b/tests/SampleExtensions/UnsafeExtension.php
new file mode 100644
index 0000000..91c03d1
--- /dev/null
+++ b/tests/SampleExtensions/UnsafeExtension.php
@@ -0,0 +1,25 @@
+$text";
+
+ return $Block;
+ }
+}
diff --git a/test/TestParsedown.php b/tests/TestParsedown.php
similarity index 60%
rename from test/TestParsedown.php
rename to tests/TestParsedown.php
index 2faa0ab..a6267ed 100644
--- a/test/TestParsedown.php
+++ b/tests/TestParsedown.php
@@ -1,5 +1,11 @@