コード例 #1
0
 public static function setUpBeforeClass()
 {
     require_once JUnitHelper::normalize(dirname(__FILE__)) . '/JFilterInput-mock-general.php';
     $filter =& JFilterInput::getInstance();
     self::$filter = JFilterInput::getInstance();
     $filter = new JFilterInputJRequest();
 }
コード例 #2
0
 /**
  * @todo Implement testLoadAllAdapters().
  */
 public function testLoadAllAdapters()
 {
     require_once JPATH_PLATFORM . '/joomla/base/adapterinstance.php';
     $this->object = new JAdapter(JUnitHelper::normalize(dirname(__FILE__)), 'Test', 'TestAdapters');
     $this->object->loadAllAdapters();
     $this->assertThat($this->object->getAdapter('Testadapter4'), $this->isInstanceOf('TestTestadapter4'));
 }
コード例 #3
0
 /**
  * Test case for loadFile
  *
  * @return array
  */
 function casesLoadFile()
 {
     return array('good' => array(JUnitHelper::normalize(dirname(__FILE__)) . '/TestStubs/xmlFile.xml', true, 'JSimpleXMLElement'), 'bad' => array(JUnitHelper::normalize(dirname(__FILE__)) . '/TestStubs/fred.xml', false, null), 'empty' => array(JUnitHelper::normalize(dirname(__FILE__)) . '/TestStubs/empty.xml', false, null));
 }
コード例 #4
0
ファイル: bootstrap.php プロジェクト: nibra/joomla-platform
 * @link        http://www.phpunit.de/manual/current/en/installation.html
 */
define('_JEXEC', 1);
// Load the custom initialisation file if it exists.
if (file_exists('config.php')) {
    include 'config.php';
}
// Include helper class
require_once dirname(__FILE__) . '/includes/JUnitHelper.php';
// Define expected Joomla constants.
define('DS', '/');
if (!defined('JPATH_BASE')) {
    // JPATH_BASE can be defined in init.php
    // This gets around problems with soft linking the unittest folder into a Joomla tree,
    // or using the unittest framework from a central location.
    define('JPATH_BASE', JUnitHelper::normalize(dirname(__FILE__)) . '/test_application');
}
if (!defined('JPATH_TESTS')) {
    define('JPATH_TESTS', dirname(__FILE__));
}
//// Fix magic quotes.
@ini_set('magic_quotes_runtime', 0);
// Maximise error reporting.
@ini_set('zend.ze1_compatibility_mode', '0');
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Include the base test cases.
require_once JPATH_TESTS . '/includes/JoomlaTestCase.php';
require_once JPATH_TESTS . '/includes/JoomlaDatabaseTestCase.php';
// Include relative constants, JLoader and the jimport and jexit functions.
require_once JPATH_BASE . '/defines.php';
コード例 #5
0
 /**
  * Test the JRegistry::loadFile method.
  */
 public function testLoadFile()
 {
     $registry = new JRegistry();
     // Result is always true, no error checking in method.
     // JSON.
     $result = $registry->loadFile(JUnitHelper::normalize(dirname(__FILE__)) . '/TestStubs/jregistry.json');
     // Test getting a known value.
     $this->assertThat($registry->get('foo'), $this->equalTo('bar'), 'Line: ' . __LINE__ . '.');
     // INI.
     $result = $registry->loadFile(JUnitHelper::normalize(dirname(__FILE__)) . '/TestStubs/jregistry.ini', 'ini');
     // Test getting a known value.
     $this->assertThat($registry->get('foo'), $this->equalTo('bar'), 'Line: ' . __LINE__ . '.');
     // INI + section.
     $result = $registry->loadFile(JUnitHelper::normalize(dirname(__FILE__)) . '/TestStubs/jregistry.ini', 'ini', array('processSections' => true));
     // Test getting a known value.
     $this->assertThat($registry->get('section.foo'), $this->equalTo('bar'), 'Line: ' . __LINE__ . '.');
     // XML and PHP versions do not support stringToObject.
 }
コード例 #6
0
 /**
  * @todo Decide how to Implement.
  */
 public function testGetParent()
 {
     $this->object = new JAdapter(JUnitHelper::normalize(dirname(__FILE__)), 'Test', 'TestAdapters');
     $this->assertThat($this->object->getAdapter('Testadapter3')->getParent(), $this->identicalTo($this->object));
 }