本文整理匯總了PHP中Symfony\Component\Validator\ExecutionContext::getCurrentProperty方法的典型用法代碼示例。如果您正苦於以下問題:PHP ExecutionContext::getCurrentProperty方法的具體用法?PHP ExecutionContext::getCurrentProperty怎麽用?PHP ExecutionContext::getCurrentProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Validator\ExecutionContext
的用法示例。
在下文中一共展示了ExecutionContext::getCurrentProperty方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testInitWithPropertyMetadata
public function testInitWithPropertyMetadata()
{
// BC
set_error_handler(array($this, "deprecationErrorHandler"));
$this->metadata = new PropertyMetadata(__NAMESPACE__ . '\\ExecutionContextTest_TestClass', 'myProperty');
$this->context = new ExecutionContext($this->globalContext, $this->translator, self::TRANS_DOMAIN, $this->metadata, 'currentValue', 'Group', 'foo.bar');
$this->assertSame(__NAMESPACE__ . '\\ExecutionContextTest_TestClass', $this->context->getCurrentClass());
$this->assertSame('myProperty', $this->context->getCurrentProperty());
restore_error_handler();
}
示例2: testValidateDataSetsCurrentPropertyToData
public function testValidateDataSetsCurrentPropertyToData()
{
$graphWalker = $this->createMockGraphWalker();
$metadataFactory = $this->createMockMetadataFactory();
$context = new ExecutionContext('Root', $graphWalker, $metadataFactory);
$object = $this->getMock('\\stdClass');
$form = new Form('author');
$test = $this;
$graphWalker->expects($this->once())->method('walkReference')->will($this->returnCallback(function () use($context, $test) {
$test->assertEquals('data', $context->getCurrentProperty());
}));
$form->setData($object);
$form->validateData($context);
}
示例3: testValidateFormChildrenSetsCurrentPropertyToData
public function testValidateFormChildrenSetsCurrentPropertyToData()
{
$graphWalker = $this->getMockGraphWalker();
$metadataFactory = $this->getMockMetadataFactory();
$context = new ExecutionContext('Root', $graphWalker, $metadataFactory);
$form = $this->getBuilder()->setAttribute('cascade_validation', true)->getForm();
$form->add($this->getForm('firstName'));
$test = $this;
$graphWalker->expects($this->once())->method('walkReference')->will($this->returnCallback(function () use($context, $test) {
$test->assertEquals('children', $context->getCurrentProperty());
}));
DelegatingValidator::validateFormChildren($form, $context);
}