Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/site/app/tests/views
diff options
context:
space:
mode:
Diffstat (limited to 'site/app/tests/views')
-rw-r--r--site/app/tests/views/addons/dictionaries.test.php71
-rw-r--r--site/app/tests/views/addons/display.test.php222
-rw-r--r--site/app/tests/views/addons/home.test.php111
-rw-r--r--site/app/tests/views/addons/plugins.test.php91
-rw-r--r--site/app/tests/views/addons/policy.test.php106
-rw-r--r--site/app/tests/views/addons/previews.test.php83
-rw-r--r--site/app/tests/views/addons/rss/parserss.test.php77
-rw-r--r--site/app/tests/views/addons/searchengines.test.php93
-rw-r--r--site/app/tests/views/addons/versions.test.php125
-rw-r--r--site/app/tests/views/admin/addons_status.test.php27
-rw-r--r--site/app/tests/views/admin/serverstatus.test.php98
-rw-r--r--site/app/tests/views/developers/add.test.php62
-rw-r--r--site/app/tests/views/developers/edit.test.php94
-rw-r--r--site/app/tests/views/developers/editversion.test.php84
-rw-r--r--site/app/tests/views/developers/index.test.php69
-rw-r--r--site/app/tests/views/elements/install.test.php91
-rw-r--r--site/app/tests/views/helpers/addons_html.test.php118
-rw-r--r--site/app/tests/views/helpers/localization.test.php53
-rw-r--r--site/app/tests/views/helpers/statistics.test.php66
-rw-r--r--site/app/tests/views/images/show.test.php116
-rw-r--r--site/app/tests/views/reviews/add.test.php75
-rw-r--r--site/app/tests/views/reviews/display.test.php75
-rw-r--r--site/app/tests/views/search/index.test.php57
-rw-r--r--site/app/tests/views/search/rss/index.test.php57
-rw-r--r--site/app/tests/views/users/pwreset.test.php32
25 files changed, 2153 insertions, 0 deletions
diff --git a/site/app/tests/views/addons/dictionaries.test.php b/site/app/tests/views/addons/dictionaries.test.php
new file mode 100644
index 0000000..3bf686b
--- /dev/null
+++ b/site/app/tests/views/addons/dictionaries.test.php
@@ -0,0 +1,71 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Frederic Wenzel <fwenzel@mozilla.com> (Original Author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class AddonDictionariesTest extends WebTestHelper {
+
+ function AddonDictionariesTest() {
+ $this->WebTestCase("Views->Addons->Dictionaries Tests");
+ }
+
+ function setUp() {
+ $this->getAction('/browse/type:'.ADDON_DICT);
+
+ global $TestController;
+ $this->helper = new UnitTestHelper();
+ $this->controller = $this->helper->getController('Addons', $this);
+ $this->controller->base = $TestController->base;
+ }
+
+ function testRemoraPage() {
+ // just checks if the page works or not
+ $this->assertWantedPattern('/Mozilla Add-ons/i', "pattern detected");
+ }
+
+ function testDicts() {
+ }
+
+ /**
+ * There was a bug (376461) about locale codes getting html-encoded, which shouldn't happen
+ */
+ //function testLocaleCode() {
+ // $pattern = "#addDictionary\(\s*'de-DE',.*\)#";
+ // $this->assertPattern($pattern, htmlentities($pattern));
+ //} // -CP addDictionary( javascript no longer exists.
+
+}
+?>
diff --git a/site/app/tests/views/addons/display.test.php b/site/app/tests/views/addons/display.test.php
new file mode 100644
index 0000000..abaa42f
--- /dev/null
+++ b/site/app/tests/views/addons/display.test.php
@@ -0,0 +1,222 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Andrei Hajdukewycz <sancus@off.net> (Original Author)
+ * Frederic Wenzel <fwenzel@mozilla.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class AddonTest extends WebTestHelper {
+
+ function AddonTest() {
+ $this->WebTestCase("Views->Addons->Display Tests");
+ loadModel('Addon');
+ loadModel('Tag');
+ loadModel('Version');
+ }
+
+ function setUp() {
+ $this->id = 7;//$_GET['id'];
+
+ $model =& new Addon();
+ $model->caching = false;
+
+ $tagModel =& new Tag();
+ $tagModel->caching = false;
+
+ $versionModel =& new Version();
+ $versionModel->caching = false;
+
+ $this->data = $model->find("Addon.id=$this->id", null , null , 2);
+ $this->data['Version'] = $versionModel->findAll("Version.addon_id=$this->id", null, "Version.created DESC", 0);
+ //get tag l10n data
+ foreach ($this->data['Tag'] as $tagkey => $tagvalue) {
+ if ($tagkey == 0)
+ $related_tag_query = "Tag.id='${tagvalue['id']}'";
+ else
+ $related_tag_query = $related_tag_query . " OR Tag.id ='${tagvalue['id']}'";
+ }
+ $this->tagData = $tagModel->findAll($related_tag_query);
+
+ $this->getAction("/addon/" . $this->id);
+
+ global $TestController;
+ $this->helper = new UnitTestHelper();
+ $this->controller = $this->helper->getController('Addons', $this);
+ $this->controller->base = $TestController->base;
+ loadComponent('Image');
+ $this->controller->Image =& new ImageComponent();
+ $this->controller->Image->startup($this->controller);
+ }
+
+ function testRemoraPage() {
+ //just checks if the page works or not
+ $this->assertWantedPattern('/Mozilla Add-ons/i', "pattern detected");
+ }
+
+ function testDisplay() {
+ // Title
+ $this->title = sprintf(_('addons_display_pagetitle'), $this->data['Translation']['name']['string']). ' :: '.sprintf(_('addons_home_pagetitle'), APP_PRETTYNAME);
+ $this->assertTitle($this->title);
+ // Author
+ $username = $this->data['User'][0]['nickname'];
+ $userid = $this->data['User'][0]['id'];
+ $this->actionPath = $this->actionPath("");
+ $this->authorPattern = "@<h4 class=\"author\">by +<a href=\"{$this->actionPath}/user/{$userid}\" class=\"profileLink\">{$username}</a> ?</h4>@";
+ $this->assertWantedPattern($this->authorPattern, htmlentities($this->authorPattern));
+
+ //@TODO Size: Figure out some way to use the Number Helper in this test
+ //$this->wantedPattern = "#<span>\(" . $this->data['Version'][0]['File'][0]['size'] . "KB\)</span>#";
+ //$this->assertWantedPattern($this->wantedPattern, htmlentities($this->wantedPattern));
+
+ // tags
+ foreach ($this->tagData as $tag) {
+ $this->wantedPattern = "@<li><a href=\"[^\"]+\"( )*>" . $tag['Translation']['name']['string'] . "</a></li>@";
+ $this->assertWantedPattern($this->wantedPattern, htmlentities($this->wantedPattern));
+ }
+ // are reviews displayed?
+ $this->wantedPattern = "@"._('addons_display_header_reviews')."@";
+ $this->assertWantedPattern($this->wantedPattern, htmlentities($this->wantedPattern));
+
+ $this->wantedPattern = "@It works but not well.@";
+ $this->assertWantedPattern($this->wantedPattern, htmlentities($this->wantedPattern));
+ }
+
+ function testVersion() {
+ $this->getAction("/addon/" . $this->id);
+ phpQuery::newDocument($this->_browser->getContent());
+
+ // Check the version detail area.
+ $version_link = pq('h5#version-detail a');
+ $version = $this->data['Version'][0]['Version']['version'];
+ $this->assertEqual($version_link->text(), sprintf(_('addon_display_header_version'), $version));
+ $link = sprintf('addons/versions/%s#version-%s', $this->id, $version);
+ $this->assertEqual($version_link->attr('href'), $this->controller->url($link));
+
+ $span = pq('h5#version-detail span');
+ $created = strtotime($this->data['Version'][0]['Version']['created']);
+ $this->assertEqual($span->attr('title'), strftime(_('datetime'), $created));
+ $this->assertEquiv($span->text(), '— '.strftime(_('date'), $created));
+
+ $notes = $this->data['Version'][0]['Translation']['releasenotes']['string'];
+ $this->assertEquiv(pq('#release-notes')->text(), $notes);
+
+ // check the version at the top title
+ $this->wantedPattern = "#" . $this->data['Version'][0]['Version']['version'] . "#";
+ $this->assertWantedPattern($this->wantedPattern, htmlentities($this->wantedPattern));
+
+ // check if previous versions link is displayed
+ $link = $this->controller->url('addons/versions/'.$this->id);
+ $text = ___('addons_display_see_all_versions');
+ $this->assertLinkLocation($link, $text);
+ }
+
+ function testIcon() {
+ $this->getAction("/addon/" . $this->id);
+ phpQuery::newDocument($this->_browser->getContent());
+
+ $img = pq('#addon-summary .name img.addon-icon');
+ $this->assertEqual($img->attr('src'), $this->controller->Image->getAddonIconURL($this->id));
+ }
+
+ function testPreviewsWithMoreImages() {
+ // Check the preview images for addon 7. It has 2 in total.
+ $this->getAction("/addon/" . $this->id);
+ phpQuery::newDocument($this->_browser->getContent());
+ $previews = $this->controller->Preview->findAllByAddonId($this->id,
+ array('id', 'addon_id', 'caption'),
+ 'highlight desc');
+
+ // Check the main preview image.
+ $this->checkImage($previews[0], '.preview-img a', '.preview-img img');
+
+ // Check the More Images section.
+ $this->assertEqual(pq('#addon-info h4:first')->text(), ___('addons_display_more_images'));
+ $this->checkImage($previews[1], '.addon-images li a', '.addon-images li a img');
+
+ //$this->getAction("/addon/" . $this->id);
+ }
+
+ function testPreviewsWithoutMoreImages() {
+ // Addon 9 only has one preview image.
+ $id = 9;
+ $this->getAction("/addon/" . $id);
+ phpQuery::newDocument($this->_browser->getContent());
+ $previews = $this->controller->Preview->findAllByAddonId($id,
+ array('id', 'addon_id', 'caption'),
+ 'highlight desc');
+ // Check the main preview image.
+ $this->checkImage($previews[0], '.preview-img a', '.preview-img img');
+ // No More Images section.
+ $this->assertNotEqual(pq('#addon-info h4:first')->text(), ___('addons_display_more_images'));
+ $this->assertEqual(pq('#addon-info .addon-images')->size(), 0);
+ }
+
+ function testPreviewsDefaultImage() {
+ // Addon 4022 only has no preview images.
+ $id = 4022;
+ $this->getAction("/addon/" . $id);
+ phpQuery::newDocument($this->_browser->getContent());
+ $this->assertEqual(pq('.preview-img img')->attr('src'), $this->controller->base.'/img/no-preview.png');
+ // No More Images section.
+ $this->assertNotEqual(pq('#addon-info h4:first')->text(), ___('addons_display_more_images'));
+ $this->assertEqual(pq('#addon-info .addon-images')->size(), 0);
+ }
+
+ function checkImage($preview, $link_selector, $image_selector) {
+ list($thumb, $full, $caption) = $this->_previewData($preview);
+ $link = pq($link_selector);
+ $image = pq($image_selector);
+ $this->assertEqual($link->attr('href'), $full);
+ $this->assertEqual($link->attr('title'), $caption);
+ $this->assertEqual($image->attr('src'), $thumb);
+ }
+
+ function _previewData($preview) {
+ $thumb = $this->controller->Image->getPreviewURL($preview['Preview']['id']);
+ $full = $this->controller->Image->getPreviewURL($preview['Preview']['id'], 'full');
+ $caption = $preview['Translation']['caption']['string'];
+ return array($thumb, $full, $caption);
+ }
+
+ /**
+ * bug 412580 was a bug about some UTF-8 characters breaking out HTML sanitization.
+ * Make sure this does not happen anymore.
+ */
+ function testSanitization() {
+ $this->wantedPattern = '@sanitization of signs like &amp; and &quot;@';
+ $this->assertWantedPattern($this->wantedPattern, htmlentities($this->wantedPattern));
+ }
+}
+?>
diff --git a/site/app/tests/views/addons/home.test.php b/site/app/tests/views/addons/home.test.php
new file mode 100644
index 0000000..351ce0e
--- /dev/null
+++ b/site/app/tests/views/addons/home.test.php
@@ -0,0 +1,111 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Andrei Hajdukewycz <sancus@off.net> (Original Author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class AddonHomeTest extends WebTestHelper {
+
+ function AddonHomeTest() {
+ $this->WebTestCase("Views->Addons->Home Tests");
+ }
+
+ function setUp() {
+
+ $this->getAction("");
+
+ global $TestController;
+ loadComponent('Image');
+ $this->Image =& new ImageComponent();
+ $this->Image->startup($TestController);
+ }
+
+ function testRemoraHome() {
+ //just checks if the page works or not
+ $this->assertWantedPattern('/Mozilla Add-ons/i', "pattern detected");
+ }
+
+ function testTitle() {
+ $this->title = sprintf(_('addons_home_pagetitle'), APP_PRETTYNAME);
+ $this->assertTitle($this->title);
+ }
+
+ function testAddons() {
+ $homepage = $this->_browser->getContent();
+ $homepage = explode("\n", $homepage);
+
+ $addon = 0;
+ foreach ($homepage as $line) {
+ if ($line = strstr($line, "/addon/")) {
+ $line = strip_tags($line);
+ sscanf($line, "/addon/%d\" >%s", $this->addonid[$addon], $this->addonName[$addon]);
+ $addon++;
+ break;//in 3.2 test only get the first one since now do have many featured addon (in 3.0 only 1)
+ }
+ }
+ $this->assertEqual($addon, 1);
+ }
+ function testLoadData() {
+ foreach ($this->addonid as $addon_id) {
+ if ($addon_id == $this->addonid[0]) {
+ $select_string = "Addon.id = $addon_id";
+ }
+ else
+ $select_string = $select_string . " OR Addon.id = $addon_id";
+ }
+ $this->model =& new Addon();
+ $this->model->caching = false;
+ $this->assertTrue($this->addon_data = $this->model->findAll($select_string, null, null, 3, null, 1));
+ }
+
+ function testAddonNames() {
+
+ foreach ($this->addon_data as $addon_data) {
+ $this->assertTrue(in_array($addon_data['Translation']['name']['string'], $this->addonName));
+ }
+ }
+ function testAuthors() {
+ foreach ($this->addon_data as $addon_data) {
+ $wantedPattern = "#>" . $addon_data['User'][0]['firstname'] ." ".$addon_data['User'][0]['lastname'] . "</a></h5>#";
+ $this->assertWantedPattern($wantedPattern, htmlentities($wantedPattern));
+ }
+ }
+
+ function xFailIcon() {
+ $wantedPattern = "#<img src=\"" . $this->Image->getAddonIconURL($this->addonid[0]) . "\" alt=\"" . $this->addon_data[0]['Addon']['name'] . "\" />#";
+ $this->assertWantedPattern($wantedPattern, htmlentities($wantedPattern));
+ }
+}
+?>
diff --git a/site/app/tests/views/addons/plugins.test.php b/site/app/tests/views/addons/plugins.test.php
new file mode 100644
index 0000000..67b4fcf
--- /dev/null
+++ b/site/app/tests/views/addons/plugins.test.php
@@ -0,0 +1,91 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Mike Morgan <morgamic@mozilla.com> (Original Author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class AddonPluginsTest extends WebTestHelper {
+
+ function AddonPluginsTest() {
+ $this->WebTestCase("Views->Addons->Plugins Tests");
+ }
+
+ function setUp() {
+ $this->getAction('/browse/type:'.ADDON_PLUGIN);
+
+ global $TestController;
+ $this->helper = new UnitTestHelper();
+ $this->controller = $this->helper->getController('Addons', $this);
+ $this->controller->base = $TestController->base;
+ }
+
+ function testRemoraPage() {
+ // just checks if the page works or not
+ $this->assertWantedPattern('/Mozilla Add-ons/i', "pattern detected");
+ }
+
+ function testPlugins() {
+ $this->title = _('addons_plugins_pagetitle') .' :: '. sprintf(_('addons_home_pagetitle'), APP_PRETTYNAME);
+ $this->assertTitle($this->title);
+
+ $pattern = '#<span>'.sprintf(_('addons_plugins_main_header'), APP_PRETTYNAME).'</span>#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+
+ $pattern = '#<p class="first">'._('addons_plugins_main_description').'</p>#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+
+ $pattern = '#<p class="first">'._('addons_plugins_by').'#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+
+ $pattern = '#'._('addons_plugins_for_windows').'<br>#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+
+ $pattern = '#'._('addons_plugins_for_linux').'<br>#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+
+ $pattern = '#'._('addons_plugins_for_macosx').'<br>#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+
+ $pattern = '#'._('addons_plugins_support_documentation').'#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+
+ $pattern = '#<h2>'._('addons_plugins_looking_for_plugin').'#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+
+ $pattern = '#<p class="first">'.sprintf(_('addons_plugins_looking_for_more'),'<a href="http://plugindoc.mozdev.org">PluginDoc</a>').'</p>#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+ }
+}
+?>
diff --git a/site/app/tests/views/addons/policy.test.php b/site/app/tests/views/addons/policy.test.php
new file mode 100644
index 0000000..2996f39
--- /dev/null
+++ b/site/app/tests/views/addons/policy.test.php
@@ -0,0 +1,106 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Andrei Hajdukewycz <sancus@off.net> (Original Author)
+ *
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class PolicyTest extends WebTestHelper {
+
+ function PolicyTest() {
+ $this->WebTestCase("Views->Addons->Privacy Policy/EULA Tests");
+ }
+
+ function setUp() {
+ $this->id = 7;//$_GET['id'];
+ $this->actionPath = $this->actionPath("");
+ $model =& new Addon();
+ $model->caching = false;
+ $this->data = $model->find("Addon.id=$this->id", null , null , 2);
+ }
+
+ function testPrivacyPolicy() {
+ //get display page and test policy link
+ $this->getAction("/addon/" . $this->id);
+
+ $this->wantedPattern = "@<a href=\"{$this->actionPath}/addons/policy/0/{$this->id}\" >This add-on has a privacy policy.</a>@";
+ $this->assertWantedPattern($this->wantedPattern, htmlentities($this->wantedPattern));
+
+ //get policy page and test page contents
+ $this->getAction("/addons/policy/0/" . $this->id);
+ $privacypolicy = nl2br($this->data['Translation']['privacypolicy']['string']);
+ $privacypolicy = substr($privacypolicy, -22);
+ $this->wantedPattern = "^{$privacypolicy}^";
+ $this->assertWantedPattern($this->wantedPattern, htmlentities($this->wantedPattern));
+
+ //add-on name
+ $this->wantedPattern = "@<h3 class=\"name\">[\s]*{$this->data['Translation']['name']['string']}[\s]*</h3>@";
+ $this->assertWantedPattern($this->wantedPattern, htmlentities($this->wantedPattern));
+
+ //author user data
+ foreach ($this->data['User'] as $user) {
+ $username = $user['nickname'];
+ $usertitle = _('addons_display_author_title');
+ $this->wantedPattern = "@<h4 class=\"author\"> by <a href=\"{$this->actionPath}/user/{$user['id']}\" class=\"profileLink\">{$username}</a></h4>@";
+ $this->assertWantedPattern($this->wantedPattern, htmlentities($this->wantedPattern));
+ }
+ }
+
+ function testEULA() {
+
+ //get EULA page
+ $this->getAction("/addons/policy/0/{$this->id}/{$this->data['Version'][0]['File'][0]['id']}");
+
+ //name and version
+ $this->wantedPattern = "@<h3 class=\"name\">[\s]*{$this->data['Translation']['name']['string']} *{$this->data['Version'][0]['version']}[\s]*</h3>@";
+ $this->assertWantedPattern($this->wantedPattern, htmlentities($this->wantedPattern));
+
+ //get policy page and test page contents
+ $eula = nl2br($this->data['Translation']['eula']['string']);
+ $eula = substr($eula, 0, 22);
+ $this->wantedPattern = "^{$eula}^";
+ $this->assertWantedPattern($this->wantedPattern, htmlentities($this->wantedPattern));
+
+ //author user data @TODO: Fix multiple author stuff when we add that
+ foreach ($this->data['User'] as $user) {
+ $username = $user['nickname'];
+ $usertitle = _('addons_display_author_title');
+ $this->wantedPattern = "@<h4 class=\"author\"> by <a href=\"{$this->actionPath}/user/{$user['id']}\" class=\"profileLink\">{$username}</a></h4>@";
+ $this->assertWantedPattern($this->wantedPattern, htmlentities($this->wantedPattern));
+ }
+
+ }
+}
+?>
diff --git a/site/app/tests/views/addons/previews.test.php b/site/app/tests/views/addons/previews.test.php
new file mode 100644
index 0000000..6fa4ace
--- /dev/null
+++ b/site/app/tests/views/addons/previews.test.php
@@ -0,0 +1,83 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Frederic Wenzel <fwenzel@mozilla.com> (Original Author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class AddonPreviewsTest extends WebTestHelper {
+ var $addonid = 7;
+
+ function AddonPreviewsTest() {
+ $this->WebTestCase("Views->Addons->Preview Images Tests");
+ }
+
+ function setUp() {
+ $this->getAction("/addons/previews/{$this->addonid}");
+
+ global $TestController;
+ $this->helper = new UnitTestHelper();
+ $this->controller = $this->helper->getController('Addons', $this);
+ $this->controller->base = $TestController->base;
+ }
+
+ function testRemoraPage() {
+ // just checks if the page works or not
+ $this->assertWantedPattern('/Mozilla Add-ons/i', "pattern detected");
+ }
+
+ function testPreviews() {
+ $addon = $this->controller->Addon->findById($this->addonid);
+
+ // Title
+ $this->title = sprintf(_('addons_previews_pagetitle'), $addon['Translation']['name']['string']) .' :: '. sprintf(_('addons_home_pagetitle'), APP_PRETTYNAME);
+ $this->assertTitle($this->title);
+
+ // Header
+ $pattern = '#'.sprintf(_('addons_previews_pagetitle'), $addon['Translation']['name']['string']).'#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+
+ // preview pic
+ $pattern = '#<a href="[^"]*/images/preview/'.$this->addonid.'/1" '
+ .'rel="lightbox\[previews\]" '
+ .'title="[^"]*">'
+ .'<img src="[^"]*/images/addon_preview/'.$this->addonid.'/1"'
+ .' alt="" ></a>#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+
+ // link back
+ $this->assertLink(sprintf(_('addon_review_a_back_to_addon_x'), $addon['Translation']['name']['string']), 'link back to addon page');
+ }
+}
+?>
diff --git a/site/app/tests/views/addons/rss/parserss.test.php b/site/app/tests/views/addons/rss/parserss.test.php
new file mode 100644
index 0000000..21d36b7
--- /dev/null
+++ b/site/app/tests/views/addons/rss/parserss.test.php
@@ -0,0 +1,77 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Frederic Wenzel <fwenzel@mozilla.com> (Original Developer)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class ParseRSSTest extends WebTestHelper {
+ var $feeds = array();
+
+ function ParseRSSTest() {
+ $this->WebTestCase("Views->Search->RSS Parsing Tests");
+ $this->feeds = array(
+ '/addons/rss/newest', // @todo needs a page and a uniform feed URL
+ '/recommended/format:rss',
+ '/browse/type:'.ADDON_EXTENSION.'/format:rss',
+ '/browse/type:'.ADDON_THEME.'/format:rss',
+ '/browse/type:'.ADDON_SEARCH.'/format:rss',
+ '/browse/type:'.ADDON_EXTENSION.'/cat:12/format:rss',
+ '/browse/type:'.ADDON_EXTENSION.'/cat:all/format:rss',
+ '/browse/type:'.ADDON_EXTENSION.'/cat:all/sort:name/format:rss',
+ '/browse/type:'.ADDON_EXTENSION.'/cat:all/sort:popular/format:rss',
+ '/browse/type:'.ADDON_EXTENSION.'/cat:all/sort:updated/format:rss',
+ '/browse/type:'.ADDON_EXTENSION.'/cat:all/sort:rated/format:rss',
+ '/browse/type:'.ADDON_EXTENSION.'/cat:all/sort:newest/format:rss',
+ '/addons/versions/7/format:rss',
+ '/reviews/display/7/format:rss',
+ );
+ }
+
+ function setUp() {
+ }
+
+ function testRSSParsing() {
+ // do a simple parse test for all feeds listed above.
+ foreach ($this->feeds as $feed) {
+ $this->getAction($feed);
+ $this->assertWantedPattern("/rss version/", "correct template for ".htmlspecialchars($feed));
+ $this->assertWantedPattern("/<item>/", "some results were found");
+ $this->assertTrue($this->checkXML(), 'XML validation');
+ $this->restart();
+ }
+ }
+}
+
+?>
diff --git a/site/app/tests/views/addons/searchengines.test.php b/site/app/tests/views/addons/searchengines.test.php
new file mode 100644
index 0000000..23e6cff
--- /dev/null
+++ b/site/app/tests/views/addons/searchengines.test.php
@@ -0,0 +1,93 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Frederic Wenzel <fwenzel@mozilla.com> (Original Author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class AddonSearchenginesTest extends WebTestHelper {
+
+ function AddonSearchenginesTest() {
+ $this->WebTestCase("Views->Addons->Searchengines Tests");
+ }
+
+ function setUp() {
+ $this->getAction("/browse/type:".ADDON_SEARCH);
+
+ global $TestController;
+ $this->helper = new UnitTestHelper();
+ $this->controller = $this->helper->getController('Addons', $this);
+ $this->controller->base = $TestController->base;
+ }
+
+ function testRemoraPage() {
+ // just checks if the page works or not
+ $this->assertWantedPattern('/Mozilla Add-ons/i', "pattern detected");
+ }
+
+ function testSearchengines() {
+ // Title
+ $this->title = _('addons_searchengines_pagetitle') .' :: '. sprintf(_('addons_home_pagetitle'), APP_PRETTYNAME);
+ $this->assertTitle($this->title);
+
+ /* // addSearchEngine + correct URLs
+ $pattern = '#window.sidebar.addSearchEngine\([\s]*'
+ .'"'.FULL_BASE_URL.$this->controller->base.'/'.LANG.'/'.APP_SHORTNAME.'/'.FILES_URL.'/'.'"\+fileid\+"/"\+basename\+".src",[\s]*'
+ .'"'.FULL_BASE_URL.$this->controller->base.'/'.LANG.'/'.APP_SHORTNAME.'/images/addon_icon/"\+addonid\+"/"\+basename\+"."\+ext,[\s]*'
+ .'name,[\s]*cat[\s]*\);'
+ .'#m';
+ $this->assertPattern($pattern, htmlentities($pattern)); javascript no longer in source cpollett*/
+
+ /* // two headers
+ $pattern = '#<span>'._('addons_searchengines_title').'</span>#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+ $pattern = '#<h1>'._('addons_searchengines_additional_resources').'</h1>#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+
+ // search engine link
+ $this->assertLink('IMDB', 'IMDB search plugin link');
+
+ // onclick attribute
+ $pattern = '#onclick="addEngine\([^\)]+\); return false;"#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+
+ // additional resources links
+ $pattern = '#<a.*href="http://developer.mozilla.org/.*" >.+</a>#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+ $pattern = '#<a.*href="http://mycroft.mozdev.org/" >.+</a>#';
+ $this->assertPattern($pattern, htmlentities($pattern)); --these checks no longer exist current page cpollett*/
+
+ }
+}
+?>
diff --git a/site/app/tests/views/addons/versions.test.php b/site/app/tests/views/addons/versions.test.php
new file mode 100644
index 0000000..dedff88
--- /dev/null
+++ b/site/app/tests/views/addons/versions.test.php
@@ -0,0 +1,125 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2007
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Frederic Wenzel <fwenzel@mozilla.com> (Original Author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class AddonVersionsTest extends WebTestHelper {
+ var $addonid = null;
+
+ function AddonVersionsTest() {
+ $this->WebTestCase("Views->Addons->Previous Versions Tests");
+ }
+
+ function setUp() {
+ $this->getAction("/addons/versions/{$this->addonid}");
+
+ global $TestController;
+ $this->helper = new UnitTestHelper();
+ $this->controller = $this->helper->getController('Addons', $this);
+ $this->controller->base = $TestController->base;
+
+ // disable query caching so devcp changes are visible immediately
+ foreach ($this->controller->uses as $_model) {
+ $this->controller->$_model->caching = false;
+ }
+
+ }
+}
+
+/**
+ * Tests for a regular, enabled add-on's previous versions page
+ */
+class AddonEnabledVersionsTest extends AddonVersionsTest {
+ var $addonid = 7;
+
+ function testRemoraPage() {
+ // just checks if the page works or not
+ $this->assertWantedPattern('/Mozilla Add-ons/i', "pattern detected");
+ }
+
+ function testRssLink() {
+ // RSS feed linked in header?
+ $pattern = '#<link rel="alternate" type="application/rss\+xml" title="[^"]*" href="[\w\d-_/]*/addons/versions/[\d]+/format:rss">#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+ }
+
+ function testPreviews() {
+ $addon = $this->controller->Addon->findById($this->addonid);
+
+ // "Careful" warning
+ $pattern = '#<h3>'._('addons_versions_careful').'</h3>#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+ $pattern = '#<p>'._('addons_versions_careful_introduction').'</p>#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+
+ // Version strings for all versions
+ foreach ($addon['Version'] as $version) {
+ $pattern = "@<h3>Version " . $version['version'] . ' <span title="' . strftime(_('datetime'), strtotime($version['created'])) . '">&mdash; ' . strftime(_('date'), strtotime($version['created'])) . "</span> &mdash; .*</h3>@";
+ $this->assertPattern($pattern, htmlentities($pattern));
+ }
+
+ // link back
+ $this->assertLink(sprintf(_('addon_review_a_back_to_addon_x'), $addon['Translation']['name']['string']), 'link back to addon page');
+ }
+
+ /**
+ * Test if "version-1.0"-style anchor IDs are present so people can
+ * use it as a permalink to a specific version.
+ */
+ function testPermaLinkAnchors() {
+ $addon = $this->controller->Addon->findById($this->addonid);
+
+ foreach($addon['Version'] as $version) {
+ $pattern = '#<div +[^>]*id="version-'.$version['version'].'"[^>]*>#';
+ $this->assertPattern($pattern, htmlentities($pattern));
+ }
+ }
+}
+
+/**
+ * Tests for a disabled add-on's versions page
+ */
+class AddonDisabledVersionsTest extends AddonVersionsTest {
+ var $addonid = 3716;
+
+ /**
+ * Test if version page is _not_ shown for disabled add-ons
+ */
+ function testDisabledAddonVersionsPage() {
+ $this->assertText(___('error_addon_notfound'), "disabled add-on's versions page");
+ }
+}
+?>
diff --git a/site/app/tests/views/admin/addons_status.test.php b/site/app/tests/views/admin/addons_status.test.php
new file mode 100644
index 0000000..a85d26d
--- /dev/null
+++ b/site/app/tests/views/admin/addons_status.test.php
@@ -0,0 +1,27 @@
+<?php
+
+class AdminAddonsStatusTest extends WebTestHelper {
+
+ function AdminConfigTest() {
+ $this->WebTestCase('Views->Admin->Addons Status Test');
+ }
+
+ function setUp() {
+ $this->login();
+ $this->getAction('/admin/addons?q=[7]');
+ }
+
+ function testRemoraPage() {
+ $this->assertWantedPattern('/Mozilla Add-ons/i', 'pattern detected');
+ $this->assertResponse('200');
+ }
+
+ /**
+ * There should be links for each version of the addon.
+ */
+ function testVersionLinks() {
+ $this->assertLinkLocation('/editors/review/9', '9');
+ $this->assertLinkLocation('/editors/review/1', '1');
+ }
+}
+?>
diff --git a/site/app/tests/views/admin/serverstatus.test.php b/site/app/tests/views/admin/serverstatus.test.php
new file mode 100644
index 0000000..b54d86d
--- /dev/null
+++ b/site/app/tests/views/admin/serverstatus.test.php
@@ -0,0 +1,98 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Mike Morgan <morgamic@mozilla.com> (Original Author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class AdminServerStatusTest extends WebTestHelper {
+
+ function AdminServerStatusTest() {
+ $this->WebTestCase("Views->Admin->Server Status Test");
+
+ loadModel('Memcaching');
+ }
+
+ function setUp() {
+ $this->cache =& new Memcaching();
+
+ $this->login();
+ $this->getAction('/admin/serverstatus/');
+ }
+
+ function testRemoraPage() {
+ $this->assertWantedPattern('/Mozilla Add-ons/i', "pattern detected");
+ $this->assertResponse('200');
+ }
+
+ function testMemcacheStatus() {
+ if (defined('QUERY_CACHE') && QUERY_CACHE) {
+
+ if ($_data = $this->cache->getExtendedStats()) {
+
+ foreach ($_data as $server=>$stats) {
+ $pattern = '#<h3>'.$server.'</h3>#';
+ $this->assertWantedPattern($pattern, htmlentities($pattern));
+
+ if (!empty($stats) && is_array($stats)) {
+ $pattern = '#<li>Gets: [0-9]+</li>#';
+ $this->assertWantedPattern($pattern, htmlentities($pattern));
+
+ $pattern = '#<li>Misses: [0-9]+</li>#';
+ $this->assertWantedPattern($pattern, htmlentities($pattern));
+
+ $pattern = '#<li>Total Gets: [0-9]+</li>#';
+ $this->assertWantedPattern($pattern, htmlentities($pattern));
+
+ $pattern = '#<li>Hit %: [0-9]+.[0-9]+</li>#';
+ $this->assertWantedPattern($pattern, htmlentities($pattern));
+
+ $pattern = '#<li>Quota %: [0-9]+.[0-9]+</li>#';
+ $this->assertWantedPattern($pattern, htmlentities($pattern));
+
+ foreach ($stats as $key=>$val) {
+ $pattern = "/{$key}: [0-9]+/";
+ $this->assertWantedPattern($pattern, htmlentities($pattern));
+ }
+ }
+ }
+ }
+ } else {
+ $pattern = '#<p>Memcache is not enabled \(QUERY_CACHE is false\)\.</p>#';
+ $this->assertWantedPattern($pattern, htmlentities($pattern));
+ }
+ }
+
+}
+?>
diff --git a/site/app/tests/views/developers/add.test.php b/site/app/tests/views/developers/add.test.php
new file mode 100644
index 0000000..504b14f
--- /dev/null
+++ b/site/app/tests/views/developers/add.test.php
@@ -0,0 +1,62 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * Justin Scott <fligtar@gmail.com>.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class DevelopersAddTest extends WebTestHelper {
+
+ function setUp() {
+ //Developer pages require login
+ $this->login();
+
+ $this->getAction('/developers/add/');
+
+ global $TestController;
+ }
+
+ function testRemoraPage() {
+ //just checks if the page works or not
+ $this->assertWantedPattern('/Submit/i', 'Header detected');
+ }
+
+ function testDisplay() {
+ // Title
+ //$this->assertTitle('Edit Add-on');
+
+ //Check fields
+
+ }
+}
+?>
diff --git a/site/app/tests/views/developers/edit.test.php b/site/app/tests/views/developers/edit.test.php
new file mode 100644
index 0000000..bded1f3
--- /dev/null
+++ b/site/app/tests/views/developers/edit.test.php
@@ -0,0 +1,94 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * Justin Scott <fligtar@gmail.com>.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Frederic Wenzel <fwenzel@mozilla.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class DevelopersEditTest extends WebTestHelper {
+ var $id;
+ var $model;
+ var $data;
+ var $de_data;
+
+ function setUp() {
+ //Developer pages require login
+ $this->login();
+
+ $this->id = 7;
+ loadModel('Addon');
+ $this->model =& new Addon();
+ $this->model->id = $this->id;
+ // fetch English and German data
+ $this->model->useLang = 'en-US';
+ $this->data = $this->model->find("Addon.id=$this->id", null , null , 2);
+ unset($this->data['Translation']['developercomments']);
+
+ $this->model->useLang = 'de';
+ $this->de_data = $this->model->find("Addon.id=$this->id", null , null , 2);
+ unset($this->de_data['Translation']['developercomments']);
+
+ $this->getAction("/developers/edit/" . $this->id);
+
+ global $TestController;
+ }
+
+ function testRemoraPage() {
+ //just checks if the page works or not
+ $this->assertWantedPattern('/Edit/i', 'Header detected');
+ }
+
+ function testDisplay() {
+ // Title
+ $this->assertTitle('Developer Tools :: Firefox Add-ons');
+
+ //Check fields
+ $this->assertWantedPattern('/\<option value="12" +selected="selected"\>Organizer\<\/option\>/', 'Tag selected');
+
+ $this->assertText($this->data['User'][0]['firstname'].' '.$this->data['User'][0]['lastname'].' ['.$this->data['User'][0]['email'].']', 'Author populated');
+
+ //Localized fields
+ foreach ($this->data['Translation'] as $field => $translation) {
+ $fieldName = ucwords(strtolower($field));
+ $this->assertFieldById('Addon'.$fieldName.'_en_US', strval($translation['string']), $fieldName.' field (en-US) populated: %s');
+ if ($this->de_data['Translation'][$field]['locale'] == 'de') {
+ $this->assertFieldById('Addon'.$fieldName.'_de', $this->de_data['Translation'][$field]['string'], $fieldName.' field (de) populated: %s');
+ }
+ }
+
+
+
+ }
+}
+?>
diff --git a/site/app/tests/views/developers/editversion.test.php b/site/app/tests/views/developers/editversion.test.php
new file mode 100644
index 0000000..1654b2e
--- /dev/null
+++ b/site/app/tests/views/developers/editversion.test.php
@@ -0,0 +1,84 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * Justin Scott <fligtar@gmail.com>.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class DevelopersEditVersionTest extends WebTestHelper {
+ var $id;
+ var $model;
+
+ function setUp() {
+ //Developer pages require login
+ $this->login();
+
+ $this->id = 1;
+ $this->model =& new Version();
+ $this->model->caching = false; // Make sure caching is off.
+ $this->model->id = $this->id;
+ $this->getAction('/developers/editversion/' . $this->id);
+ }
+
+ function testRemoraPage() {
+ //just checks if the page works or not
+ $this->assertWantedPattern('/Edit/i', 'Header detected');
+ }
+
+ function testDisplay() {
+ // Title
+ $this->assertTitle('Developer Tools :: Firefox Add-ons', 'Title populated: %s');
+
+ //Check fields
+ $this->model->useLang = 'en-US';
+ $this->data = $this->model->find("Version.id={$this->id}", null , null , 2);
+ $this->assertFieldByName('data[Version][releasenotes][en-US]', htmlentities($this->data['Translation']['releasenotes']['string']),
+ 'Version Notes (en-US) field populated: %s');
+
+ $this->model->useLang = 'de';
+ $this->data = $this->model->find("Version.id={$this->id}", null , null , 2);
+ $this->assertFieldByName('data[Version][releasenotes][de]', htmlentities($this->data['Translation']['releasenotes']['string']),
+ 'Version Notes (de) field populated: %s');
+
+ $this->assertField('data[Version][approvalnotes]', $this->data['Version']['approvalnotes'], 'Version Approval Notes field populated: %s');
+
+ $this->assertText($this->data['File'][0]['size'].' KB', 'File size listing detected');
+
+ phpQuery::newDocument($this->_browser->getContent());
+ $platform = pq('#files-table option:first');
+ $this->assertAttrs($platform, array('value' => 1, 'selected' => 'selected'),
+ 'ALL platform is selected: %s');
+ $this->assertEqual($platform->text(), 'ALL', 'ALL platform is selected: %s');
+ }
+}
+?>
diff --git a/site/app/tests/views/developers/index.test.php b/site/app/tests/views/developers/index.test.php
new file mode 100644
index 0000000..784947f
--- /dev/null
+++ b/site/app/tests/views/developers/index.test.php
@@ -0,0 +1,69 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * Justin Scott <fligtar@gmail.com>.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class DevelopersIndexTest extends WebTestHelper {
+
+ function setUp() {
+ //Developer pages require login
+ $this->login();
+
+ $this->getAction("/developers/index/");
+
+ global $TestController;
+ }
+
+ function testRemoraPage() {
+ //just checks if the page works or not
+ $this->assertWantedPattern('/My Add-ons/i', 'Header detected');
+ }
+
+ function testDisplay() {
+ // Title
+ //$this->assertTitle('Edit Add-on');
+
+ //Check fields
+ //$this->assertLink('Version 1.02a', 'Version link found: %s');
+
+ }
+
+ /* function testPreviews() {
+ $this->assertLink("Add Preview", "link to add preview");
+ $pattern = '|editpreview/7/1"[^>]*><img src="' . $this->actionPath("/images/addon_preview/7/1") . '">|';
+ $this->assertPattern($pattern, "show preview image inline with link to edit");
+ }*/
+}
+?>
diff --git a/site/app/tests/views/elements/install.test.php b/site/app/tests/views/elements/install.test.php
new file mode 100644
index 0000000..c4d10ff
--- /dev/null
+++ b/site/app/tests/views/elements/install.test.php
@@ -0,0 +1,91 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Andrei Hajdukewycz <sancus@off.net> (Original Author)
+ *
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class InstallTest extends WebTestHelper {
+
+ function InstallTest() {
+ $this->WebTestCase("Views->Elements->Install Element Tests");
+ }
+
+ function setUp() {
+ $this->id = 7;
+ $this->actionPath = $this->actionPath("");
+ loadModel('Addon');
+ $model =& new Addon();
+ $model->caching = false;
+ $this->data = $model->find("Addon.id=$this->id", null , null , 2);
+ }
+
+ function testDisplayInstall() {
+ //get display page and test eula link
+ $this->getAction("/addon/" . $this->id);
+ $installMessage = sprintf(_('a_install'), "", "");
+ if (!empty($this->data['Translation']['eula']['string'])) {
+ // install link
+ $this->wantedPattern = "@<p class=\"install-button platform-ALL\">\s*<a href=\"{$this->actionPath}/@";
+ /* suspect action not quite right for this test to work as originally was below:
+ /downloads/file/{$this->id}/[^\"]+\" +id=\"installTrigger\d+\" +addonName=\"[^\"]+\"[^>]*><span><span><span><strong>Accept and Install</strong></span></span></span></a></p>*/
+ $this->assertWantedPattern($this->wantedPattern, htmlentities($this->wantedPattern));
+ // anti-xss platform link script
+ $this->wantedPattern = "@<script type=\"text/javascript\">setTimeout\(function\(\) {fixPlatformLinks\('\d+', document.getElementById\('installTrigger\d+'\).getAttribute\('addonName'\)\);addCompatibilityHints\([^)]+\);},0\);</script>@";
+ $this->assertWantedPattern($this->wantedPattern, htmlentities($this->wantedPattern));
+ }
+
+ // test remaining things on the policy page
+ $this->getAction("/addons/policy/0/{$this->id}/{$this->data['Version'][0]['File'][0]['id']}");
+ $installMessage = _('a_eula_install');
+
+ //test filenames matches with database
+ $this->wantedPattern = "@<a href=\"{$this->actionPath}/downloads/latest/{$this->id}/addon-{$this->id}-latest.xpi\"@";
+ $this->assertWantedPattern($this->wantedPattern, "install url matches: ".htmlentities($this->wantedPattern));
+
+ //test add-on name matches in install trigger
+ $this->wantedPattern = "@addonName=\"{$this->data['Translation']['name']['string']}\"@";
+ $this->assertWantedPattern($this->wantedPattern, "Add-on name matches: {$this->data['Translation']['name']['string']}");
+
+ //test add-on icon link for install trigger
+ $this->wantedPattern = "@addonIcon=\"{$this->actionPath}/images/addon_icon/{$this->id}/\d{10}\"@";
+ $this->assertWantedPattern($this->wantedPattern, htmlentities($this->wantedPattern));
+
+ //test add-on hash matches with db @TODO: Download file and verify hash
+ $this->wantedPattern = "@addonHash=\"{$this->data['Version'][0]['File'][0]['hash']}\"@";
+ $this->assertWantedPattern($this->wantedPattern, "Addon Hash Match: {$this->data['Version'][0]['File'][0]['hash']}");
+ }
+}
+?>
diff --git a/site/app/tests/views/helpers/addons_html.test.php b/site/app/tests/views/helpers/addons_html.test.php
new file mode 100644
index 0000000..a6fa122
--- /dev/null
+++ b/site/app/tests/views/helpers/addons_html.test.php
@@ -0,0 +1,118 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * Frederic Wenzel <fwenzel@mozilla.com>
+ *
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class AddonsHtmlHelperTest extends UnitTestCase {
+
+ var $html = null; // the helper
+
+ function setUp() {
+
+
+ static $tags;
+ loadHelper('AddonsHtml');
+ loadModel('Addon');
+ $this->Addon = new Addon();
+ $this->html =& new AddonsHtmlHelper();
+ $this->html->webroot = '';
+ $this->html->here = '';
+ $this->html->base = 'http://example.com/mybase';
+ $this->html->plugin = '';
+ $this->html->params = array('controller' => 'controller');
+ if (empty($tags)) $tags = $this->html->loadConfig();
+ $this->html->tags = $tags;
+ }
+
+ function tearDown() {
+ unset($this->html);
+ }
+
+ /**
+ * is link generated with locale?
+ */
+ function testLinkLocale() {
+ $expected = '!<a href="http://example.com/mybase/'.LANG.'/'.APP_SHORTNAME.'/browse"( )*>foo</a>!';
+ $result = $this->html->link('foo', '/browse');
+ $this->assertTrue(preg_match($expected, $result), 'link generation with locale');
+ }
+
+ /**
+ * is link generated without locale?
+ */
+ function testLinkNoLocale() {
+ $expected = '!<a href="http://example.com/mybase/'.APP_SHORTNAME.'/browse"( )*>foo</a>!';
+ $result = $this->html->linkNoLocale('foo', '/browse');
+ $this->assertTrue(preg_match($expected, $result), 'link generation without locale');
+ }
+
+ /**
+ * is link generated without locale and app?
+ */
+ function testLinkNoLocaleNoApp() {
+ $expected = '!<a href="http://example.com/mybase/browse"( )*>foo</a>!';
+ $result = $this->html->linkNoLocaleNoApp('foo', '/browse');
+ $this->assertTrue(preg_match($expected, $result), 'link generation without locale or app');
+ }
+
+ /**
+ * sanitized strings can be reverted
+ */
+ function testUnsanitize() {
+ $test = '&lt;a href=&quot;addons.mozilla.org&quot;&gt;Mozilla&#039;s addon website &#40;AMO&#41;&lt;/a&gt;. &#43;/&#45;3.1&#37;. &amp;amp;';
+ $expected = '<a href="addons.mozilla.org">Mozilla\'s addon website (AMO)</a>. +/-3.1%. &amp;';
+ $result = $this->html->unsanitize($test);
+ $this->assertEqual($expected, $result, 'sanitized strings can be reverted');
+ }
+
+ function testTruncate() {
+ $this->assertEqual('abc', $this->html->truncateChars(5, 'abc'));
+ $this->assertEqual('abcde', $this->html->truncateChars(5, 'abcde'));
+ $this->assertEqual('ab...', $this->html->truncateChars(5, 'abcdef'));
+ }
+
+ /**
+ * Tests that an addon that has the addons_tags.feature = 1 is shown as featured
+ */
+ function testRecommendedFlag() {
+ $addon = $this->Addon->getListAddons(4021, array(STATUS_PUBLIC), '', true);
+ $addon = $addon[0];
+ $result = $this->html->flag($addon);
+ phpQuery::newDocument($result);
+ $this->assertEqual(pq('h5.flag a')->text(), 'recommended', 'Category recommended and recommended addons are flagged as recommended');
+ }
+}
+?>
diff --git a/site/app/tests/views/helpers/localization.test.php b/site/app/tests/views/helpers/localization.test.php
new file mode 100644
index 0000000..1ccb4a1
--- /dev/null
+++ b/site/app/tests/views/helpers/localization.test.php
@@ -0,0 +1,53 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * Wil Clouser <clouserw@mozilla.com>
+ *
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class LocalizationHelperTest extends UnitTestCase {
+
+
+ function setUp() {
+
+ loadHelper('Localization');
+
+ }
+
+ function testJsLocalization() {
+
+ }
+
+}
+?>
diff --git a/site/app/tests/views/helpers/statistics.test.php b/site/app/tests/views/helpers/statistics.test.php
new file mode 100644
index 0000000..11753f8
--- /dev/null
+++ b/site/app/tests/views/helpers/statistics.test.php
@@ -0,0 +1,66 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * Jeff Balogh <jbalogh@mozilla.com>
+ *
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class StatisticsHelperTest extends UnitTestCase {
+
+ function setUp() {
+ loadHelper('Statistics');
+ $this->statistics =& new StatisticsHelper();
+ }
+
+ function _span($color, $number) {
+ return "<span style='color: {$color}'>".$number."</span>";
+ }
+
+ function test_colored_percentage() {
+ $key = 'num';
+ $a[$key] = 1.233;
+ $this->assertEqual($this->statistics->colored_percentage($a, $key),
+ $this->_span('green', '+1.23%'));
+ $a[$key] = -1.233;
+ $this->assertEqual($this->statistics->colored_percentage($a, $key),
+ $this->_span('red', '-1.23%'));
+ $a[$key] = 0;
+ $this->assertEqual($this->statistics->colored_percentage($a, $key),
+ '0');
+
+ $this->assertEqual($this->statistics->colored_percentage($a, 'invalid'),
+ '0');
+ }
+}
+?>
diff --git a/site/app/tests/views/images/show.test.php b/site/app/tests/views/images/show.test.php
new file mode 100644
index 0000000..ba41ac7
--- /dev/null
+++ b/site/app/tests/views/images/show.test.php
@@ -0,0 +1,116 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Wil Clouser <wclouser@mozilla.com> (Original Author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class ImageViewTest extends WebTestHelper {
+
+
+ function ImageTest() {
+ $this->WebTestCase("Views->Image->Show Tests");
+ }
+
+ function imageVerify($url, $mimetype) {
+ $this->get($url);
+ $this->assertResponse('200');
+ $imageinfo = getimagesize($url);
+ $imagetype = image_type_to_mime_type($imageinfo[2]);
+ $this->assertMime($mimetype);
+ }
+ function testAddonIconValid() {
+ $model =& new Addon();
+ $model->caching = false;
+ $id=7;//$_GET['id'];
+
+ $data = $model->find("Addon.id=$id", array('icontype'), null , 2);
+ $mimetype = $data['Addon']['icontype'];
+ $url = $this->actionURI("/images/addon_icon/" . $id);
+
+ $this->imageVerify($url, $mimetype);
+ }
+ function testPreviewValid() {
+ $model =& new Addon();
+ $model->bindFully();
+ $model->caching = false;
+ $id=7;//$_GET['id'];
+
+ $data = $model->find("Addon.id=$id", null , null , 2);
+ $mimetype = $data['Preview'][0]['thumbtype'];
+ $url = $this->actionURI("/images/addon_preview/$id/1");
+
+ $this->imageVerify($url, $mimetype);
+ }
+
+ function xfail_testPreviewLargeValid() {
+ $model =& new Addon();
+ $model->bindFully();
+ $model->caching = false;
+ $id=7;//$_GET['id'];
+
+ $data = $model->find("Addon.id=$id", null , null , 2);
+ $filename = $data['Preview'][0]['filename'];
+ $mimetype = $data['Preview'][0]['filetype'];
+ $url = $this->actionURI("/images/preview/" . $filename);
+
+ $this->imageVerify($filename, $url, $mimetype);
+ }
+ function xfail_testApplicationIconValid() {
+ $model =& new Application();
+ $model->caching = false;
+ $id=7;//$_GET['id'];
+
+ $data = $model->find("Application.id=$id", null , null , 2);
+ $filename = $data['Application']['icon'];
+ $mimetype = $data['Application']['icontype'];
+ $url = $this->actionURI("/images/application_icon/" . $filename);
+
+ $this->imageVerify($filename, $url, $mimetype);
+ }
+ function xfail_testPlatformIconValid() {
+ $model =& new Platform();
+ $model->caching = false;
+ $id=7;//$_GET['id'];
+
+ $data = $model->find("Platform.id=$id", null , null , 2);
+ $filename = $data['Platform']['icon'];
+ $mimetype = $data['Platform']['icontype'];
+ $url = $this->actionURI("/images/platform_icon/" . $filename);
+
+ $this->imageVerify($filename, $url, $mimetype);
+ }
+
+}
+?>
diff --git a/site/app/tests/views/reviews/add.test.php b/site/app/tests/views/reviews/add.test.php
new file mode 100644
index 0000000..86ccaba
--- /dev/null
+++ b/site/app/tests/views/reviews/add.test.php
@@ -0,0 +1,75 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Frederic Wenzel <fwenzel@mozilla.com> (Original Author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class ReviewsAddTest extends WebTestHelper {
+
+ function ReviewsAddTest() {
+ $this->WebTestCase("Views->Reviews->Add Reviews Test");
+ }
+
+ function setUp() {
+ $this->login(); // logged in users only
+
+ $this->id = 7;
+ $model =& new Addon();
+ $model->id = $this->id;
+ $this->data = $model->find("Addon.id=$this->id", null , null , 2);
+ $this->getAction("/reviews/add/" . $this->id);
+ }
+
+ function testRemoraPage() {
+ //just checks if the page works or not
+ $this->assertWantedPattern('/Mozilla Add-ons/i', "pattern detected");
+ }
+
+ function testReviews() {
+ // Title
+ $this->title = sprintf(_('addon_review_pagetitle'), $this->data['Translation']['name']['string']).' :: '.sprintf(_('addons_home_pagetitle'), APP_PRETTYNAME);
+ $this->assertTitle($this->title);
+
+ // add review form
+ $myPattern = '#<form action="[^"]+reviews/add/'.$this->id.'[^"]*" method="post" [^>]+>#';
+ $this->assertWantedPattern($myPattern, htmlentities($myPattern));
+
+ // submit button
+ $myPattern = '#<input type="submit" class="amo-submit" value="'._('addon_review_add_submit').'" >#';
+ $this->assertWantedPattern($myPattern, htmlentities($myPattern));
+ }
+
+}
+?>
diff --git a/site/app/tests/views/reviews/display.test.php b/site/app/tests/views/reviews/display.test.php
new file mode 100644
index 0000000..60f6190
--- /dev/null
+++ b/site/app/tests/views/reviews/display.test.php
@@ -0,0 +1,75 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Frederic Wenzel <fwenzel@mozilla.com> (Original Author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class AddonReviewsTest extends WebTestHelper {
+
+ function AddonReviewsTest() {
+ $this->WebTestCase("Views->Addons->Reviews Test");
+ }
+
+ function setUp() {
+ $this->id = 7;
+ $model =& new Addon();
+ $model->id = $this->id;
+ $this->data = $model->find("Addon.id=$this->id", null , null , 2);
+ $this->getAction("/reviews/display/" . $this->id);
+ }
+
+ function testRemoraPage() {
+ //just checks if the page works or not
+ $this->assertWantedPattern('/Mozilla Add-ons/i', "pattern detected");
+ }
+
+ function testReviews() {
+ // Title
+ $this->title = sprintf(_('addon_review_pagetitle'), $this->data['Translation']['name']['string']).' :: '.sprintf(_('addons_home_pagetitle'), APP_PRETTYNAME);
+ $this->assertTitle($this->title);
+
+ // Header
+ $myPattern = '#<h1>Reviews for MicroFarmer</h1>#';
+ $this->assertWantedPattern($myPattern, htmlentities($myPattern));
+
+ // single review
+ $myPattern = '#<h3>Fine, just fine.</h3>#';
+ $this->assertWantedPattern($myPattern, htmlentities($myPattern));
+ $myPattern = '#It works but not well.#';
+ $this->assertWantedPattern($myPattern, htmlentities($myPattern));
+ }
+
+}
+?>
diff --git a/site/app/tests/views/search/index.test.php b/site/app/tests/views/search/index.test.php
new file mode 100644
index 0000000..5197c4c
--- /dev/null
+++ b/site/app/tests/views/search/index.test.php
@@ -0,0 +1,57 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Mike Shaver <shaver@mozilla.org> (Original Author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class SearchResultTest extends WebTestHelper {
+
+ function SearchResultTest() {
+ $this->WebTestCase("Views->Search->Results Display Tests");
+ }
+
+ function testBasicResults() {
+ $this->getAction("/search/?q=the");
+ $this->assertNoUnwantedPattern("/"._('search_nothing_found')."/", "No results found.");
+ $this->assertFieldById('query', 'the', "previous query pre-populated");
+ }
+
+ function testUTF8Exploit() {
+ $this->getAction("/search?q=%C0%22%20onmouseover=alert(/xss/.source)%20\&cat=all");
+ $this->assertWantedPattern('/&quot; onmouseover=alert&#40;\/xss\/\.source&#41; \\\\/i', 'UTF-8 exploit not found');
+ }
+}
+
+?>
diff --git a/site/app/tests/views/search/rss/index.test.php b/site/app/tests/views/search/rss/index.test.php
new file mode 100644
index 0000000..397853f
--- /dev/null
+++ b/site/app/tests/views/search/rss/index.test.php
@@ -0,0 +1,57 @@
+<?php
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is addons.mozilla.org site.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Frederic Wenzel <fwenzel@mozilla.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+class SearchRSSTest extends WebTestHelper {
+
+ function SearchRSSTest() {
+ $this->WebTestCase("Views->Search->Search RSS Tests");
+ }
+
+ function setUp() {
+ $this->getAction("/search/rss/?q=the");
+ }
+
+ function testRSSResults() {
+ $this->assertWantedPattern("/rss version/", "correct template");
+
+ $this->assertWantedPattern("/<item>/", "some results were found");
+ $this->assertTrue($this->checkXML(), 'XML validation');
+ }
+}
+
+?>
diff --git a/site/app/tests/views/users/pwreset.test.php b/site/app/tests/views/users/pwreset.test.php
new file mode 100644
index 0000000..d0c5c0f
--- /dev/null
+++ b/site/app/tests/views/users/pwreset.test.php
@@ -0,0 +1,32 @@
+<?php
+
+class PwresetTest extends WebTestHelper {
+
+ function PwresetTest() {
+ $this->WebTestCase("Views->Users->pwreset Tests");
+ }
+
+ function setUp() {
+ $this->helper = new UnitTestHelper();
+ $this->controller = $this->helper->getController('Users', $this);
+
+ $id = 5;
+ $this->resetcode = $this->controller->User->setResetCode($id);
+ $this->getAction("/users/pwreset/{$id}/".$this->resetcode);
+ }
+
+ function testRemoraPage() {
+ // just checks if the page works or not
+ $this->assertWantedPattern('/Mozilla Add-ons/i', "pattern detected");
+ }
+
+ function testEmbeddedResetCode() {
+ $this->assertNoPattern("@users/login\?to=.*{$this->resetcode}@", 'Embedded in login link?');
+ $this->assertNoPattern("@advanced-search-toggle.*{$this->resetcode}@", 'Embedded in advanced search toggle?');
+ }
+
+ function testCacheHeader() {
+ $this->assertHeader('Cache-Control', 'no-store, must-revalidate, post-check=0, pre-check=0, private, max-age=0');
+ $this->assertHeader('Pragma', 'private');
+ }
+}