本文整理汇总了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);
}