/** * Tests the JApplicationCli::set method. * * @return void * * @since 11.3 */ public function testSet() { $config = new JRegistry(array('foo' => 'bar')); TestReflection::setValue($this->class, 'config', $config); $this->assertEquals('bar', $this->class->set('foo', 'car'), 'Checks set returns the previous value.'); $this->assertEquals('car', $config->get('foo'), 'Checks the new value has been set.'); }
/** * Tests the JApplicationCli::loadConfiguration method. * * @return void * * @since 11.3 */ public function testLoadConfiguration() { $this->assertSame($this->class, $this->class->loadConfiguration(array('foo' => 'bar'))); $this->assertEquals('bar', TestReflection::getValue($this->class, 'config')->get('foo'), 'Check the configuration array was loaded.'); $this->class->loadConfiguration((object) array('goo' => 'car')); $this->assertEquals('car', TestReflection::getValue($this->class, 'config')->get('goo'), 'Check the configuration object was loaded.'); }
/** * Tests the JApplicationCli::triggerEvents method. * * @return void * * @since 11.3 */ public function testTriggerEvents() { $this->inspector->setClassProperty('dispatcher', null); $this->assertThat($this->inspector->triggerEvent('onJCliTriggerEvent'), $this->isNull(), 'Checks that for a non-dispatcher object, null is returned.'); $this->inspector->setClassProperty('dispatcher', $this->getMockDispatcher()); $this->inspector->registerEvent('onJCliTriggerEvent', 'function'); $this->assertThat($this->inspector->triggerEvent('onJCliTriggerEvent'), $this->equalTo(array('function' => null)), 'Checks the correct dispatcher method is called.'); }
/** * 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; }