當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。