<?php
-# Copyright (c) 2006, Sebastian Nohn (on behalf the Serendipity Developer Team)
+# Copyright (c) 2006-2007, Sebastian Nohn and Sebastian Bergmann
+# (on behalf the Serendipity Developer Team)
# All rights reserved. See LICENSE file for licensing details
ini_set('display_errors', 1);
+define('IN_serendipity', TRUE);
-require_once 'PHPUnit/Framework/TestCase.php';
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
-require_once 'TestConfiguration.php';
-
-require_once '../../lang/serendipity_lang_'.S9Y_LANG.'.inc.php';
-require_once '../../plugins/serendipity_event_spamblock/lang_'.S9Y_LANG.'.inc.php';
-
-class SerendipityTestSuite extends PHPUnit_Extensions_SeleniumTestCase
+class FrontendTest extends PHPUnit_Extensions_SeleniumTestCase
{
public function setUp()
{
- if (!SELENIUM_ENABLED) {
+ if (!isset($GLOBALS['S9Y_SELENIUM_ENABLED']) || !$GLOBALS['S9Y_SELENIUM_ENABLED']) {
$this->markTestSkipped(
'The Selenium tests are disabled.'
);
}
- if (!class_exists('Testing_Selenium')) {
- $this->markTestSkipped(
- 'The PHP bindings for Selenium RC are not installed.'
- );
- }
-
- $this->setHost(SELENIUM_HOST);
- $this->setPort(SELENIUM_PORT);
- $this->setBrowser(SELENIUM_BROWSER);
- $this->setBrowserUrl(S9Y_INSTALLDIR);
+ $this->setHost($GLOBALS['S9Y_SELENIUM_HOST']);
+ $this->setPort((int)$GLOBALS['S9Y_SELENIUM_PORT']);
+ $this->setBrowser($GLOBALS['S9Y_SELENIUM_BROWSER']);
+ $this->setBrowserUrl($GLOBALS['S9Y_INSTALLDIR']);
$this->setTimeout(10000);
+
+ $this->coverageScriptUrl = $GLOBALS['S9Y_INSTALLDIR'] .
+ '/phpunit_coverage.php';
+
+ require_once '../lang/serendipity_lang_' .
+ $GLOBALS['S9Y_LANG'] . '.inc.php';
+ require_once '../plugins/serendipity_event_spamblock/lang_' .
+ $GLOBALS['S9Y_LANG'] . '.inc.php';
}
public function testExpertInstallation()
{
- $this->open(S9Y_INSTALLDIR);
+ $this->open($GLOBALS['S9Y_INSTALLDIR']);
$this->assertTextNotPresent(NOT_WRITABLE);
$this->clickAndWait('link='.EXPERT_INSTALLATION);
$this->select('dbType', 'SQLite');
$this->type('user', 'Test User');
$this->type('pass', 'Test Password');
$this->check('radio_cfg_want_mail_no');
- $this->select('rewrite', 'Use Apache mod_rewrite');
$this->type('blogTitle', 's9y Testsuite Testblog');
$this->type('blogDescription', 'The lalaforce is coming to get you!');
$this->clickAndWait("//input[@value='".COMPLETE_INSTALLATION."']");
$this->assertTextPresent(SERENDIPITY_INSTALLED);
}
- public function testLoginLogout()
+ public function testBadLogin()
{
- $this->open(S9Y_INSTALLDIR);
+ $this->open($GLOBALS['S9Y_INSTALLDIR']);
$this->assertTitleEquals('s9y Testsuite Testblog');
$this->assertTextPresent(SUPERUSER);
$this->assertTextPresent(PLEASE_ENTER_CREDENTIALS);
$this->assertTextPresent(WRONG_USERNAME_OR_PASSWORD);
+ }
+
+ public function testLoginLogout()
+ {
+ $this->open($GLOBALS['S9Y_INSTALLDIR']);
+
+ $this->assertTitleEquals('s9y Testsuite Testblog');
+ $this->assertTextPresent(SUPERUSER);
+ $this->clickAndWait('link='.SUPERUSER_OPEN_LOGIN);
+
+ $this->assertTextPresent(PLEASE_ENTER_CREDENTIALS);
$this->type('serendipity[user]', 'Test User');
$this->type('serendipity[pass]', 'Test Password');
$this->clickAndWait('submit');
}
public function testCreateContentCategory() {
- $this->open(S9Y_INSTALLDIR);
+ $this->open($GLOBALS['S9Y_INSTALLDIR']);
$this->assertTitleEquals('s9y Testsuite Testblog');
$this->assertTextPresent(SUPERUSER);
$this->assertTextPresent('Test Category 001-1');
-# The Sub-Sub-Category-Test is blocked by http://pear.php.net/bugs/bug.php?id=9189
-#
-# $this->clickAndWait('link='.CREATE_NEW_CAT);
-#
-# $this->assertTextPresent(CREATE_NEW_CAT);
-# $this->select('parent_cat', ' Test Category 001-1');
-# $this->type('serendipity[cat][name]', 'Test Category 001-1-1');
-# $this->type('serendipity[cat][description]', 'This is the description for Test Category 001-1-1');
-# $this->clickAndWait('SAVE');
-#
-# $this->assertTextPresent('Test Category 001-1-1');
+ $this->markTestIncomplete('Blocked by blocked by http://pear.php.net/bugs/bug.php?id=9189.');
+
+ $this->clickAndWait('link='.CREATE_NEW_CAT);
+
+ $this->assertTextPresent(CREATE_NEW_CAT);
+ $this->select('parent_cat', ' Test Category 001-1');
+ $this->type('serendipity[cat][name]', 'Test Category 001-1-1');
+ $this->type('serendipity[cat][description]', 'This is the description for Test Category 001-1-1');
+ $this->clickAndWait('SAVE');
+
+ $this->assertTextPresent('Test Category 001-1-1');
}
public function testCreateSimpleArticle() {
- $this->open(S9Y_INSTALLDIR);
+ $this->open($GLOBALS['S9Y_INSTALLDIR']);
$this->assertTitleEquals('s9y Testsuite Testblog');
$this->assertTextPresent(SUPERUSER);
$this->clickAndWait("//input[@value='- ".SAVE." -']");
$this->assertTextPresent(IFRAME_SAVE);
+
+ $this->markTestIncomplete('Popup needs to be taken care of.');
+
$this->clickAndWait('link='.VIEW);
$this->assertTitleEquals('Test Entry 001 - s9y Testsuite Testblog');
$this->assertTextPresent('Test Body');
+
$this->clickAndWait('link='.EDIT_ENTRY);
$this->assertTextPresent(ENTRY_BODY);
}
public function testComment() {
- $this->open(S9Y_INSTALLDIR);
+ $this->open($GLOBALS['S9Y_INSTALLDIR']);
$this->assertTitleEquals('s9y Testsuite Testblog');
$this->assertTextPresent('Test Entry 001');
$this->clickAndWait('link=Test Entry 001');
$this->assertTitleEquals('Test Entry 001 - s9y Testsuite Testblog');
- $this->assertTextPresent('New Test Body');
+ // Change to "New Test Body" when testCreateSimpleArticle() is fixed.
+ $this->assertTextPresent('Test Body');
$this->assertTextPresent(ADD_COMMENT);
$this->clickAndWait("//input[@value='".SUBMIT_COMMENT."']");
}
public function testCreateUser() {
- $this->open(S9Y_INSTALLDIR);
+ $this->open($GLOBALS['S9Y_INSTALLDIR']);
$this->assertTitleEquals('s9y Testsuite Testblog');
$this->assertTextPresent(SUPERUSER);