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


PHP TestReflection::getValue方法代码示例

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


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

示例1: testGetInstance

 /**
  * Test JPathway::getInstance().
  *
  * @return  void
  *
  * @since   3.1
  */
 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('');
     $this->assertInstanceOf('JPathway', $pathway);
     $pathway = JPathway::getInstance('Inspector2');
     $this->assertInstanceOf('JPathwayInspector2', $pathway);
     $ret = true;
     try {
         JPathway::getInstance('Error');
     } catch (Exception $e) {
         $ret = false;
     }
     if ($ret) {
         $this->fail('JPathway did not throw a proper exception with a false client.');
     }
     TestReflection::setValue('JApplicationHelper', '_clients', $current);
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:35,代码来源:JPathwayTest.php

示例2: testConstructorAppliesDefaultConfiguration

 /**
  * Test JModelAdmin::__construct
  *
  * @since   3.4
  *
  * @return  void
  *
  * @testdox Constructor applies default configuration
  */
 public function testConstructorAppliesDefaultConfiguration()
 {
     $config = array('event_after_delete' => 'onContentAfterDelete', 'event_after_save' => 'onContentAfterSave', 'event_before_delete' => 'onContentBeforeDelete', 'event_before_save' => 'onContentBeforeSave', 'event_change_state' => 'onContentChangeState', 'text_prefix' => 'COM_MOCK_J');
     foreach ($config as $key => $value) {
         $this->assertEquals($value, TestReflection::getValue($this->object, $key));
     }
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:16,代码来源:JModelAdminTest.php

示例3: testConstructor

 /**
  * Tests the JImage::__construct method.
  *
  * @return  void
  *
  * @since   11.4
  */
 public function testConstructor()
 {
     // Create a image handle of the correct size.
     $imageHandle = imagecreatetruecolor(100, 100);
     $filter = new JImageFilterBrightness($imageHandle);
     $this->assertEquals(TestReflection::getValue($filter, 'handle'), $imageHandle);
 }
开发者ID:rvsjoen,项目名称:joomla-platform,代码行数:14,代码来源:JImageFilterTest.php

示例4: setUpBeforeClass

 /**
  * Cache the JLoader settings while we are resetting things for testing.
  *
  * @return  void
  *
  * @since   12.3
  */
 public static function setUpBeforeClass()
 {
     self::$cache['classes'] = \TestReflection::getValue('JLoader', 'classes');
     self::$cache['imported'] = \TestReflection::getValue('JLoader', 'imported');
     self::$cache['prefixes'] = \TestReflection::getValue('JLoader', 'prefixes');
     self::$cache['namespaces'] = \TestReflection::getValue('JLoader', 'namespaces');
 }
开发者ID:ZerGabriel,项目名称:joomla-platform,代码行数:14,代码来源:JloaderNamespaceTest.php

示例5: test_parseArguments

 /**
  * Test the JInput::parseArguments method.
  *
  * @dataProvider provider_parseArguments
  */
 public function test_parseArguments($inputArgv, $expectedData, $expectedArgs)
 {
     $_SERVER['argv'] = $inputArgv;
     $this->inspector = new JInputCLI(null, array('filter' => new JFilterInputMock()));
     $this->assertThat(TestReflection::getValue($this->inspector, 'data'), $this->identicalTo($expectedData));
     $this->assertThat(TestReflection::getValue($this->inspector, 'args'), $this->identicalTo($expectedArgs));
 }
开发者ID:sural98,项目名称:joomla-cms,代码行数:12,代码来源:JInputCliTest.php

示例6: testCacheTimeout

 /**
  * Overrides TestCaseCache::testCacheTimeout to deal with the adapter's stored time values in this test
  *
  * @testdox  The cache handler correctly handles expired cache data
  *
  * @medium
  */
 public function testCacheTimeout()
 {
     /** @var Cache_Lite $cacheLiteInstance */
     $cacheLiteInstance = TestReflection::getValue('JCacheStorageCachelite', 'CacheLiteInstance');
     $cacheLiteInstance->_lifeTime = 0.1;
     // For parent class
     $this->handler->_lifetime =& $cacheLiteInstance->_lifeTime;
     parent::testCacheTimeout();
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:16,代码来源:JCacheStorageCacheliteTest.php

示例7: testLoadIdentity

 /**
  * Tests the JApplicationBase::loadIdentity method.
  *
  * @return  void
  *
  * @since   12.1
  * @covers  JApplicationBase::loadIdentity
  */
 public function testLoadIdentity()
 {
     $this->class->loadIdentity($this->getMock('JUser', array(), array(), '', false));
     $this->assertAttributeInstanceOf('JUser', 'identity', $this->class, 'Tests that the identity object is the correct class.');
     // Mock the session.
     JFactory::$session = $this->getMockSession(array('get.user.id' => 99));
     $this->class->loadIdentity();
     $this->assertEquals(99, TestReflection::getValue($this->class, 'identity')->get('id'), 'Tests that we got the identity from the factory.');
 }
开发者ID:n3t,项目名称:joomla-platform,代码行数:17,代码来源:JApplicationBaseTest.php

示例8: testGetInput

 /**
  * Test the getInput method.
  * @covers JFormFieldTemplateStyle::getGroups
  */
 public function testGetInput()
 {
     $form = new JForm('form1');
     $this->assertThat($form->load('<form><field name="templatestyle" type="templatestyle" /></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.');
     $field = new JFormFieldTemplatestyle($form);
     $this->assertThat($field->setup(TestReflection::getValue($form, 'xml')->field, 'value'), $this->isTrue(), 'Line:' . __LINE__ . ' The setup method should return true.');
     $this->markTestIncomplete('Problems encountered in next assertion');
     $this->assertThat(strlen($field->input), $this->greaterThan(0), 'Line:' . __LINE__ . ' The getInput method should return something without error.');
     // TODO: Should check all the attributes have come in properly.
 }
开发者ID:n3t,项目名称:joomla-platform,代码行数:14,代码来源:JFormFieldTemplateStyleTest.php

示例9: testCacheTimeout

 /**
  * Overrides TestCaseCache::testCacheTimeout to deal with the adapter's stored time values in this test
  *
  * @testdox  The cache handler correctly handles expired cache data
  *
  * @medium
  */
 public function testCacheTimeout()
 {
     /** @var Cache_Lite $cacheLiteInstance */
     $cacheLiteInstance = TestReflection::getValue('JCacheStorageCachelite', 'CacheLiteInstance');
     $cacheLiteInstance->_lifeTime = 2;
     $data = 'testData';
     $this->assertTrue($this->handler->store($this->id, $this->group, $data), 'Initial Store Failed');
     sleep(5);
     $this->assertFalse($this->handler->get($this->id, $this->group), 'No data should be returned from the cache store when expired.');
 }
开发者ID:N6REJ,项目名称:joomla-cms,代码行数:17,代码来源:JCacheStorageCacheliteTest.php

示例10: test__construct

 /**
  * Tests the __construct method.
  *
  * @return  void
  *
  * @since   12.1
  */
 public function test__construct()
 {
     // New controller with no dependencies.
     $this->assertEquals('default', TestReflection::getValue($this->_instance, 'app')->input, 'Checks the mock application came from the factory.');
     $this->assertAttributeEquals('default', 'input', $this->_instance, 'Checks the input came from the application.');
     // New controller with dependencies
     $app = TestMockApplicationWeb::create($this);
     $app->test = 'ok';
     $class = new BaseController(new JInputCookie(), $app);
     $this->assertAttributeInstanceOf('JInputCookie', 'input', $class, 'Checks the type of the injected input.');
     $this->assertAttributeSame($app, 'app', $class, 'Checks the injected application.');
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:19,代码来源:JControllerBaseTest.php

示例11: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return  void
  */
 protected function setUp()
 {
     if (!JCacheStorageRedis::isSupported()) {
         $this->markTestSkipped('The Redis cache handler is not supported on this system.');
     }
     parent::setUp();
     $this->handler = new JCacheStorageRedis();
     // This adapter doesn't throw an Exception on a connection failure so we'll have to use Reflection to get into the class to check it
     if (!TestReflection::getValue($this->handler, '_redis') instanceof Redis) {
         $this->markTestSkipped('Failed to connect to Redis');
     }
     // Override the lifetime because the JCacheStorage API multiplies it by 60 (converts minutes to seconds)
     $this->handler->_lifetime = 2;
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:20,代码来源:JCacheStorageRedisTest.php

示例12: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return  void
  */
 protected function setUp()
 {
     if (!JCacheStorageRedis::isSupported()) {
         $this->markTestSkipped('The Redis cache handler is not supported on this system.');
     }
     parent::setUp();
     // Mock the returns on JApplicationCms::get() to use the default values
     JFactory::$application->expects($this->any())->method('get')->willReturnArgument(1);
     $this->handler = new JCacheStorageRedis();
     // This adapter doesn't throw an Exception on a connection failure so we'll have to use Reflection to get into the class to check it
     if (!TestReflection::getValue($this->handler, '_redis') instanceof Redis) {
         $this->markTestSkipped('Failed to connect to Redis');
     }
     // Override the lifetime because the JCacheStorage API multiplies it by 60 (converts minutes to seconds)
     $this->handler->_lifetime = 2;
 }
开发者ID:eshiol,项目名称:joomla-cms,代码行数:22,代码来源:JCacheStorageRedisTest.php

示例13: testLoad

 /**
  * Tests JUser::load().
  *
  * @param   integer  $id        User ID to load
  * @param   boolean  $expected  Expected result of load operation
  * @param   boolean  $isGuest   Boolean marking an user as guest
  *
  * @return  void
  *
  * @since   12.1
  *
  * @dataProvider casesLoad
  * @covers  JUser::load
  */
 public function testLoad($id, $expected, $isGuest)
 {
     $testUser = new JUser($id);
     $this->assertThat($testUser->load($id), $this->equalTo($expected));
     $this->assertThat($isGuest, $this->equalTo(TestReflection::getValue($testUser, 'guest')));
 }
开发者ID:SysBind,项目名称:joomla-cms,代码行数:20,代码来源:JUserTest.php

示例14: testSetupWithoutPrefixes

 /**
  * Tests the JLoader::setup method with $enablePrefixes = false.
  *
  * @return  void
  *
  * @since   12.3
  */
 public function testSetupWithoutPrefixes()
 {
     // Reset the prefixes.
     TestReflection::setValue('JLoader', 'prefixes', array());
     // We unregister all loader functions if registered.
     $this->unregisterLoaders();
     // Setup the loader with $enablePrefixes = false.
     JLoader::setup(false, false, true);
     // Get the autoload functions
     $loaders = spl_autoload_functions();
     $foundAutoLoad = false;
     // We search the list of autoload functions to see if our methods are there.
     foreach ($loaders as $loader) {
         if (is_array($loader) && $loader[0] === 'JLoader') {
             if ($loader[1] === '_autoload') {
                 $foundAutoLoad = true;
             }
         }
     }
     // We don't expect to find it.
     $this->assertFalse($foundAutoLoad);
     // Assert the J prefix hasn't been registered.
     $prefixes = TestReflection::getValue('JLoader', 'prefixes');
     $this->assertFalse(isset($prefixes['J']));
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:32,代码来源:JLoaderTest.php

示例15: testRegisterParserWithInvalidTag

 /**
  * Tests JFeedFactory::registerParser()
  *
  * @return  void
  *
  * @expectedException  InvalidArgumentException
  * @since              12.3
  */
 public function testRegisterParserWithInvalidTag()
 {
     TestReflection::setValue($this->_instance, 'parsers', array());
     $this->_instance->registerParser('42tag', 'JFeedParserMock');
     $this->assertNotEmpty(TestReflection::getValue($this->_instance, 'parsers'));
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:14,代码来源:JFeedFactoryTest.php


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