当前位置: 首页>>代码示例>>PHP>>正文


PHP TestReflection::setValue方法代码示例

本文整理汇总了PHP中TestReflection::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP TestReflection::setValue方法的具体用法?PHP TestReflection::setValue怎么用?PHP TestReflection::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestReflection的用法示例。


在下文中一共展示了TestReflection::setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: tearDown

 /**
  * Overrides the parent tearDown method.
  *
  * @return  void
  *
  * @see     PHPUnit_Framework_TestCase::tearDown()
  * @since   11.1
  */
 protected function tearDown()
 {
     // Reset the dispatcher instance.
     TestReflection::setValue('JEventDispatcher', 'instance', null);
     TestReflection::setValue('JPluginHelper', 'plugins', null);
     parent::tearDown();
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:15,代码来源:JModelFormTest.php

示例2: create

	/**
	 * Creates and instance of the mock JController object.
	 *
	 * @param   object  $test  A test object.
	 *
	 * @return  object
	 *
	 * @since   12.1
	 */
	public static function create($test)
	{
		// Collect all the relevant methods in JController.
		$methods = array(
			'execute',
			'getApplication',
			'getInput',
			'serialize',
			'unserialize',
		);

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

		// TODO  Mock the input.
		TestReflection::setValue($mockObject, 'input', new JInput);

		return $mockObject;
	}
开发者ID:robschley,项目名称:joomla-platform,代码行数:37,代码来源:controller.php

示例3: tearDown

 /**
  * Tears down the fixture, for example, closes a network connection.
  * This method is called after a test is executed.
  *
  * @return  void
  *
  * @since   3.0
  */
 protected function tearDown()
 {
     TestReflection::setValue('JComponentHelper', 'components', array());
     // Restore the state
     $this->restoreFactoryState();
     parent::tearDown();
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:15,代码来源:JHelpTest.php

示例4: testGetInstance

 /**
  * Test JPathway::getInstance().
  *
  * @return  void
  */
 public function testGetInstance()
 {
     $current = TestReflection::getValue('JApplicationHelper', '_clients');
     // Test Client
     $obj = new stdClass();
     $obj->id = 0;
     $obj->name = 'inspector';
     $obj->path = JPATH_TESTS;
     $obj2 = new stdClass();
     $obj2->id = 1;
     $obj2->name = 'inspector2';
     $obj2->path = __DIR__ . '/stubs';
     TestReflection::setValue('JApplicationHelper', '_clients', array($obj, $obj2));
     $pathway = JPathway::getInstance('Inspector');
     $this->assertThat(get_class($pathway), $this->equalTo('JPathwayInspector'));
     $this->assertThat(JPathway::getInstance('Inspector'), $this->equalTo($pathway));
     $pathway = JPathway::getInstance('Inspector2');
     $this->assertThat(get_class($pathway), $this->equalTo('JPathwayInspector2'));
     $ret = true;
     try {
         JPathway::getInstance('Error');
     } catch (Exception $e) {
         $ret = false;
     }
     if ($ret) {
         $this->fail('JPathway did not throw proper exception upon false client.');
     }
     TestReflection::setValue('JApplicationHelper', '_clients', $current);
 }
开发者ID:ZerGabriel,项目名称:joomla-platform,代码行数:34,代码来源:JPathwayTest.php

示例5: tearDown

 /**
  * Overrides the parent tearDown method.
  *
  * @return  void
  *
  * @see     PHPUnit_Framework_TestCase::tearDown()
  * @since   11.1
  */
 protected function tearDown()
 {
     $this->restoreFactoryState();
     // Reset the dispatcher instance.
     TestReflection::setValue('JPluginHelper', 'plugins', null);
     parent::tearDown();
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:15,代码来源:JModelFormTest.php

示例6: tearDown

 /**
  * Overrides the parent tearDown method.
  *
  * @return  void
  *
  * @see     PHPUnit_Framework_TestCase::tearDown()
  * @since   11.1
  */
 protected function tearDown()
 {
     // Reset the loaded plugins.
     TestReflection::setValue('JPluginHelper', 'plugins', null);
     $this->restoreFactoryState();
     $_SERVER = $this->backupServer;
     parent::tearDown();
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:16,代码来源:JAuthenticationTest.php

示例7: tearDown

 /**
  * Overrides the parent tearDown method.
  *
  * @return  void
  *
  * @see     PHPUnit_Framework_TestCase::tearDown()
  * @since   3.6
  */
 protected function tearDown()
 {
     // Reset the dispatcher instance.
     TestReflection::setValue('JEventDispatcher', 'instance', null);
     $_SERVER = $this->backupServer;
     $this->restoreFactoryState();
     parent::tearDown();
 }
开发者ID:N6REJ,项目名称:joomla-cms,代码行数:16,代码来源:JLanguageMultilangTest.php

示例8: testGetInput

 /**
  * Test the getInput method where there is no value from the element
  * and no checked attribute.
  *
  * @param   array   $data  	   @todo
  * @param   string  $expected  @todo
  *
  * @return  void
  *
  * @since   12.2
  *
  * @dataProvider  getInputData
  */
 public function testGetInput($data, $expected)
 {
     $formField = new JFormFieldEmail();
     foreach ($data as $attr => $value) {
         TestReflection::setValue($formField, $attr, $value);
     }
     $this->assertEquals($expected, TestReflection::invoke($formField, 'getInput'), 'Line:' . __LINE__ . ' The field with no value and no checked attribute did not produce the right html');
 }
开发者ID:akirsoft,项目名称:joomla-cms,代码行数:21,代码来源:JFormFieldEmailTest.php

示例9: tearDown

 /**
  * Overrides the parent tearDown method.
  *
  * @return  void
  *
  * @see     PHPUnit_Framework_TestCase::tearDown()
  * @since   11.1
  */
 protected function tearDown()
 {
     // Reset the dispatcher instance.
     TestReflection::setValue('JEventDispatcher', 'instance', null);
     // Reset the loaded plugins.
     TestReflection::setValue('JPluginHelper', 'plugins', null);
     $_SERVER = $this->backupServer;
     parent::tearDown();
 }
开发者ID:eshiol,项目名称:joomla-cms,代码行数:17,代码来源:JAuthenticationTest.php

示例10: testGetInput

 /**
  * Test the getInput method where there is no value from the element.
  *
  * @param   array   $data  	   @todo
  * @param   string  $expected  @todo
  *
  * @return  void
  *
  * @since   12.2
  *
  * @dataProvider  getInputData
  */
 public function testGetInput($data, $expected)
 {
     $formField = new JFormFieldTel();
     TestReflection::setValue($formField, 'element', simplexml_load_string('<field type="tel" />'));
     foreach ($data as $attr => $value) {
         TestReflection::setValue($formField, $attr, $value);
     }
     $this->assertEquals($expected, TestReflection::invoke($formField, 'getInput'), 'Line:' . __LINE__ . ' The field did not produce the right html');
 }
开发者ID:SysBind,项目名称:joomla-cms,代码行数:21,代码来源:JFormFieldTelTest.php

示例11: create

 /**
  * Creates and instance of the mock JController object.
  *
  * @param   object  $test  A test object.
  *
  * @return  object
  *
  * @since   12.1
  */
 public static function create($test)
 {
     // Collect all the relevant methods in JController.
     $methods = array('execute', 'getApplication', 'getInput', 'serialize', 'unserialize');
     // Create the mock.
     $mockObject = $test->getMock('JControllerBase', $methods, array(), '', false);
     // TODO  Mock the input.
     TestReflection::setValue($mockObject, 'input', new JInput());
     return $mockObject;
 }
开发者ID:ZerGabriel,项目名称:joomla-platform,代码行数:19,代码来源:controller.php

示例12: testGetInput

 /**
  * Test the getInput method where there is no value from the element
  * and no checked attribute.
  *
  * @param   string  $element   @todo
  * @param   array   $data  	   @todo
  * @param   string  $expected  @todo
  *
  * @return  void
  *
  * @since   12.2
  *
  * @dataProvider  getInputData
  */
 public function testGetInput($element, $data, $expected)
 {
     $formField = new JFormFieldRadio();
     TestReflection::setValue($formField, 'element', simplexml_load_string($element));
     foreach ($data as $attr => $value) {
         TestReflection::setValue($formField, $attr, $value);
     }
     // Get the result once, we may perform multiple tests
     $result = TestReflection::invoke($formField, 'getInput');
     // Test that the tag exists
     $matcher = array('id' => 'myTestId');
     $this->assertTag($matcher, $result, 'The tag did not have the correct id.');
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:27,代码来源:JFormFieldRadioTest.php

示例13: testGetInput

 /**
  * Test the getInput method.
  *
  * @return  void
  *
  * @since   11.4
  */
 public function testGetInput()
 {
     $formField = new JFormFieldPlugins();
     TestReflection::setValue($formField, 'id', 'myTestId');
     TestReflection::setValue($formField, 'name', 'editors');
     TestReflection::setValue($formField, 'folder', 'editors');
     TestReflection::setValue($formField, 'element', simplexml_load_string('<field name="editors" type="plugins" folder="editors" />'));
     if (!is_null(self::$driver)) {
         $this->assertThat(strlen($formField->input), $this->greaterThan(0), 'Line:' . __LINE__ . ' The getInput method should return something without error.');
     } else {
         $this->markTestSkipped();
     }
     // TODO: Should check all the attributes have come in properly.
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:21,代码来源:JFormFieldPluginsTest.php

示例14: setUp

 /**
  * Prepares the environment before running a test.
  *
  * @return  void
  *
  * @since   1.0
  *
  */
 protected function setUp()
 {
     parent::setUp();
     $this->saveFactoryState();
     JFactory::$session = $this->getMockSession();
     JFactory::$application = MockWebServiceApplicationWeb::create($this);
     $options = array('driver' => 'sqlite', 'database' => ':memory:', 'prefix' => 'ws_');
     $driver = JDatabaseDriver::getInstance($options);
     $pdo = new PDO('sqlite::memory:');
     $pdo->exec(file_get_contents(JPATH_TESTS . '/schema/ws.sql')) or die(print_r($pdo->errorInfo()));
     TestReflection::setValue($driver, 'connection', $pdo);
     JFactory::$database = $driver;
     $this->_instance = new WebServiceModelBase(new JContentFactory(), $driver);
     $this->_state = TestReflection::invoke($this->_instance, 'getState');
 }
开发者ID:prox91,项目名称:joomla-dev,代码行数:23,代码来源:baseTest.php

示例15: testGetInput

 /**
  * Test the getInput method.
  *
  * @return  void
  *
  * @since   12.1
  */
 public function testGetInput()
 {
     $formField = new JFormFieldSQL();
     TestReflection::setValue($formField, 'id', 'myTestId');
     TestReflection::setValue($formField, 'name', 'sql');
     TestReflection::setValue($formField, 'valueField', 'title');
     TestReflection::setValue($formField, 'keyField', 'id');
     TestReflection::setValue($formField, 'query', "SELECT * FROM `jos_categories`");
     TestReflection::setValue($formField, 'element', simplexml_load_string('<field name="sql" type="sql" value_field="title" key_field="id" query="SELECT * FROM `jos_categories`">' . '<option value="*">None</option></field>'));
     if (!is_null(self::$driver)) {
         $this->assertThat(strlen($formField->input), $this->greaterThan(0), 'Line:' . __LINE__ . ' The getInput method should return something without error.');
     } else {
         $this->markTestSkipped();
     }
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:22,代码来源:JFormFieldSQLTest.php


注:本文中的TestReflection::setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。