Пример #1
0
	/**
	 * Creates and instance of the mock JApplication object.
	 *
	 * @param   TestCase  $test  A test object.
	 * @param   array     $data  Data to prime the cache with.
	 *
	 * @return  object
	 *
	 * @since   12.1
	 */
	public static function create(TestCase $test, $data = array())
	{
		self::$cache = $data;

		// Collect all the relevant methods in JConfig.
		$methods = array(
			'get',
			'store',
		);

		// Create the mock.
		$mockObject = $test->getMock(
			'JCache',
			$methods,
			// Constructor arguments.
			array(),
			// Mock class name.
			'',
			// Call original constructor.
			false
		);

		$test->assignMockCallbacks(
			$mockObject,
			array(
				'get' => array(get_called_class(), 'mockGet'),
				'store' => array(get_called_class(), 'mockStore'),
			)
		);

		return $mockObject;
	}
 /**
  * Creates and instance of the mock JApplication object.
  *
  * @param   TestCase  $test  A test object.
  * @param   array     $data  Data to prime the cache with.
  *
  * @return  object
  *
  * @since   12.1
  */
 public static function create(TestCase $test, $data = array())
 {
     self::$cache = $data;
     // Collect all the relevant methods in JConfig.
     $methods = array('get', 'store');
     // Create the mock.
     $mockObject = $test->getMock('JCache', $methods, array(), '', false);
     $test->assignMockCallbacks($mockObject, array('get' => array(get_called_class(), 'mockGet'), 'store' => array(get_called_class(), 'mockStore')));
     return $mockObject;
 }