Neos\Flow\Fixtures\ClassWithSettersAndConstructor::setProperty2 PHP Метод

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

public setProperty2 ( $property2 )
    public function setProperty2($property2)
    {
        $this->property2 = $property2;
    }

Usage Example

 /**
  * @test
  */
 public function convertFromShouldCreateObjectWhenThereAreConstructorParameters()
 {
     $source = ['propertyX' => 'bar'];
     $convertedChildProperties = ['property1' => 'param1', 'property2' => 'bar'];
     $expectedObject = new ClassWithSettersAndConstructor('param1');
     $expectedObject->setProperty2('bar');
     $this->mockReflectionService->expects($this->once())->method('hasMethod')->with(ClassWithSettersAndConstructor::class, '__construct')->will($this->returnValue(true));
     $this->mockReflectionService->expects($this->once())->method('getMethodParameters')->with(ClassWithSettersAndConstructor::class, '__construct')->will($this->returnValue(['property1' => ['optional' => false]]));
     $this->mockObjectManager->expects($this->once())->method('getClassNameByObjectName')->with(ClassWithSettersAndConstructor::class)->will($this->returnValue(ClassWithSettersAndConstructor::class));
     $configuration = $this->buildConfiguration([PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED => true]);
     $result = $this->converter->convertFrom($source, ClassWithSettersAndConstructor::class, $convertedChildProperties, $configuration);
     $this->assertEquals($expectedObject, $result);
     $this->assertEquals('bar', $expectedObject->getProperty2());
 }