Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Expanded mock method definitions for JApplicationWeb and added new mo…

…ck for JApplicationBase.
  • Loading branch information...
commit e26a5c3fee27104ba38f58a00bcd1e5bacb210f0 1 parent 5d1a16c
@eddieajau eddieajau authored
View
60 tests/core/mock/application/base.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * @package Joomla.Test
+ *
+ * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE
+ */
+
+/**
+ * Class to mock JApplicationBase.
+ *
+ * @package Joomla.Test
+ * @since 12.1
+ */
+class TestMockApplicationWeb
+{
+ /**
+ * Creates and instance of the mock JApplicationBase object.
+ *
+ * @param object $test A test object.
+ * @param array $options A set of options to configure the mock.
+ *
+ * @return object
+ *
+ * @since 11.3
+ */
+ public static function create($test, $options = array())
+ {
+ // Set expected server variables.
+ if (!isset($_SERVER['HTTP_HOST']))
+ {
+ $_SERVER['HTTP_HOST'] = 'localhost';
+ }
+
+ // Collect all the relevant methods in JApplicationBase (work in progress).
+ $methods = array(
+ 'close',
+ 'getIdentity',
+ 'loadDispatcher',
+ 'loadDocument',
+ 'loadIdentity',
+ 'registerEvent',
+ 'triggerEvent',
+ );
+
+ // Create the mock.
+ $mockObject = $test->getMock(
+ 'JApplicationBase',
+ $methods,
+ // Constructor arguments.
+ array(),
+ // Mock class name.
+ '',
+ // Call original constructor.
+ true
+ );
+
+ return $mockObject;
+ }
+}
View
23 tests/core/mock/application/web.php
@@ -34,11 +34,32 @@ public static function create($test, $options = array())
// Collect all the relevant methods in JApplicationWeb (work in progress).
$methods = array(
+ 'allowCache',
+ 'appendBody',
+ 'clearHeaders',
+ 'close',
+ 'execute',
'get',
+ 'getBody',
'getDocument',
+ 'getHeaders',
'getIdentity',
'getLanguage',
- 'getSession'
+ 'getSession',
+ 'loadConfiguration',
+ 'loadDispatcher',
+ 'loadDocument',
+ 'loadIdentity',
+ 'loadLanguage',
+ 'loadSession',
+ 'prependBody',
+ 'redirect',
+ 'registerEvent',
+ 'sendHeaders',
+ 'set',
+ 'setBody',
+ 'setHeader',
+ 'triggerEvent',
);
// Create the mock.
Please sign in to comment.
Something went wrong with that request. Please try again.