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


PHP ExecutionContext::getCurrentProperty方法代码示例

本文整理汇总了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();
 }
开发者ID:ronaldlunaramos,项目名称:webstore,代码行数:10,代码来源:ExecutionContextTest.php

示例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);
 }
开发者ID:nickaggarwal,项目名称:sample-symfony2,代码行数:14,代码来源:FormTest.php

示例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);
 }
开发者ID:neokensou,项目名称:symfony,代码行数:13,代码来源:DelegatingValidatorTest.php


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