getCurrentProperty() публичный Метод

public getCurrentProperty ( )
 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
0
 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
0
 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);
 }