diff --git a/phpunit.xml b/phpunit.xml
index 3aee423..a940f77 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -2,7 +2,11 @@
- ./tests
+ ./unit_tests/php
+
+
+
+
diff --git a/tests/EmailTest.php b/tests/EmailTest.php
deleted file mode 100644
index c872bc1..0000000
--- a/tests/EmailTest.php
+++ /dev/null
@@ -1,32 +0,0 @@
-assertEquals($result, $expected_result);
- }
-
-
-}
diff --git a/tests/FormatTest.php b/tests/FormatTest.php
deleted file mode 100644
index 3e96c32..0000000
--- a/tests/FormatTest.php
+++ /dev/null
@@ -1,28 +0,0 @@
-assertEquals($result, $expected_result);
- }
-
-}
diff --git a/tests/ParseMessageTest.php b/tests/ParseMessageTest.php
deleted file mode 100644
index 3d16e27..0000000
--- a/tests/ParseMessageTest.php
+++ /dev/null
@@ -1,39 +0,0 @@
-
=0D=0A"]],
- ["8.eml", 2, ["Hello,\n\nYou have received a newsletter from Chemol Travel.", ""]],
- ];
-
- }
-
-
- /**
- * @dataProvider providerTestParseMessage
- */
- public function test_parse_message($input, $expected_part_count, $expected_body) {
- $message = file_get_contents(dirname(dirname(__FILE__)) . "/test_files/" . $input);
- Piler_Mime_Decode::ParseMessage($message, $parts);
-
- $this->assertEquals(count($parts), $expected_part_count);
-
- for($i=0; $iassertEquals($expected_body[$i], substr($parts[$i]['body'], 0, strlen($expected_body[$i])));
- }
- }
-
-}
diff --git a/tests/SplitMessageTest.php b/tests/SplitMessageTest.php
deleted file mode 100644
index dc9d3dc..0000000
--- a/tests/SplitMessageTest.php
+++ /dev/null
@@ -1,81 +0,0 @@
- 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', CONTENT_TYPE => array('type' => TEXT_PLAIN)),
- THIS_IS_A_TEST],
-
- ["From: aaa\r\nTo:bbb\r\nCC ccc\r\nSubject: test\r\n\r\n" . THIS_IS_A_TEST,
- array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', CONTENT_TYPE => array('type' => TEXT_PLAIN)),
- THIS_IS_A_TEST],
-
- ["From: aaa\nTo:bbb\nSubject: test\n\n" . THIS_IS_A_TEST,
- array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', CONTENT_TYPE => array('type' => TEXT_PLAIN)),
- THIS_IS_A_TEST],
-
- ["From: aaa\r\nTo:bbb\r\nSubject: test\r\n\r\n\r\n\r\n" . THIS_IS_A_TEST . "\nAaa\n",
- array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', CONTENT_TYPE => array('type' => TEXT_PLAIN)),
- "\n\n" . THIS_IS_A_TEST . "\nAaa\n"],
-
- ["From: aaa\r\nTo:bbb\r\nSubject: test\r\nContent-type: text/html\r\n\r\n\r\n" . THIS_IS_A_TEST . "\nAaa\n",
- array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', CONTENT_TYPE => array('type' => 'text/html')),
- "\n" . THIS_IS_A_TEST . "\nAaa\n"],
-
- ["From: aaa\nTo:bbb\nSubject: test\nContent-Type: text/plain\n\n" . THIS_IS_A_TEST,
- array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', CONTENT_TYPE => array('type' => TEXT_PLAIN)),
- THIS_IS_A_TEST],
-
- ["From: aaa\nTo:bbb\nSubject: test\nDate: Sun, 17 Apr 2016 22:40:03 +0800\nDKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=chemoltravel.hu; s=ml;\n\tt=1471888357; bh=A/l/HLQe3HM4Xc4jFxAmhaWVCMU=;\n\th=Date:To:From:Subject:Sender:From:To:Subject:Date;\n\tb=JlEqXiAKBOoT/YyXKTMsXnEphh2J6sXxgNmbKbGybjo3cU1rgQEL0m1h26gl5AaBP\nContent-Type: " . TEXT_PLAIN . "\n\n" . THIS_IS_A_TEST,
- array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', SUBJECT => 'test', 'date' => 'Sun, 17 Apr 2016 22:40:03 +0800', 'dkim-signature' => 'v=1; a=rsa-sha1; c=relaxed/relaxed; d=chemoltravel.hu; s=ml; t=1471888357; bh=A/l/HLQe3HM4Xc4jFxAmhaWVCMU=; h=Date:To:From:Subject:Sender:From:To:Subject:Date; b=JlEqXiAKBOoT/YyXKTMsXnEphh2J6sXxgNmbKbGybjo3cU1rgQEL0m1h26gl5AaBP', CONTENT_TYPE => array('type' => TEXT_PLAIN)),
- THIS_IS_A_TEST],
-
- ["From: aaa\nTo:bbb\nSubject: test\nContent-Type: text/PLAIN\n\n" . THIS_IS_A_TEST,
- array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', CONTENT_TYPE => array('type' => TEXT_PLAIN)),
- THIS_IS_A_TEST],
-
- ["From: aaa\nTo:bbb\nSubject: test\nContent-Type: text/plain; charset=\"ISO-8859-1\"\n\n" . THIS_IS_A_TEST,
- array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', CONTENT_TYPE => array('type' => TEXT_PLAIN, 'charset' => 'ISO-8859-1')),
- THIS_IS_A_TEST],
-
- ["From: aaa\nTo:bbb\nSubject: test\nMIME-Version: 1.0\nContent-Type: multipart/alternative; boundary=\"_=_SWIFT_v4_1460476188_145aa333fc0127705a7e904aab6d1957_=_\"\n\n" . THIS_IS_A_TEST,
- array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', 'mime-version' => '1.0', CONTENT_TYPE => array('type' => 'multipart/alternative', 'boundary' => '_=_SWIFT_v4_1460476188_145aa333fc0127705a7e904aab6d1957_=_')),
- THIS_IS_A_TEST],
-
- ["From: aaa\nTo:bbb\nSubject: test\nMIME-Version: 1.0\nContent-Type: multipart/alternative;\n boundary=\"_=_SWIFT_v4_1460476188_145aa333fc0127705a7e904aab6d1957_=_\"\n\n" . THIS_IS_A_TEST,
- array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', 'mime-version' => '1.0', CONTENT_TYPE => array('type' => 'multipart/alternative', 'boundary' => '_=_SWIFT_v4_1460476188_145aa333fc0127705a7e904aab6d1957_=_')),
- THIS_IS_A_TEST],
-
- ["From: aaa\nTo:bbb\nSubject: test\nMIME-Version: 1.0\nContent-Type: multipart/related;\n\ttype=\"multipart/alternative\";\n\tboundary=\"----=_NextPart_000_0006_01D195BC.69E26510\"\n\n" . THIS_IS_A_TEST,
- array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', 'mime-version' => '1.0', CONTENT_TYPE => array('type' => 'multipart/alternative', 'boundary' => '----=_NextPart_000_0006_01D195BC.69E26510')),
- THIS_IS_A_TEST],
-
-
- ];
- }
-
-
- /**
- * @dataProvider providerTestSplitMessage
- */
- public function test_split_message($input, $expected_headers, $expected_body) {
- Piler_Mime_Decode::splitMessage($input, $headers, $body);
-
- $this->assertEquals($headers, $expected_headers);
- $this->assertEquals($body, $expected_body);
- }
-
-
-}
diff --git a/unit_tests/php/EmailTest.php b/unit_tests/php/EmailTest.php
new file mode 100644
index 0000000..7943b9b
--- /dev/null
+++ b/unit_tests/php/EmailTest.php
@@ -0,0 +1,34 @@
+assertEquals($result, $expected_result);
+ }
+
+
+}
diff --git a/unit_tests/php/FormatTest.php b/unit_tests/php/FormatTest.php
new file mode 100644
index 0000000..3e96c32
--- /dev/null
+++ b/unit_tests/php/FormatTest.php
@@ -0,0 +1,28 @@
+assertEquals($result, $expected_result);
+ }
+
+}
diff --git a/unit_tests/php/ParseMessageTest.php b/unit_tests/php/ParseMessageTest.php
new file mode 100644
index 0000000..a1e1051
--- /dev/null
+++ b/unit_tests/php/ParseMessageTest.php
@@ -0,0 +1,42 @@
+=0D=0A"]],
+ ["8.eml", 2, ["Hello,\n\nYou have received a newsletter from Chemol Travel.", ""]],
+ ];
+
+ }
+
+
+ /**
+ * @dataProvider providerTestParseMessage
+ */
+ public function test_parse_message($input, $expected_part_count, $expected_body) {
+ $message = file_get_contents(TEST_FILES_DIR . $input);
+ Piler_Mime_Decode::ParseMessage($message, $parts);
+
+ $this->assertEquals(count($parts), $expected_part_count);
+
+ for($i=0; $iassertEquals($expected_body[$i], substr($parts[$i]['body'], 0, strlen($expected_body[$i])));
+ }
+ }
+
+}
diff --git a/unit_tests/php/SplitMessageTest.php b/unit_tests/php/SplitMessageTest.php
new file mode 100644
index 0000000..e622662
--- /dev/null
+++ b/unit_tests/php/SplitMessageTest.php
@@ -0,0 +1,83 @@
+ 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', CONTENT_TYPE => array('type' => TEXT_PLAIN)),
+ THIS_IS_A_TEST],
+
+ ["From: aaa\r\nTo:bbb\r\nCC ccc\r\nSubject: test\r\n\r\n" . THIS_IS_A_TEST,
+ array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', CONTENT_TYPE => array('type' => TEXT_PLAIN)),
+ THIS_IS_A_TEST],
+
+ ["From: aaa\nTo:bbb\nSubject: test\n\n" . THIS_IS_A_TEST,
+ array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', CONTENT_TYPE => array('type' => TEXT_PLAIN)),
+ THIS_IS_A_TEST],
+
+ ["From: aaa\r\nTo:bbb\r\nSubject: test\r\n\r\n\r\n\r\n" . THIS_IS_A_TEST . "\nAaa\n",
+ array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', CONTENT_TYPE => array('type' => TEXT_PLAIN)),
+ "\n\n" . THIS_IS_A_TEST . "\nAaa\n"],
+
+ ["From: aaa\r\nTo:bbb\r\nSubject: test\r\nContent-type: text/html\r\n\r\n\r\n" . THIS_IS_A_TEST . "\nAaa\n",
+ array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', CONTENT_TYPE => array('type' => 'text/html')),
+ "\n" . THIS_IS_A_TEST . "\nAaa\n"],
+
+ ["From: aaa\nTo:bbb\nSubject: test\nContent-Type: text/plain\n\n" . THIS_IS_A_TEST,
+ array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', CONTENT_TYPE => array('type' => TEXT_PLAIN)),
+ THIS_IS_A_TEST],
+
+ ["From: aaa\nTo:bbb\nSubject: test\nDate: Sun, 17 Apr 2016 22:40:03 +0800\nDKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=chemoltravel.hu; s=ml;\n\tt=1471888357; bh=A/l/HLQe3HM4Xc4jFxAmhaWVCMU=;\n\th=Date:To:From:Subject:Sender:From:To:Subject:Date;\n\tb=JlEqXiAKBOoT/YyXKTMsXnEphh2J6sXxgNmbKbGybjo3cU1rgQEL0m1h26gl5AaBP\nContent-Type: " . TEXT_PLAIN . "\n\n" . THIS_IS_A_TEST,
+ array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', SUBJECT => 'test', 'date' => 'Sun, 17 Apr 2016 22:40:03 +0800', 'dkim-signature' => 'v=1; a=rsa-sha1; c=relaxed/relaxed; d=chemoltravel.hu; s=ml; t=1471888357; bh=A/l/HLQe3HM4Xc4jFxAmhaWVCMU=; h=Date:To:From:Subject:Sender:From:To:Subject:Date; b=JlEqXiAKBOoT/YyXKTMsXnEphh2J6sXxgNmbKbGybjo3cU1rgQEL0m1h26gl5AaBP', CONTENT_TYPE => array('type' => TEXT_PLAIN)),
+ THIS_IS_A_TEST],
+
+ ["From: aaa\nTo:bbb\nSubject: test\nContent-Type: text/PLAIN\n\n" . THIS_IS_A_TEST,
+ array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', CONTENT_TYPE => array('type' => TEXT_PLAIN)),
+ THIS_IS_A_TEST],
+
+ ["From: aaa\nTo:bbb\nSubject: test\nContent-Type: text/plain; charset=\"ISO-8859-1\"\n\n" . THIS_IS_A_TEST,
+ array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', CONTENT_TYPE => array('type' => TEXT_PLAIN, 'charset' => 'ISO-8859-1')),
+ THIS_IS_A_TEST],
+
+ ["From: aaa\nTo:bbb\nSubject: test\nMIME-Version: 1.0\nContent-Type: multipart/alternative; boundary=\"_=_SWIFT_v4_1460476188_145aa333fc0127705a7e904aab6d1957_=_\"\n\n" . THIS_IS_A_TEST,
+ array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', 'mime-version' => '1.0', CONTENT_TYPE => array('type' => 'multipart/alternative', 'boundary' => '_=_SWIFT_v4_1460476188_145aa333fc0127705a7e904aab6d1957_=_')),
+ THIS_IS_A_TEST],
+
+ ["From: aaa\nTo:bbb\nSubject: test\nMIME-Version: 1.0\nContent-Type: multipart/alternative;\n boundary=\"_=_SWIFT_v4_1460476188_145aa333fc0127705a7e904aab6d1957_=_\"\n\n" . THIS_IS_A_TEST,
+ array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', 'mime-version' => '1.0', CONTENT_TYPE => array('type' => 'multipart/alternative', 'boundary' => '_=_SWIFT_v4_1460476188_145aa333fc0127705a7e904aab6d1957_=_')),
+ THIS_IS_A_TEST],
+
+ ["From: aaa\nTo:bbb\nSubject: test\nMIME-Version: 1.0\nContent-Type: multipart/related;\n\ttype=\"multipart/alternative\";\n\tboundary=\"----=_NextPart_000_0006_01D195BC.69E26510\"\n\n" . THIS_IS_A_TEST,
+ array('from' => 'aaa', 'to' => 'bbb', 'cc' => '', 'date' => '', SUBJECT => 'test', 'mime-version' => '1.0', CONTENT_TYPE => array('type' => 'multipart/alternative', 'boundary' => '----=_NextPart_000_0006_01D195BC.69E26510')),
+ THIS_IS_A_TEST],
+
+
+ ];
+ }
+
+
+ /**
+ * @dataProvider providerTestSplitMessage
+ */
+ public function test_split_message($input, $expected_headers, $expected_body) {
+ Piler_Mime_Decode::splitMessage($input, $headers, $body);
+
+ $this->assertEquals($headers, $expected_headers);
+ $this->assertEquals($body, $expected_body);
+ }
+
+
+}