Last active
August 29, 2015 14:01
-
-
Save jlainezs/9b8f88211aac8ccd786b to your computer and use it in GitHub Desktop.
Unit test configuration for the administration side of a Joomla! component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(E_ALL); | |
define('_JEXEC', 1); | |
define('JPATH_BASE','*** where is joomla installed ? ***'); | |
define('JOOMLA_ADMIN', JPATH_BASE . 'administrator'); // want to test admin side | |
$_SERVER['HTTP_HOST'] = 'localhost'; | |
$_SERVER['REQUEST_METHOD'] = 'GET'; | |
include_once JOOMLA_ADMIN . '/includes/defines.php'; | |
require_once JPATH_ADMINISTRATOR . '/includes/framework.php'; | |
$app = JFactory::getApplication('administrator'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<phpunit bootstrap="bootstrap.php" | |
colors="true" | |
convertErrorsToExceptions="true" | |
convertNoticesToExceptions="true" | |
convertWarningsToExceptions="true" | |
processIsolation="false" | |
stopOnFailure="false" | |
syntaxCheck="false" | |
verbose="true"> | |
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SampleTest extends \PHPUnit_Framework_TestCase { | |
public function thisIsASample(){ | |
JModelLegacy::addIncludePath("*** WHERE TO LOOK FOR MODELS? **** "); | |
$model = JModelLegacy::getInstance('*** A MODEL ***','*** THE PREFIX ***'); | |
$someVar = $model->someMethod(); | |
$this->assertNotEmpty($someVar); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Execute using:
$ phpunit .
(Note the DOT at the end of line)