예제 #1
0
 /**
  * @testdox  Tests that data is read from the application configuration successfully.
  *
  * @covers  JApplicationBase::get
  * @uses    JApplicationBase::setConfiguration
  */
 public function testGet()
 {
     $mockConfig = $this->getMock('Joomla\\Registry\\Registry', array('get'), array(array('foo' => 'bar')), '', true, true, true, false, true);
     // Inject the mock config
     $this->class->setConfiguration($mockConfig);
     $this->assertSame('bar', $this->class->get('foo', 'car'), 'Checks a known configuration setting is returned.');
     $this->assertSame('car', $this->class->get('goo', 'car'), 'Checks an unknown configuration setting returns the default.');
 }
 /**
  * @testdox  Tests that data is set to the application configuration successfully.
  *
  * @covers  JApplicationBase::set
  * @uses    JApplicationBase::get
  * @uses    JApplicationBase::setConfiguration
  */
 public function testSet()
 {
     $mockConfig = $this->getMock('Joomla\\Registry\\Registry', array('get', 'set'), array(array('foo' => 'bar')), '', true, true, true, false, true);
     $this->class->setConfiguration($mockConfig);
     $this->assertEquals('bar', $this->class->set('foo', 'car'), 'Checks set returns the previous value.');
     $this->assertEquals('car', $this->class->get('foo'), 'Checks the new value has been set.');
 }