Esempio n. 1
0
 /**
  * Gets a mock web object.
  *
  * @param   array  $options  A set of options to configure the mock.
  *
  * @return  JApplicationWeb
  *
  * @since   12.1
  */
 public function getMockWeb($options = array())
 {
     // Attempt to load the real class first.
     class_exists('JApplicationWeb');
     return TestMockApplicationWeb::create($this, $options);
 }
 /**
  * Setup the tests.
  *
  * @return  void
  *
  * @since   12.1
  */
 protected function setUp()
 {
     parent::setUp();
     $this->saveFactoryState();
     $app = TestMockApplicationWeb::create($this);
     $app->input = 'default';
     JFactory::$application = $app;
     $this->_instance = new BaseController();
 }
Esempio n. 3
0
 /**
  * Adds mock objects for some methods.
  *
  * @param  TestCase                                 $test        A test object.
  * @param  PHPUnit_Framework_MockObject_MockObject  $mockObject  The mock object.
  * @param  array                                    $options     A set of options to configure the mock.
  *
  * @return  PHPUnit_Framework_MockObject_MockObject  The object with the behaviours added
  *
  * @since   3.4
  */
 public static function addBehaviours($test, $mockObject, $options)
 {
     return parent::addBehaviours($test, $mockObject, $options);
 }
Esempio n. 4
0
 /**
  * Mock JApplicationWeb->setBody method.
  *
  * @param   string  $content  The body of the response.
  *
  * @return  void
  *
  * @since   12.2
  */
 public static function mockSetBody($content)
 {
     self::$body = array($content);
 }
 /**
  * Adds mock objects for some methods.
  *
  * @param   TestCase                                 $test        A test object.
  * @param   PHPUnit_Framework_MockObject_MockObject  $mockObject  The mock object.
  * @param   array                                    $options     A set of options to configure the mock.
  *
  * @return  PHPUnit_Framework_MockObject_MockObject  The object with the behaviours added
  *
  * @since   3.4
  */
 public static function addBehaviours($test, $mockObject, $options)
 {
     // Mock calls to JApplicationCms::getMenu();
     $mockObject->expects($test->any())->method('getMenu')->will($test->returnValue(TestMockMenu::create($test)));
     return parent::addBehaviours($test, $mockObject, $options);
 }