/** * Tests the isSSLConnection method * * @return void * * @since 12.2 */ public function testIsSSLConnection() { unset($_SERVER['HTTPS']); $this->assertFalse($this->class->isSSLConnection()); $_SERVER['HTTPS'] = 'on'; $this->assertTrue($this->class->isSSLConnection()); }
/** * Test... * * @covers JApplicationWeb::isSSLConnection * * @return void */ public function testIsSSLConnection() { unset($_SERVER['HTTPS']); $this->assertThat($this->class->isSSLConnection(), $this->equalTo(false)); $_SERVER['HTTPS'] = 'on'; $this->assertThat($this->class->isSSLConnection(), $this->equalTo(true)); }
/** * Tests the JApplicationWeb::triggerEvents method. * * @return void * * @since 11.3 */ public function testTriggerEvents() { $this->inspector->setClassProperty('dispatcher', null); $this->assertThat($this->inspector->triggerEvent('onJWebTriggerEvent'), $this->isNull(), 'Checks that for a non-dispatcher object, null is returned.'); $this->inspector->setClassProperty('dispatcher', $this->getMockDispatcher()); $this->inspector->registerEvent('onJWebTriggerEvent', 'function'); $this->assertThat($this->inspector->triggerEvent('onJWebTriggerEvent'), $this->equalTo(array('function' => null)), 'Checks the correct dispatcher method is called.'); }
/** * Tests the JApplicationWeb::setHeader method. * * @return void * * @since 11.3 */ public function testSetHeader() { // Fill the header body with an arbitrary value. TestReflection::setValue($this->class, 'response', (object) array('cachable' => null, 'headers' => array(array('name' => 'foo', 'value' => 'bar')), 'body' => null)); $this->class->setHeader('foo', 'car'); $this->assertThat(TestReflection::getValue($this->class, 'response')->headers, $this->equalTo(array(array('name' => 'foo', 'value' => 'bar'), array('name' => 'foo', 'value' => 'car'))), 'Tests that a header is added.'); $this->class->setHeader('foo', 'car', true); $this->assertThat(TestReflection::getValue($this->class, 'response')->headers, $this->equalTo(array(array('name' => 'foo', 'value' => 'car'))), 'Tests that headers of the same name are replaced.'); }
/** * Test read config * * @param string $file The name of the input file * * @return void * * @dataProvider seedReadConfig * @since 1.0 */ public function testReadConfig($file) { $this->setExpectedException('RuntimeException'); $this->_instance->readConfig($file); }
/** * Method for setting protected static $instance. * * @param mixed $value The value of the property. * * @return void. * * @since 11.3 */ public function setClassInstance($value) { self::$instance = $value; }