Fixing content type ordering when content_type is not defined.
[akelos.git] / test / unit / lib / utils / _Ak_convert.php
blob2a0f47233ba52d2b49011c2ce46564e961a37357
1 <?php
3 require_once(dirname(__FILE__).'/../../../fixtures/config/config.php');
5 class test_Ak_convert extends AkUnitTest
7 function test_html_to_text()
9 $html = <<<EOF
10 <h1 id="creating_a_simple_application_using_the_akelos_framework">Creating a simple application using the Akelos Framework</h1>
12 <h2 id="introduction">Introduction</h2>
14 <p>This tutorial teaches you how to create an application using the Akelos Framework. </p>
16 <p>The application will be used for managing books and their authors and will be named <strong>booklink</strong></p>
18 <h2 id="requisites_for_this_tutorial">Requisites for this tutorial</h2>
20 <ul>
21 <li>A MySQL or SQLite Database</li>
22 <li>Apache web server</li>
23 <li>Shell access to your server</li>
24 </ul>
26 <p>You can checkout a working copy of the Akelos source code with the command:</p>
28 <pre><code>svn co http://akelosframework.googlecode.com/svn/trunk/ akelos
29 </code></pre>
30 EOF;
31 $markdown = <<<EOF
32 Creating a simple application using the Akelos Framework
33 ========================================================
35 Introduction
36 ------------
38 This tutorial teaches you how to create an application using the Akelos Framework.
40 The application will be used for managing books and their authors and will be named **booklink**
42 Requisites for this tutorial
43 ----------------------------
45 * A MySQL or SQLite Database
46 * Apache web server
47 * Shell access to your server
49 You can checkout a working copy of the Akelos source code with the command:
51 svn co http://akelosframework.googlecode.com/svn/trunk/ akelos
52 EOF;
54 $this->assertEqual(Ak::convert('html','text',$html), $markdown);
57 function test_html_to_text_with_entities()
59 $html = <<<EOF
60 &&lt;b&gt;Hi there&lt;/b&gt;
61 EOF;
62 $markdown = <<<EOF
63 &<b>Hi there</b>
64 EOF;
66 $converted = Ak::convert('html','text',$html);
67 $this->assertEqual($converted, $markdown);
70 function test_html_to_text_custom_tags()
72 $html = <<<EOF
73 <table><tr><td><rare><b>Hi</b></rare></td></tr>
74 EOF;
75 $markdown = <<<EOF
76 **Hi**
77 EOF;
78 $this->assertEqual(Ak::convert('html','text',$html), $markdown);
81 function test_html_to_text_removing_js()
83 $html = <<<EOF
84 <script type="text/javascript">something_really_bad()</script><em>Hola</em>
85 EOF;
86 $markdown = <<<EOF
87 _Hola_
88 EOF;
89 $this->assertEqual(Ak::convert('html','text',$html), $markdown);
92 function test_html_to_with_text_using_quotes()
94 $html = <<<EOF
95 &#8220;I&#8217;m completelly agree&#8221;
96 EOF;
97 $markdown = <<<EOF
98 “I’m completelly agree”
99 EOF;
100 $this->assertEqual(Ak::convert('html','text',$html), $markdown);
103 function test_html_to_text_using_smartipants()
105 $html = <<<EOF
106 "I'm completelly agree"
107 EOF;
108 $markdown = <<<EOF
109 “I’m completelly agree”
110 EOF;
111 $this->assertEqual(Ak::convert('html','text',$html), $markdown);
115 ak_test('test_Ak_convert',true);