Make WordPress Core

Changeset 139 in tests for wp-testcase/test_import_wp.php


Ignore:
Timestamp:
12/14/2007 04:38:27 AM (19 years ago)
Author:
tellyworth
Message:

new tests for the attachment importer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_import_wp.php

    r137 r139  
    7979        // use this to generate the tests seen in test_all_posts()
    8080        function _test_generate() {
    81                 $this->_import_wp(DIR_TESTDATA.'/export/asdftestblog1.2007-12-11.xml', array('User A', 'User B'));
     81                $this->_import_wp(DIR_TESTDATA.'/export/asdftestblog1.2007-12-14.xml', array('User A', 'User B'));
    8282                $this->posts = get_posts('numberposts=500&post_type=&post_status=&orderby=post_date DESC,ID');
    8383                echo $this->_generate_post_content_test($this->posts, false);
     
    8686        function test_all_posts() {
    8787                global $wpdb;
    88                 $this->_import_wp(DIR_TESTDATA.'/export/asdftestblog1.2007-12-11.xml', array('User A', 'User B'));
     88                $this->_import_wp(DIR_TESTDATA.'/export/asdftestblog1.2007-12-14.xml', array('User A', 'User B'));
    8989               
    9090                // check the tag and category counts
     
    284284                $this->assertEquals("2007-12-03 08:07:28", $post->post_date);
    285285                $this->assertEquals("2007-12-02 22:07:28", $post->post_date_gmt);
    286                 $this->assertEquals("Here's an mp3 file that was uploaded as an attachment:\n\n<a href=\"http://asdftestblog1.wordpress.com/files/2007/12/yue-04-juan_manuel_fangio.mp3\" title=\"Juan Manuel Fangio by Yue\">Juan Manuel Fangio by Yue</a>\n\nAnd here's a link to an external mp3 file:\n\n<a href=\"http://generalfuzz.net/mp3/Cool%20Aberrations/acclimate.mp3\"> Acclimate by General Fuzz </a>\n\nBoth are CC licensed.", $post->post_content);
     286                $this->assertEquals("Here's an mp3 file that was uploaded as an attachment:\n\n<a href=\"http://example.com/wp-content/uploads/2007/12/yue-04-juan_manuel_fangio.mp3\" title=\"Juan Manuel Fangio by Yue\">Juan Manuel Fangio by Yue</a>\n\nAnd here's a link to an external mp3 file:\n\n<a href=\"http://generalfuzz.net/mp3/Cool%20Aberrations/acclimate.mp3\"> Acclimate by General Fuzz </a>\n\nBoth are CC licensed.", $post->post_content);
    287287                $this->assertEquals("Test with enclosures", $post->post_title);
    288288                $this->assertEquals("0", $post->post_category);
     
    890890                $this->assertEquals("2007-09-05 14:41:08", $post->post_date);
    891891                $this->assertEquals("2007-09-05 04:41:08", $post->post_date_gmt);
    892                 $this->assertEquals("All the HTML tags listed in the <a href=\"http://faq.wordpress.com/2006/06/08/allowed-html-tags/\">FAQ</a>:\n\n<address>an address</address>\n<a href=\"http://example.com\">a link</a>\n<abbr title=\"abbreviation\">abbr.</abbr>\n<acronym title=\"acronym\">acr.</acronym>\n<b>bold<b>\n<big>big</big>\n<blockquote>a blockquote</blockquote>\nline<br />break\na citation\n\"class\" - eh?\n<code>some code</code>\n<del>deleted text</del>\n<div>a div</div>\n<em>emphasis</em>\n<font>font tags are bad</font>\n<h1>heading 1</h1>\n<h2>heading 2</h2>\n<h3>heading 3</h3>\n<h4>heading 4</h4>\n<h5>heading 5</h5>\n<h6>heading 6</h6>\n<i>italic</i>\n<img src=\"http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4711-300px.jpg\" />\n<ins>inserted text</ins>\n<kbd>keyboard text</kbd>\n<p>a paragraph</p>\n<pre>pre-\nformatted\ntext</pre>\n<q>a quote</q>\n<s>strike</s>\n<strong>strong</strong>\n<sub>subtext</sub>\n<sup>supertext</sup>\n<tt>teletype text</tt>\n<var>variable</var>\n\n\nList tags:\n\n<dl>\n<dt>term</dt>\n<dd>definition</dd>\n<dt>term 2</dt>\n<dd>definition 2</dd>\n</dl>\n\n<ul>\n<li>item 1</li>\n<li>item 2</li>\n</ul>\n\n<ol>\n<li>item 1</li>\n<li>item 2</li>\n</ol>\n\n\nTable tags:\n\n<table border=\"1\">\n<caption>table caption</caption>\n<col />\n<col />\n<thead>\n<tr>\n<th>heading 1</th>\n<th>heading 2</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Cell 1</td>\n<td>Cell 2</td>\n</tr>\n</tbody>\n<tfoot>\n<tr>\n<td>footer 1</td>\n<td>footer 2</td>\n</tr>\n</tfoot>\n</table>", $post->post_content);
     892                $this->assertEquals("All the HTML tags listed in the <a href=\"http://faq.wordpress.com/2006/06/08/allowed-html-tags/\">FAQ</a>:\n\n<address>an address</address>\n<a href=\"http://example.com\">a link</a>\n<abbr title=\"abbreviation\">abbr.</abbr>\n<acronym title=\"acronym\">acr.</acronym>\n<b>bold<b>\n<big>big</big>\n<blockquote>a blockquote</blockquote>\nline<br />break\na citation\n\"class\" - eh?\n<code>some code</code>\n<del>deleted text</del>\n<div>a div</div>\n<em>emphasis</em>\n<font>font tags are bad</font>\n<h1>heading 1</h1>\n<h2>heading 2</h2>\n<h3>heading 3</h3>\n<h4>heading 4</h4>\n<h5>heading 5</h5>\n<h6>heading 6</h6>\n<i>italic</i>\n<img src=\"http://example.com/wp-content/uploads/2007/09/2007-06-30-dsc_4711-300px.jpg\" />\n<ins>inserted text</ins>\n<kbd>keyboard text</kbd>\n<p>a paragraph</p>\n<pre>pre-\nformatted\ntext</pre>\n<q>a quote</q>\n<s>strike</s>\n<strong>strong</strong>\n<sub>subtext</sub>\n<sup>supertext</sup>\n<tt>teletype text</tt>\n<var>variable</var>\n\n\nList tags:\n\n<dl>\n<dt>term</dt>\n<dd>definition</dd>\n<dt>term 2</dt>\n<dd>definition 2</dd>\n</dl>\n\n<ul>\n<li>item 1</li>\n<li>item 2</li>\n</ul>\n\n<ol>\n<li>item 1</li>\n<li>item 2</li>\n</ol>\n\n\nTable tags:\n\n<table border=\"1\">\n<caption>table caption</caption>\n<col />\n<col />\n<thead>\n<tr>\n<th>heading 1</th>\n<th>heading 2</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Cell 1</td>\n<td>Cell 2</td>\n</tr>\n</tbody>\n<tfoot>\n<tr>\n<td>footer 1</td>\n<td>footer 2</td>\n</tr>\n</tfoot>\n</table>", $post->post_content);
    893893                $this->assertEquals("Raw HTML code", $post->post_title);
    894894                $this->assertEquals("0", $post->post_category);
     
    21382138                $this->assertEquals("2007-09-04 09:37:59", $post->post_date);
    21392139                $this->assertEquals("2007-09-03 23:37:59", $post->post_date_gmt);
    2140                 $this->assertEquals("Align right:\n\n<img SRC=\"http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4711-300px.jpg\" ALT=\"2007-06-30-dsc_4711-300px.jpg\" ALIGN=\"right\" />\n\nAlign left:\n\n<img SRC=\"http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4711-300px.jpg\" ALT=\"2007-06-30-dsc_4711-300px.jpg\" />", $post->post_content);
     2140                $this->assertEquals("Align right:\n\n<img SRC=\"http://example.com/wp-content/uploads/2007/09/2007-06-30-dsc_4711-300px.jpg\" ALT=\"2007-06-30-dsc_4711-300px.jpg\" ALIGN=\"right\" />\n\nAlign left:\n\n<img SRC=\"http://example.com/wp-content/uploads/2007/09/2007-06-30-dsc_4711-300px.jpg\" ALT=\"2007-06-30-dsc_4711-300px.jpg\" />", $post->post_content);
    21412141                $this->assertEquals("Image align test", $post->post_title);
    21422142                $this->assertEquals("0", $post->post_category);
     
    21722172                $this->assertEquals("2007-09-04 09:36:28", $post->post_date);
    21732173                $this->assertEquals("2007-09-03 23:36:28", $post->post_date_gmt);
    2174                 $this->assertEquals("Three thumbs with links:\n\n<a TITLE=\"2007-06-30-dsc_4700-1.jpg\" HREF=\"http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg\"><img ALT=\"2007-06-30-dsc_4700-1.jpg\" SRC=\"http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.thumbnail.jpg\" /></a><a TITLE=\"2007-06-30-dsc_4711-900px.jpg\" HREF=\"http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4711-900px.jpg\"><img ALT=\"2007-06-30-dsc_4711-900px.jpg\" SRC=\"http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4711-900px.thumbnail.jpg\" /></a><a TITLE=\"2007-06-30-dsc_4711-300px.jpg\" HREF=\"http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4711-300px.jpg\"><img ALT=\"2007-06-30-dsc_4711-300px.jpg\" SRC=\"http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4711-300px.thumbnail.jpg\" /></a>", $post->post_content);
     2174                $this->assertEquals("Three thumbs with links:\n\n<a TITLE=\"2007-06-30-dsc_4700-1.jpg\" HREF=\"http://example.com/wp-content/uploads/2007/09/2007-06-30-dsc_4700-1.jpg\"><img ALT=\"2007-06-30-dsc_4700-1.jpg\" SRC=\"http://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.thumbnail.jpg\" /></a><a TITLE=\"2007-06-30-dsc_4711-900px.jpg\" HREF=\"http://example.com/wp-content/uploads/2007/09/2007-06-30-dsc_4711-900px.jpg\"><img ALT=\"2007-06-30-dsc_4711-900px.jpg\" SRC=\"http://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4711-900px.thumbnail.jpg\" /></a><a TITLE=\"2007-06-30-dsc_4711-300px.jpg\" HREF=\"http://example.com/wp-content/uploads/2007/09/2007-06-30-dsc_4711-300px.jpg\"><img ALT=\"2007-06-30-dsc_4711-300px.jpg\" SRC=\"http://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4711-300px.thumbnail.jpg\" /></a>", $post->post_content);
    21752175                $this->assertEquals("Test with thumbnails", $post->post_title);
    21762176                $this->assertEquals("0", $post->post_category);
     
    22062206                $this->assertEquals("2007-09-04 09:35:23", $post->post_date);
    22072207                $this->assertEquals("2007-09-03 23:35:23", $post->post_date_gmt);
    2208                 $this->assertEquals("Image is 900x598px, resized in editor to 329x222.\n\n<a href=\"http://asdftestblog1.wordpress.com/2007/09/04/test-with-wide-image/9/\" title=\"2007-06-30-dsc_4711-900px.jpg\" rel=\"attachment wp-att-9\"><img src=\"http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4711-900px.jpg\" alt=\"2007-06-30-dsc_4711-900px.jpg\" height=\"222\" width=\"329\" /></a>", $post->post_content);
     2208                $this->assertEquals("Image is 900x598px, resized in editor to 329x222.\n\n<a href=\"http://asdftestblog1.wordpress.com/2007/09/04/test-with-wide-image/9/\" title=\"2007-06-30-dsc_4711-900px.jpg\" rel=\"attachment wp-att-9\"><img src=\"http://example.com/wp-content/uploads/2007/09/2007-06-30-dsc_4711-900px.jpg\" alt=\"2007-06-30-dsc_4711-900px.jpg\" height=\"222\" width=\"329\" /></a>", $post->post_content);
    22092209                $this->assertEquals("Test with wide image resized", $post->post_title);
    22102210                $this->assertEquals("0", $post->post_category);
     
    22402240                $this->assertEquals("2007-09-04 09:31:31", $post->post_date);
    22412241                $this->assertEquals("2007-09-03 23:31:31", $post->post_date_gmt);
    2242                 $this->assertEquals("Image is 900x598px, not resized in editor.\n\n<a TITLE=\"2007-06-30-dsc_4711-900px.jpg\" REL=\"attachment wp-att-9\" HREF=\"http://asdftestblog1.wordpress.com/?attachment_id=9\"><img ALT=\"2007-06-30-dsc_4711-900px.jpg\" SRC=\"http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4711-900px.jpg\" /></a>", $post->post_content);
     2242                $this->assertEquals("Image is 900x598px, not resized in editor.\n\n<a TITLE=\"2007-06-30-dsc_4711-900px.jpg\" REL=\"attachment wp-att-9\" HREF=\"http://asdftestblog1.wordpress.com/?attachment_id=9\"><img ALT=\"2007-06-30-dsc_4711-900px.jpg\" SRC=\"http://example.com/wp-content/uploads/2007/09/2007-06-30-dsc_4711-900px.jpg\" /></a>", $post->post_content);
    22432243                $this->assertEquals("Test with wide image", $post->post_title);
    22442244                $this->assertEquals("0", $post->post_category);
     
    23082308                $this->assertEquals("2007-09-04 09:30:02", $post->post_date);
    23092309                $this->assertEquals("2007-09-03 23:30:02", $post->post_date_gmt);
    2310                 $this->assertEquals("Image is 300x199, not resized in editor.\n\n<a TITLE=\"2007-06-30-dsc_4711-300px.jpg\" REL=\"attachment wp-att-7\" HREF=\"http://asdftestblog1.wordpress.com/?attachment_id=7\"><img ALT=\"2007-06-30-dsc_4711-300px.jpg\" SRC=\"http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4711-300px.jpg\" /></a>", $post->post_content);
     2310                $this->assertEquals("Image is 300x199, not resized in editor.\n\n<a TITLE=\"2007-06-30-dsc_4711-300px.jpg\" REL=\"attachment wp-att-7\" HREF=\"http://asdftestblog1.wordpress.com/?attachment_id=7\"><img ALT=\"2007-06-30-dsc_4711-300px.jpg\" SRC=\"http://example.com/wp-content/uploads/2007/09/2007-06-30-dsc_4711-300px.jpg\" /></a>", $post->post_content);
    23112311                $this->assertEquals("Test with image", $post->post_title);
    23122312                $this->assertEquals("0", $post->post_category);
     
    26642664                $this->assertEquals("0000-00-00 00:00:00", $post->post_date);
    26652665                $this->assertEquals("0000-00-00 00:00:00", $post->post_date_gmt);
    2666                 $this->assertEquals("Image file attached, 300px high.\n\n<a TITLE=\"2007-06-30-dsc_4700-1.jpg\" REL=\"attachment wp-att-25\" HREF=\"http://asdftestblog1.wordpress.com/?attachment_id=25\"><img ALT=\"2007-06-30-dsc_4700-1.jpg\" SRC=\"http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg\" /></a>", $post->post_content);
     2666                $this->assertEquals("Image file attached, 300px high.\n\n<a TITLE=\"2007-06-30-dsc_4700-1.jpg\" REL=\"attachment wp-att-25\" HREF=\"http://asdftestblog1.wordpress.com/?attachment_id=25\"><img ALT=\"2007-06-30-dsc_4700-1.jpg\" SRC=\"http://example.com/wp-content/uploads/2007/09/2007-06-30-dsc_4700-1.jpg\" /></a>", $post->post_content);
    26672667                $this->assertEquals("Draft post with file attached", $post->post_title);
    26682668                $this->assertEquals("0", $post->post_category);
Note: See TracChangeset for help on using the changeset viewer.