Пример #1
0
 /**
  * Tests the `_runQuery` method.
  *
  * @return  void
  *
  * @since   12.1
  */
 public function test_runQuery()
 {
     // Just run a valid query and then check for an exception case.
     TestReflection::invoke($this->class, '_runQuery', 'SELECT * FROM #__categories', 'foo');
     try {
         // We need to confirm the locking is called, so we create a mock.
         $class = $this->getMock('NestedTable', array('_unlock'), array(self::$driver));
         // Then override the _unlock method so we can test that it was called.
         $this->assignMockCallbacks($class, array('_unlock' => array('NestedTable', 'mockUnlock')));
         // Reset the value to detect the change.
         NestedTable::$unlocked = false;
         TestReflection::invoke($class, '_runQuery', 'SELECT foo FROM #__categories', 'foo');
         $this->fail('A RuntimeException was expected.');
     } catch (RuntimeException $e) {
         $this->assertTrue(NestedTable::$unlocked);
     }
 }
Пример #2
0
 /**
  * Method to reset the root_id
  *
  * @return void
  */
 public static function resetRootId()
 {
     self::$root_id = 0;
 }
Пример #3
0
 /**
  * Test...
  *
  * @return void
  */
 public static function mockUnlock()
 {
     self::$unlocked = true;
 }