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


PHP PHPUnit_Util_Class::getObjectAttribute方法代码示例

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


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

示例1: testManufactureHandlers

 /**
  * @dataProvider handlerProvider
  */
 public function testManufactureHandlers($types, $options)
 {
     $handler = HandlerFactory::createHandler($types, $options);
     if (count($types) > 1) {
         $handlerclass = $this->handlers['Composite'];
         $h = \PHPUnit_Util_Class::getObjectAttribute($handler, 'drivers');
         $handlers = array_combine($types, $h);
     } else {
         $handlerclass = $this->handlers[$types[0]];
         $handlers = array($types[0] => $handler);
     }
     $this->assertInstanceOf($handlerclass, $handler);
     foreach ($handlers as $subtype => $subhandler) {
         $subhandlerclass = $this->handlers[$subtype];
         $this->assertInstanceOf($subhandlerclass, $subhandler);
     }
     foreach ($types as $type) {
         $defaults = isset($this->defaultSettings[$type]) ? $this->defaultSettings[$type] : array();
         $options = array_merge($defaults, $options);
         /*            foreach($options as $optname => $optvalue) {
                         $this->assertAttributeEquals($optvalue, $optname, $handlers[$type]);
                     }
         */
     }
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:28,代码来源:HandlerFactoryTest.php

示例2: testGetObjectAttributeCanHandleDynamicVariables

 /**
  * Test that if a dynamic variable is defined on a class then
  * the $attribute variable will be NULL, but the variable defined
  * will be a public one so we are safe to return it
  *
  * Currently $attribute is NULL but we try and call isPublic() on it.
  * This breaks for php 5.2.10
  *
  * @covers PHPUnit_Util_Class::getObjectAttribute
  *
  * @return void
  */
 public function testGetObjectAttributeCanHandleDynamicVariables()
 {
     $attributeName = '_variable';
     $object = new stdClass();
     $object->{$attributeName} = 'Test';
     $actual = PHPUnit_Util_Class::getObjectAttribute($object, $attributeName);
     $this->assertEquals('Test', $actual);
 }
开发者ID:DieguinhoHR,项目名称:kratos_store,代码行数:20,代码来源:ClassTest.php

示例3: testSetThreshold

 /**
  * Test setThreshold method
  */
 public function testSetThreshold()
 {
     $thresholdKey = \Magento\Framework\Profiler\Driver\Standard\Stat::TIME;
     $this->_output->setThreshold($thresholdKey, 100);
     $thresholds = class_exists('PHPUnit_Util_Class') ? \PHPUnit_Util_Class::getObjectAttribute($this->_output, '_thresholds') : \PHPUnit_Framework_Assert::readAttribute($this->_output, '_thresholds');
     $this->assertArrayHasKey($thresholdKey, $thresholds);
     $this->assertEquals(100, $thresholds[$thresholdKey]);
     $this->_output->setThreshold($thresholdKey, null);
     $this->assertArrayNotHasKey($thresholdKey, $this->_output->getThresholds());
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:OutputAbstractTest.php

示例4: readAttribute

 /**
  * Returns the value of an attribute of a class or an object.
  * This also works for attributes that are declared protected or private.
  *
  * @param  mixed   $classOrObject
  * @param  string  $attributeName
  * @return mixed
  * @throws PHPUnit_Framework_Exception
  */
 public static function readAttribute($classOrObject, $attributeName)
 {
     if (!is_string($attributeName)) {
         throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'string');
     }
     if (is_string($classOrObject)) {
         if (!class_exists($classOrObject)) {
             throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'class name');
         }
         return PHPUnit_Util_Class::getStaticAttribute($classOrObject, $attributeName);
     } else {
         if (is_object($classOrObject)) {
             return PHPUnit_Util_Class::getObjectAttribute($classOrObject, $attributeName);
         } else {
             throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'class name or object');
         }
     }
 }
开发者ID:jeanCarloMachado,项目名称:challenges,代码行数:27,代码来源:Assert.php

示例5: testDefinedProperties

 /**
  * Tests access to data stored in {@link phpucAbstractAntTask::$properties}
  *
  * @covers phpucAbstractAntTask::__set
  * @covers phpucAbstractAntTask::__get
  * @covers phpucAbstractAntTask::__isset
  *
  * @return void
  */
 public function testDefinedProperties()
 {
     $buildFile = $this->getMock('phpucBuildFile', array(), array(), '', false);
     $exec = phpucAbstractAntTask::create($buildFile, 'exec');
     $php = 'php5';
     $exec->executable = $php;
     $properties = PHPUnit_Util_Class::getObjectAttribute($exec, 'properties');
     $this->assertEquals($php, $properties['executable']);
     $this->assertEquals($php, $exec->executable);
     $this->assertTrue(isset($exec->executable));
     $this->assertFalse(isset($exec->foobar));
 }
开发者ID:hpbuniat,项目名称:phpUnderControl,代码行数:21,代码来源:AbstractAntTaskTest.php

示例6: testTargetTasks

 /**
  * Tests that {@link phpucAbstractAntTask} are properly added to
  * target tasks list
  *
  * @covers phpucBuildTarget::addTask
  * @covers phpucBuildTarget::getTasks
  *
  * @return void
  */
 public function testTargetTasks()
 {
     $buildFile = new phpucBuildFile($this->fileName, $this->projectName);
     $target = $buildFile->createBuildTarget('phpuc');
     $execTask = phpucAbstractAntTask::create($buildFile, 'exec');
     $applyTask = phpucAbstractAntTask::create($buildFile, 'apply');
     $target->addTask($execTask);
     $target->addTask($applyTask);
     $this->assertEquals(array($execTask, $applyTask), $target->getTasks());
     $tasks = PHPUnit_Util_Class::getObjectAttribute($target, 'tasks');
     $this->assertEquals(array($execTask, $applyTask), $tasks);
 }
开发者ID:hpbuniat,项目名称:phpUnderControl,代码行数:21,代码来源:BuildTargetTest.php


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