Skip to content

Commit

Permalink
Merge pull request #527 from norv/unittest
Browse files Browse the repository at this point in the history
Unit testing
  • Loading branch information
norv committed Jun 16, 2013
2 parents e03fe11 + ea46150 commit 0fd7f3f
Show file tree
Hide file tree
Showing 138 changed files with 44,543 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/all_tests.php
@@ -0,0 +1,42 @@
<?php

define('TESTDIR', dirname(__FILE__) . '/');

require_once('simpletest/autorun.php');

// SSI mode should work for most tests. (core and subs)
// For web tester tests, it should not be necessary.
// For install/upgrade, if we even can test those, SSI is a no-no.
// Might wanna make two or three different suites.
require_once('../SSI.php');

/**
* All tests suite. This suite adds all files/classes/folders currently
* being tested.
*
* To run all tests, execute php all_tests.php in tests directory
* Or, scripturl/tests/all_tests.php
*/
class AllTests extends TestSuite
{
function AllTests()
{
$this->TestSuite('All tests');

// controllers (web tests)
$this->addFile('sources/controllers/TestAuth.php');

// admin controllers (web tests)
$this->addFile('sources/admin/TestManageBoardsSettings.php');
$this->addFile('sources/admin/TestManagePostsSettings.php');

// install
$this->addFile('install/TestInstall.php');

// core sources
$this->addFile('sources/TestLogging.php');

// subs APIs
$this->addFile('sources/subs/TestBoards.subs.php');
}
}
29 changes: 29 additions & 0 deletions tests/install/TestInstall.php
@@ -0,0 +1,29 @@
<?php

require_once(TESTDIR . 'simpletest/autorun.php');
require_once(TESTDIR . 'simpletest/web_tester.php');
// require_once('../install/install.php');

/**
* TestCase class for installer script
*/
class TestInstall extends WebTestCase
{
function setUp()
{
global $scripturl;

// it'd be kinda difficult without this :P
$this->scripturl = $scripturl;
}

function testWelcome()
{
$this->get(substr($this->scripturl, 0, -9) . '/install.php');
$this->assertTitle('ELKARTE Installer');
$this->assertText('Welcome to ELKARTE. This script will guide you through the process for installing');

// Mmm...
$this->assertText('continuing with installation may result in the loss or corruption of existing data.');
}
}

0 comments on commit 0fd7f3f

Please sign in to comment.