本文整理汇总了PHP中ReflectionMethod::setAccessible方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionMethod::setAccessible方法的具体用法?PHP ReflectionMethod::setAccessible怎么用?PHP ReflectionMethod::setAccessible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReflectionMethod
的用法示例。
在下文中一共展示了ReflectionMethod::setAccessible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUses
public function testUses()
{
$usesMethod = new \ReflectionMethod($this->testInstance, 'uses');
$usesMethod->setAccessible(true);
$this->assertSame(['Illuminate\\Translation\\TranslationServiceProvider'], $usesMethod->invoke($this->testInstance));
$usesMethod->setAccessible(false);
}
示例2: testFacade
public function testFacade()
{
$accessorMethod = new \ReflectionMethod(NavigationBagFacade::class, 'getFacadeAccessor');
$accessorMethod->setAccessible(true);
$this->assertSame(NavigationBagServiceProvider::PROVIDES_SERVICE, $accessorMethod->invoke(null));
$accessorMethod->setAccessible(false);
}
示例3: testUses
public function testUses()
{
$reflectionMethod = new \ReflectionMethod($this->testInstance, 'uses');
$reflectionMethod->setAccessible(true);
$this->assertSame([ValidationLocatorServiceProvider::class], $reflectionMethod->invoke($this->testInstance));
$reflectionMethod->setAccessible(false);
}
示例4: testAccessor
public function testAccessor()
{
$method = new \ReflectionMethod(ValidationLocator::class, 'getFacadeAccessor');
$method->setAccessible(true);
$this->assertSame(ValidationLocatorServiceProvider::PROVIDES_LOCATOR, $method->invoke(null));
$method->setAccessible(false);
}
示例5: testUses
public function testUses()
{
$usesMethod = new \ReflectionMethod($this->testInstance, 'uses');
$usesMethod->setAccessible(true);
$this->assertSame([SessionServiceProvider::class, RoutingServiceProvider::class], $usesMethod->invoke($this->testInstance));
$usesMethod->setAccessible(false);
}
示例6: setSetterMethod
/**
* @param \ReflectionMethod $setterMethod
*/
public function setSetterMethod($setterMethod)
{
$this->setterMethod = $setterMethod;
if ($this->setterMethod) {
$this->setterMethod->setAccessible(TRUE);
}
}
示例7: testAccessor
public function testAccessor()
{
$reflectionMethod = new \ReflectionMethod(BladedFacade::class, 'getFacadeAccessor');
$reflectionMethod->setAccessible(true);
$this->assertSame(BladedServiceProvider::PROVIDES_SERVICE, $reflectionMethod->invoke(null));
$reflectionMethod->setAccessible(false);
}
示例8: __construct
/**
* Constructor
*
* @param string $class
* @param string $name
*/
public function __construct($class, $name)
{
$this->class = $class;
$this->name = $name;
$this->reflection = new \ReflectionMethod($class, $name);
$this->reflection->setAccessible(true);
}
示例9: testGetLastChildKey
/**
* Test the sanity check for behaviour on empty children list
* which should never happen as this is protected method
*/
public function testGetLastChildKey()
{
$object = JsonNode::factory(array());
$method = new \ReflectionMethod($object, 'getLastChildKey');
$method->setAccessible(true);
$this->assertNull($method->invoke($object));
$method->setAccessible(false);
}
示例10: __construct
public function __construct(PropertyAnnotation $annotation, \ReflectionMethod $reflection)
{
$this->reflection = $reflection;
$this->annotation = $annotation;
if ($this->reflection->isPrivate() || $this->reflection->isProtected()) {
$this->reflection->setAccessible(true);
}
}
示例11: setup
public function setup()
{
$class = new \ReflectionClass('BsbFlysystemTest\\Assets\\SimpleAdapterFactory');
$this->property = $class->getProperty('options');
$this->property->setAccessible(true);
$this->method = $class->getMethod('mergeMvcConfig');
$this->method->setAccessible(true);
}
示例12: setUp
/**
* Set up
*/
protected function setUp()
{
require_once 'Fixtures/ConditionMatcherUserFuncs.php';
$this->backupApplicationContext = GeneralUtility::getApplicationContext();
$this->conditionMatcher = $this->getMockForAbstractClass(AbstractConditionMatcher::class);
$this->evaluateConditionCommonMethod = new \ReflectionMethod(AbstractConditionMatcher::class, 'evaluateConditionCommon');
$this->evaluateConditionCommonMethod->setAccessible(TRUE);
}
示例13: testGetFormTypeFqcn
/**
* @dataProvider shortTypesToFqcnProvider
*/
public function testGetFormTypeFqcn($shortType, $expected)
{
$configuratorMock = $this->getMockBuilder('JavierEguiluz\\Bundle\\EasyAdminBundle\\Configuration\\Configurator')->disableOriginalConstructor()->getMock();
$type = new EasyAdminFormType($configuratorMock, array(), array());
$method = new \ReflectionMethod($type, 'getFormTypeFqcn');
$method->setAccessible(true);
$this->assertSame($expected, $method->invoke($type, $shortType));
$method->setAccessible(false);
}
示例14: setUp
public function setUp()
{
parent::setUp();
$this->orderByTrait = $this->getObjectForTrait(OrderByTrait::class);
$this->queryBuilder = $this->prophesize(QueryBuilder::class);
$reflectionClass = new \ReflectionClass($this->orderByTrait);
$this->addOrderByFunction = $reflectionClass->getMethod('addOrderBy');
$this->addOrderByFunction->setAccessible(true);
}
示例15: __construct
/**
* @param AclCheckerInterface $aclChecker
* @param Stopwatch $stopwatch
*/
public function __construct(AclCheckerInterface $aclChecker, Stopwatch $stopwatch)
{
$this->getObjectToSecure = new \ReflectionMethod('Nuxia\\AclBundle\\Manager\\AclChecker', 'getObjectToSecure');
$this->getObjectToSecure->setAccessible(true);
$aclIdentifierProperty = new \ReflectionProperty('Nuxia\\AclBundle\\Manager\\AclChecker', 'aclIdentifier');
$aclIdentifierProperty->setAccessible(true);
$this->aclIdentifier = $aclIdentifierProperty->getValue($aclChecker);
$this->aclChecker = $aclChecker;
$this->stopwatch = $stopwatch;
$this->checks = [];
}