diff --git a/Jyxo/Beholder/Output/TextOutput.php b/Jyxo/Beholder/Output/TextOutput.php index 2342fda..4ecde5c 100644 --- a/Jyxo/Beholder/Output/TextOutput.php +++ b/Jyxo/Beholder/Output/TextOutput.php @@ -47,7 +47,7 @@ public function __toString(): string $return .= sprintf("%-9s %10s %-10s %-7s %-35s %s\n", 'Run Order', 'Duration', 'Ident', 'Status', 'Test Name', 'Description'); - foreach ($this->testsData as $data) { + foreach ($this->result->getTestsData() as $data) { $return .= sprintf("%9d %9.2fs %-10s %-7s %-35s %s\n", $data['order'], $data['duration'], diff --git a/Jyxo/Html.php b/Jyxo/Html.php index 8c41e41..7b622cd 100644 --- a/Jyxo/Html.php +++ b/Jyxo/Html.php @@ -80,6 +80,11 @@ public static function repair(string $html): string // 'drop-proprietary-attributes' => true, // Removes proprietary attributes (it would remove e.g. the background attribute) // 'drop-font-tags' => true // Removes and
tags ]; + + if (!function_exists('\tidy_repair_string')) { + throw new \Jyxo\Exception('Missing "tidy" extension.'); + } + $html = tidy_repair_string($html, $config, 'utf8'); // Removes namespace generated by MS Word diff --git a/composer.json b/composer.json index b87c234..a81f41f 100644 --- a/composer.json +++ b/composer.json @@ -21,11 +21,15 @@ "ext-curl": "To use Jyxo\\Rpc client/server or Jyxo\\Webdav client", "ext-json": "To use Jyxo\\Rpc\\Json client/server or Jyxo\\FirePHP logger", "ext-xmlrpc": "To use Jyxo\\Rpc\\Xml client/server", - "ext-imap": "To use Jyxo\\Mail\\Parser" + "ext-imap": "To use Jyxo\\Mail\\Parser", + "ext-tidy": "To use Jyxo\\Html extended capabilities" }, "autoload": { "psr-4": { "Jyxo\\": ["Jyxo/"] } }, + "autoload-dev": { + "psr-4": { "Jyxo\\": ["tests/Jyxo"] } + }, "config": { "bin-dir": "bin", "optimize-autoloader": true, diff --git a/tests/Jyxo/Beholder/TestCase/MemcachedTest.php b/tests/Jyxo/Beholder/TestCase/MemcachedTest.php index 78296cc..b7cedd7 100644 --- a/tests/Jyxo/Beholder/TestCase/MemcachedTest.php +++ b/tests/Jyxo/Beholder/TestCase/MemcachedTest.php @@ -41,7 +41,7 @@ public function testConnectionFailure() } $ip = '127.0.0.1'; - $port = '12345'; + $port = 12345; $test = new Memcached('Memcached', $ip, $port); // @ on purpose diff --git a/tests/Jyxo/HtmlTest.php b/tests/Jyxo/HtmlTest.php index 5245552..c678a58 100644 --- a/tests/Jyxo/HtmlTest.php +++ b/tests/Jyxo/HtmlTest.php @@ -71,6 +71,10 @@ public function testIs() */ public function testRepair() { + if (!function_exists('\tidy_repair_string')) { + $this->markTestSkipped('Skipping, missing "tidy" extension.'); + } + $this->assertStringEqualsFile( $this->filePath . '/repair-expected.html', Html::repair(file_get_contents($this->filePath . '/repair.html')) diff --git a/tests/Jyxo/Time/TimeTest.php b/tests/Jyxo/Time/TimeTest.php index 5a91a1f..6129f78 100644 --- a/tests/Jyxo/Time/TimeTest.php +++ b/tests/Jyxo/Time/TimeTest.php @@ -176,7 +176,7 @@ public function testMagicGet() $this->assertEquals('2009-10-10T00:00:00+0700', $time->sql); $this->assertEquals('Sat, 10 Oct 09 00:00:00 +0700', $time->email); $this->assertEquals('2009-10-10T00:00:00+07:00', $time->web); - $this->assertEquals('Saturday, 10-Oct-2009 00:00:00 GMT-7', $time->cookie); + $this->assertEquals('Saturday, 10-Oct-2009 00:00:00 +07', $time->cookie); $this->assertEquals('Sat, 10 Oct 2009 00:00:00 +0700', $time->rss); $this->assertEquals('1255107600', $time->unix); $this->assertEquals('Fri, 09 Oct 2009 17:00:00 GMT', $time->http); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 68255a9..4c9fc18 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -14,20 +14,7 @@ // Because of SessionTest session_start(); -// Autoload -spl_autoload_register(function($className) { - if (strpos($className, 'Jyxo') !== 0) { - return; - } - - $file = str_replace('\\', '/', $className) . '.php'; - foreach ([realpath(__DIR__ . '/..'), __DIR__] as $dir) { - $filePath = $dir . '/' . $file; - if (false !== stream_resolve_include_path($filePath)) { - require_once $filePath; - } - } -}); +require __DIR__ . '/../vendor/autoload.php'; // File path define('DIR_FILES', __DIR__ . '/files');