/**
  * @todo Implement testAbort().
  */
 public function testAbortExtension()
 {
     $this->saveFactoryState();
     $newDbo = $this->getMock('test', array('setQuery', 'query'));
     $newDbo->expects($this->once())->method('setQuery')->with($this->equalTo('DELETE FROM `#__extensions` WHERE extension_id = 3'));
     $newDbo->expects($this->once())->method('Query')->with()->will($this->returnValue(true));
     JFactory::$database =& $newDbo;
     //$this->object = JInstaller::getInstance();
     $this->object = new JInstaller();
     $this->object->pushStep(array('type' => 'extension', 'id' => 3));
     $this->assertThat($this->object->abort(), $this->isTrue());
     $this->restoreFactoryState();
 }
	/**
	 * Test that if the type is not good we fall back properly
	 *
	 * @covers  JInstaller::abort
	 *
	 * @return void
	 */
	public function testAbortBadType()
	{
		$this->object->pushStep(array('type' => 'badstep'));

		$this->assertThat(
			$this->object->abort(null, false),
			$this->isFalse()
		);
	}
Example #3
0
 /**
  * Test that if the type is not good we fall back properly
  */
 public function testAbortBadType()
 {
     $this->saveFactoryState();
     $newDbo = $this->getMock('test');
     JFactory::$database =& $newDbo;
     //$this->object = JInstaller::getInstance();
     $this->object = new JInstaller();
     $this->object->pushStep(array('type' => 'badstep'));
     $this->assertThat($this->object->abort(null, false), $this->isFalse());
     $this->restoreFactoryState();
 }
Example #4
0
 /**
  * Method to create the extension root path if necessary
  *
  * @return  void
  *
  * @since   3.4
  * @throws  RuntimeException
  */
 protected function createExtensionRoot()
 {
     // If the extension directory does not exist, lets create it
     $created = false;
     if (!file_exists($this->parent->getPath('extension_root'))) {
         if (!($created = JFolder::create($this->parent->getPath('extension_root')))) {
             throw new RuntimeException(JText::sprintf('JLIB_INSTALLER_ABORT_CREATE_DIRECTORY', JText::_('JLIB_INSTALLER_' . $this->route), $this->parent->getPath('extension_root')));
         }
     }
     /*
      * Since we created the extension directory and will want to remove it if
      * we have to roll back the installation, let's add it to the
      * installation step stack
      */
     if ($created) {
         $this->parent->pushStep(array('type' => 'folder', 'path' => $this->parent->getPath('extension_root')));
     }
 }