/**
  * Overrides the parent tearDown method.
  *
  * @return  void
  *
  * @see     PHPUnit_Framework_TestCase::tearDown()
  */
 protected function tearDown()
 {
     // Reset the filter instances.
     TestReflection::setValue('JFilterInput', 'instances', array());
     $this->restoreFactoryState();
     parent::tearDown();
 }
Esempio n. 2
0
 /**
  * Tears down the fixture, for example, closes a network connection.
  * This method is called after a test is executed.
  *
  * @return  void
  *
  * @since   3.1
  */
 protected function tearDown()
 {
     $_SERVER = $this->backupServer;
     unset($this->backupServer);
     $this->restoreFactoryState();
     parent::tearDown();
 }
 public function setUp()
 {
     parent::setUp();
     parent::setUpBeforeClass();
     $this->saveFactoryState();
     SHFactory::$config = null;
 }
 /**
  * Sets up the fixture.
  *
  * This method is called before a test is executed.
  *
  * @return  void
  */
 protected function setUp()
 {
     JFactory::$application = $this->getMockApplication();
     JFactory::$document = $this->getMockDocument();
     $this->_instance = new JDocumentRendererMessage(JFactory::getDocument());
     parent::setUp();
 }
Esempio n. 5
0
 /**
  * Tears down the fixture, for example, closes a network connection.
  * This method is called after a test is executed.
  */
 protected function tearDown()
 {
     // Restore the factory state
     $this->restoreFactoryState();
     unset($this->object);
     parent::tearDown();
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return  void
  *
  * @since   3.5
  */
 protected function setUp()
 {
     parent::setUp();
     $app = $this->getMockCmsApp();
     JFactory::$application = $app;
     $router = new JComponentRouterViewInspector($app, $app->getMenu());
     $router->set('name', 'content');
     $categories = new JComponentRouterViewconfiguration('categories');
     $categories->setKey('id');
     $router->registerView($categories);
     $category = new JComponentRouterViewconfiguration('category');
     $category->setKey('id')->setParent($categories)->setNestable()->addLayout('blog');
     $router->registerView($category);
     $article = new JComponentRouterViewconfiguration('article');
     $article->setKey('id')->setParent($category, 'catid');
     $router->registerView($article);
     $archive = new JComponentRouterViewconfiguration('archive');
     $router->registerView($archive);
     $featured = new JComponentRouterViewconfiguration('featured');
     $router->registerView($featured);
     $form = new JComponentRouterViewconfiguration('form');
     $router->registerView($form);
     $router->menu = new MockJComponentRouterRulesMenuMenuObject();
     $this->object = new JComponentRouterRulesMenuInspector($router);
 }
Esempio n. 7
0
 /**
  * Tears down the fixture, for example, closes a network connection.
  * This method is called after a test is executed.
  *
  * @return  void
  *
  * @since   3.0
  */
 protected function tearDown()
 {
     TestReflection::setValue('JComponentHelper', 'components', array());
     // Restore the state
     $this->restoreFactoryState();
     parent::tearDown();
 }
Esempio n. 8
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return  void
  *
  * @since   3.2
  */
 protected function setUp()
 {
     parent::setUp();
     $this->saveFactoryState();
     $this->object = new JHelper();
     JFactory::$application = $this->getMockCmsApp();
 }
	/**
	 * Sets up dependencies for the test.
	 *
	 * @return  void
	 *
	 * @since   11.1
	 */
	protected function setUp()
	{
		parent::setUp();

		require_once JPATH_PLATFORM . '/joomla/form/fields/accesslevel.php';
		include_once dirname(__DIR__) . '/inspectors.php';
	}
Esempio n. 10
0
 /**
  * Overrides the parent tearDown method.
  *
  * @return  void
  *
  * @see     PHPUnit_Framework_TestCase::tearDown()
  * @since   3.6
  */
 protected function tearDown()
 {
     // Reset the dispatcher instance.
     TestReflection::setValue('JEventDispatcher', 'instance', null);
     $_SERVER = $this->backupServer;
     $this->restoreFactoryState();
     parent::tearDown();
 }
Esempio n. 11
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     parent::setUp();
     // Clear the static caches.
     JAccess::clearStatics();
     $this->object = new JAccess();
     // Make sure previous test files are cleaned up
     $this->_cleanupTestFiles();
     // Make some test files and folders
     mkdir(JPath::clean(JPATH_TESTS . '/tmp/access'), 0777, true);
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return  void
  *
  * @since   12.1
  */
 protected function setUp()
 {
     @(include_once JPATH_TESTS . '/config_sqlsrv.php');
     if (class_exists('JSqlSrvTestConfig')) {
         $config = new JSqlSrvTestConfig();
     } else {
         $this->markTestSkipped('There is no SQL Server test config file present.');
     }
     $this->object = JDatabase::getInstance(array('driver' => $config->dbtype, 'database' => $config->db, 'host' => $config->host, 'user' => $config->user, 'password' => $config->password));
     parent::setUp();
 }
 /**
  * Setup for testing.
  *
  * @return  void
  *
  * @since   3.6.2
  */
 public function setup()
 {
     JFactory::$application = $this->getMockCmsApp();
     JFactory::$session = $this->getMockSession();
     // force the cloak JS inline so that we can unit test it easier than messing with script head in document
     JFactory::getApplication()->input->server->set('HTTP_X_REQUESTED_WITH', 'xmlhttprequest');
     /**
      * Create a mock dispatcher instance
      *
      * @var $dispatcher Mock_JEventDispatcher_f5646d4b e.g
      */
     $dispatcher = TestCaseDatabase::getMockDispatcher();
     $plugin = array('name' => 'emailcloak', 'type' => 'Content', 'params' => new \JRegistry());
     $this->class = new PlgContentEmailcloak($dispatcher, $plugin);
 }
Esempio n. 14
0
 /**
  * This method is called before the first test of this test class is run.
  *
  * @return  void
  *
  * @since   12.1
  */
 public static function setUpBeforeClass()
 {
     // We always want the default database test case to use an SQLite memory database.
     $options = array('driver' => 'sqlite', 'database' => ':memory:', 'prefix' => 'jos_');
     try {
         // Attempt to instantiate the driver.
         static::$driver = JDatabaseDriver::getInstance($options);
         // Create a new PDO instance for an SQLite memory database and load the test schema into it.
         $pdo = new PDO('sqlite::memory:');
         $pdo->exec(file_get_contents(JPATH_TESTS . '/schema/ddl.sql'));
         // Set the PDO instance to the driver using reflection whizbangery.
         TestReflection::setValue(static::$driver, 'connection', $pdo);
     } catch (RuntimeException $e) {
         static::$driver = null;
     }
     // If for some reason an exception object was returned set our database object to null.
     if (static::$driver instanceof Exception) {
         static::$driver = null;
     }
     // Setup the factory pointer for the driver and stash the old one.
     self::$_stash = JFactory::$database;
     JFactory::$database = static::$driver;
 }
Esempio n. 15
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return  void
  *
  * @since   12.1
  */
 protected function setUp()
 {
     parent::setUp();
     $this->saveFactoryState();
 }
Esempio n. 16
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return  void
  *
  * @since   3.2
  */
 protected function setUp()
 {
     parent::setUp();
     $this->object = new JHelperContent();
     JFactory::$application = $this->getMockApplication();
 }
Esempio n. 17
0
 /**
  * Tears down the fixture, for example, closes a network connection.
  * This method is called after a test is executed.
  *
  * @return  void
  *
  * @since   4.0
  */
 protected function tearDown()
 {
     TestReflection::setValue('JComponentHelper', 'components', array());
     parent::tearDown();
 }
 /**
  * Remove created files
  *
  * @return  void
  *
  * @since   12.1
  */
 protected function tearDown()
 {
     $this->_cleanupTestFiles();
     unset($this->object);
     parent::tearDown();
 }
Esempio n. 19
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return  void
  *
  * @since   3.1
  */
 protected function setUp()
 {
     parent::setUp();
     $this->object = new JTableContenttype(static::$driver);
 }
Esempio n. 20
0
 /**
  * This method is called after the last test of this test class is run.
  *
  * @return  void
  *
  * @since   12.1
  */
 public static function tearDownAfterClass()
 {
     JFactory::$database = self::$_stash;
     self::$driver = null;
 }
Esempio n. 21
0
 /**
  * Overrides the parent tearDown method.
  *
  * @return  void
  *
  * @see     PHPUnit_Framework_TestCase::tearDown()
  * @since   3.6
  */
 protected function tearDown()
 {
     unset($this->object);
     $this->restoreFactoryState();
     parent::tearDown();
 }
Esempio n. 22
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     parent::setUp();
 }
Esempio n. 23
0
 /**
  * Tears down the fixture.
  *
  * This method is called after a test is executed.
  *
  * @return  void
  *
  * @since   11.3
  */
 public function tearDown()
 {
     $this->restoreFactoryState();
     parent::tearDown();
 }
Esempio n. 24
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return  void
  *
  * @since   3.4
  */
 protected function setUp()
 {
     parent::setUp();
     $app = $this->getMockCmsApp();
     $this->object = new JComponentRouterViewInspector($app, $app->getMenu());
 }
Esempio n. 25
0
 /**
  * Method to tear down what was previously setup before each tests.
  *
  * @since   12.3
  *
  * @return  void
  */
 public function tearDown()
 {
     $this->fixture = null;
     parent::tearDown();
 }
 /**
  * Tears down the fixture.
  *
  * This method is called after a test is executed.
  *
  * @return  void
  *
  * @since   11.3
  */
 protected function tearDown()
 {
     // 		$this->restoreFactoryState();
     unset($this->class);
     parent::tearDown();
 }
 /**
  * Overrides the parent tearDown method.
  *
  * @return  void
  *
  * @see     PHPUnit_Framework_TestCase::tearDown()
  * @since   3.6
  */
 protected function tearDown()
 {
     unset($this->object);
     unset($app);
     parent::tearDown();
 }
Esempio n. 28
0
 /**
  * Overrides the parent tearDown method.
  *
  * @return  void
  *
  * @see     PHPUnit_Framework_TestCase::tearDown()
  * @since   3.2
  */
 protected function tearDown()
 {
     // Reset the dispatcher and application instances.
     TestReflection::setValue('JEventDispatcher', 'instance', null);
     TestReflection::setValue('JApplicationCms', 'instances', array());
     $_SERVER = $this->backupServer;
     unset($this->backupServer);
     unset($config);
     unset($this->class);
     $this->restoreFactoryState();
     parent::tearDown();
 }
 /**
  * Tears down the fixture, for example, closes a network connection.
  * This method is called after a test is executed.
  */
 protected function tearDown()
 {
     $this->restoreFactoryState();
     parent::tearDown();
 }
 /**
  * Overrides the parent tearDown method.
  *
  * @return  void
  *
  * @see     PHPUnit_Framework_TestCase::tearDown()
  * @since   3.6
  */
 protected function tearDown()
 {
     unset($this->db);
     parent::tearDown();
 }