From 85dd9fd9659798019e381070aa614e9b6d61e392 Mon Sep 17 00:00:00 2001
From: Emanuil <4thmail@gmail.com>
Date: Sun, 21 Jul 2013 23:14:30 +0300
Subject: [PATCH] migrate tests to phpunit
---
phpunit.xml.dist | 8 +++
tests/.htaccess | 7 ---
tests/Test.php | 47 ++++++++++++++++
tests/index.css | 51 ------------------
tests/index.php | 12 -----
tests/index_controller.php | 46 ----------------
tests/index_view.php | 54 -------------------
tests/reset.css | 108 -------------------------------------
tests/test.css | 58 --------------------
tests/test_controller.php | 27 ----------
tests/test_view.php | 62 ---------------------
11 files changed, 55 insertions(+), 425 deletions(-)
create mode 100644 phpunit.xml.dist
delete mode 100644 tests/.htaccess
create mode 100644 tests/Test.php
delete mode 100644 tests/index.css
delete mode 100644 tests/index.php
delete mode 100644 tests/index_controller.php
delete mode 100644 tests/index_view.php
delete mode 100644 tests/reset.css
delete mode 100644 tests/test.css
delete mode 100644 tests/test_controller.php
delete mode 100644 tests/test_view.php
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 0000000..098c965
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,8 @@
+
+
+
+
+ tests/Test.php
+
+
+
\ No newline at end of file
diff --git a/tests/.htaccess b/tests/.htaccess
deleted file mode 100644
index 0b95e0f..0000000
--- a/tests/.htaccess
+++ /dev/null
@@ -1,7 +0,0 @@
-RewriteEngine on
-RewriteBase /
-
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
-
-RewriteRule ^(.*)$ tests/index.php?$1 [L]
\ No newline at end of file
diff --git a/tests/Test.php b/tests/Test.php
new file mode 100644
index 0000000..ff8a126
--- /dev/null
+++ b/tests/Test.php
@@ -0,0 +1,47 @@
+parse('sdf');
+
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function provider()
+ {
+ $provider = array();
+
+ $DirectoryIterator = new DirectoryIterator(__DIR__.'/'.self::provider_dir);
+
+ foreach ($DirectoryIterator as $Item)
+ {
+ if ($Item->isFile() and $Item->getExtension() === 'md')
+ {
+ $basename = $Item->getBasename('.md');
+
+ $markdown = file_get_contents(__DIR__.'/'.self::provider_dir.$basename.'.md');
+
+ if ( ! $markdown)
+ continue;
+
+ $expected_markup = file_get_contents(__DIR__.'/'.self::provider_dir.$basename.'.html');
+
+ $actual_markup = Parsedown::instance()->parse($markdown);
+
+ $provider []= array($expected_markup, $actual_markup);
+ }
+ }
+
+ return $provider;
+ }
+}
+
diff --git a/tests/index.css b/tests/index.css
deleted file mode 100644
index 849c5f9..0000000
--- a/tests/index.css
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-.page {
- margin: 0 auto;
- width: 640px;
-}
-
-.header {
- background: #555;
- color: #fff;
-}
-
-.odd {
- background: #fff;
-}
-
-.even {
- background: #eee;
-}
-
-div.fail {
- background: #f55;
-}
-
-div.pass {
- background: #595;
-}
-
-span.fail {
- color: #d55;
-}
-
-span.pass {
- color: #595;
-}
-
-/* ~ */
-
-p {
- margin: 10px 0;
-}
-
-th {
- font-weight: normal;
- text-align: left;
-}
-
-th, td {
- border-bottom: 1px solid #ddd;
- padding: 5px 10px;
-}
\ No newline at end of file
diff --git a/tests/index.php b/tests/index.php
deleted file mode 100644
index dc02dba..0000000
--- a/tests/index.php
+++ /dev/null
@@ -1,12 +0,0 @@
-isFile() and $Item->getBasename() != '.DS_Store')
- {
- if ($Item->getExtension() === 'md')
- {
- $basename = $Item->getBasename('.md');
-
- $markdown = file_get_contents($dir.$basename.'.md');
- $expected_markup = file_get_contents($dir.$basename.'.html');
-
- if ( ! $markdown)
- continue;
-
- $Parsedown = Parsedown::instance();
-
- $start = microtime(true);
-
- $actual_markup = $Parsedown->parse($markdown);
-
- $time = microtime(true) - $start;
- $time = $time * 1000; # ms?
- $time = round($time, 2);
-
- $result = $expected_markup === $actual_markup
- ? 'pass'
- : 'fail';
-
- $result === 'fail' and $failed_test_count ++;
-
- $Tests []= array(
- 'basename' => $basename,
- 'name' => str_replace('_', ' ', $basename),
- 'result' => $result,
- 'time' => $time,
- );
- }
- }
-}
-
diff --git a/tests/index_view.php b/tests/index_view.php
deleted file mode 100644
index ba97f2b..0000000
--- a/tests/index_view.php
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- Parsedown Test
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $Test): ?>
-
- = $Test['name'] ?> - = $Test['result'] ?> |
- = $Test['time'] ?> ms |
-
-
-
-
-
-
-
- = $failed_test_count ?> tests failed.
-
- All = count($Tests) ?> tests passed.
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/tests/reset.css b/tests/reset.css
deleted file mode 100644
index fc2625a..0000000
--- a/tests/reset.css
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- *
- *
- *
- */
-
-a {
- color: #159;
- outline: none;
- text-decoration: none;
-}
-
-a img {
- border: none;
-}
-
-abbr {
- border-bottom: 1px solid #ddd;
- cursor: help;
- padding: 2px 3px;
-}
-
-body {
- background: #ddd;
- color: #333;
- font-family: Verdana, Sans-serif;
- font-size: 14px;
- height: 100%;
- line-height: 20px;
- margin: 0;
- padding: 0;
-}
-
-blockquote {
- background: #eee;
- margin: 0 0 10px 0;
- padding: 10px 10px 1px 10px;
-}
-
-form {
- margin: 0;
- padding: 0;
-}
-
-h1, h2, h3, h4, h5, h6 {
- font-family: Georgia, "Times New Roman", Times, serif;
- font-weight: normal;
- letter-spacing: 1px;
- margin: 20px 0;
-}
-
-h1 {
- line-height: 30px;
-}
-
-html {
- height: 100%;
- margin: 0;
- padding: 0;
- overflow-y: scroll;
-}
-
-img {
- outline: none;
-}
-
-input {
- font-family: Verdana, Sans-serif;
- font-size: 14px;
- line-height: 20px;
- margin: 0;
-}
-
-object {
- outline: none;
-}
-
-p {
- margin-top: 0;
- margin-bottom: 10px;
-}
-
-select {
- font-family: Verdana, Sans-serif;
- font-size: 14px;
- /* Makes for the same height as . */
- height: 40px;
- margin: 0;
-}
-
-table {
- border-spacing: 0;
-}
-
-textarea {
- background: #fff;
- font-family: Verdana, Sans-serif;
- font-size: 14px;
- line-height: 20px;
- margin: 0;
- padding: 9px;
- width: 280px;
-}
-
-ul {
- list-style-type: square;
-}
-
diff --git a/tests/test.css b/tests/test.css
deleted file mode 100644
index ac6aa02..0000000
--- a/tests/test.css
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *
- * ...
- *
- */
-
-tr.header td {
- background: #333;
- color: #fff;
- padding: 20px;
-}
-
-tr.header a {
- color: #fff;
- text-decoration: underline;
-}
-
-tr.body td {
- background: #fff;
- padding: 20px;
- width: 35%;
-}
-
-tr.footer td {
- background: #fff;
- border-top: 1px solid #999;
- padding: 10px 20px;
-}
-
-/* ~ */
-
-tr.fail td {
- background: #f55;
-}
-
-tr.pass td {
- background: #5d5;
-}
-
-/* ~ */
-
-code {
- font-family: Source Code Pro, Monaco, monospace;
-}
-
-pre {
- margin: 0;
- white-space: -moz-pre-wrap; /* Mozilla, supported since 1999 */
- white-space: -pre-wrap; /* Opera */
- white-space: -o-pre-wrap; /* Opera */
- white-space: pre-wrap; /* CSS3 - Text module (Candidate Recommendation) http://www.w3.org/TR/css3-text/#white-space */
- word-wrap: break-word; /* IE 5.5+ */
-}
-
-span.tag {
- color: #b19;
-}
-
diff --git a/tests/test_controller.php b/tests/test_controller.php
deleted file mode 100644
index cdd7521..0000000
--- a/tests/test_controller.php
+++ /dev/null
@@ -1,27 +0,0 @@
-parse($md);
-
-$result = $expected_mu === $actual_mu
- ? 'pass'
- : 'fail';
-
-$md = htmlentities($md, ENT_NOQUOTES);
-$expected_mu = htmlentities($expected_mu, ENT_NOQUOTES);
-$actual_mu = htmlentities($actual_mu, ENT_NOQUOTES);
-
-$name = str_replace('_', ' ', $test);
-$name = ucwords($name);
\ No newline at end of file
diff --git a/tests/test_view.php b/tests/test_view.php
deleted file mode 100644
index 068c843..0000000
--- a/tests/test_view.php
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- = $name ?> « Parsedown Test
-
-
-
-
-
-
-
- |
-
-
-
-
- = $md ?>
- |
- = $expected_mu ?>
|
- = $actual_mu ?>
|
-
-
-
-
-
-
-
-
-
\ No newline at end of file