/** * Prepares the environment before running a test. * * @return void * * @since 1.0 */ protected function setUp() { parent::setUp(); $testInput = new JInput(); $testMock = MockWebServiceApplicationWeb::create($this); $this->_instance = new WebServiceApplicationWebErrors($testMock, $testInput); }
/** * Prepares the environment before running a test. * * @return void * * @since 1.0 * */ protected function setUp() { parent::setUp(); $this->saveFactoryState(); JFactory::$session = $this->getMockSession(); JFactory::$application = MockWebServiceApplicationWeb::create($this); $options = array('driver' => 'sqlite', 'database' => ':memory:', 'prefix' => 'ws_'); $driver = JDatabaseDriver::getInstance($options); $pdo = new PDO('sqlite::memory:'); $pdo->exec(file_get_contents(JPATH_TESTS . '/schema/ws.sql')) or die(print_r($pdo->errorInfo())); TestReflection::setValue($driver, 'connection', $pdo); JFactory::$database = $driver; $this->_instance = new WebServiceModelBase(new JContentFactory(), $driver); $this->_state = TestReflection::invoke($this->_instance, 'getState'); }
/** * 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); }
/** * Prepares the environment before running a test. * * @return void * * @since 1.0 */ protected function setUp() { parent::setUp(); $options = array('driver' => 'sqlite', 'database' => ':memory:', 'prefix' => 'ws_'); $driver = JDatabaseDriver::getInstance($options); $pdo = new PDO('sqlite::memory:'); $pdo->exec(file_get_contents(JPATH_TESTS . '/schema/ws.sql')) or die(print_r($pdo->errorInfo())); TestReflection::setValue($driver, 'connection', $pdo); JFactory::$database = $driver; JFactory::$application = $this->getMockWeb(); $testInput = new JInput(); $testMock = MockWebServiceApplicationWeb::create($this); $this->_instance = new WebServiceControllerV1JsonBaseDelete('general', $testInput, $testMock); }