/**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->translator = $this->getMock('Symfony\\Component\\Translation\\TranslatorInterface');
     $this->formType = new RequestProductType($this->translator);
     $this->formType->setDataClass('OroB2B\\Bundle\\RFPBundle\\Entity\\RequestProduct');
     parent::setUp();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     /* @var $productUnitLabelFormatter ProductUnitLabelFormatter|\PHPUnit_Framework_MockObject_MockObject */
     $productUnitLabelFormatter = $this->getMockBuilder('OroB2B\\Bundle\\ProductBundle\\Formatter\\ProductUnitLabelFormatter')->disableOriginalConstructor()->getMock();
     $productUnitLabelFormatter->expects($this->any())->method('format')->will($this->returnCallback(function ($unitCode, $short) {
         return $unitCode . '-formatted-' . ($short ? 'short' : 'full');
     }));
     $this->formType = new RequestProductType($productUnitLabelFormatter);
     $this->formType->setDataClass('OroB2B\\Bundle\\RFPBundle\\Entity\\RequestProduct');
     parent::setUp();
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $requestStatus = new RequestStatus();
     $requestStatus->setName(RequestStatus::OPEN);
     /* @var $repository ObjectRepository|\PHPUnit_Framework_MockObject_MockObject */
     $repository = $this->getMockBuilder('Doctrine\\Common\\Persistence\\ObjectRepository')->disableOriginalConstructor()->getMock();
     $repository->expects(static::any())->method('findOneBy')->with(['name' => RequestStatus::OPEN])->willReturn($requestStatus);
     /* @var $manager ObjectManager|\PHPUnit_Framework_MockObject_MockObject */
     $manager = $this->getMockBuilder('Doctrine\\Common\\Persistence\\ObjectManager')->disableOriginalConstructor()->getMock();
     $manager->expects(static::any())->method('getRepository')->with(self::REQUEST_STATUS_CLASS)->willReturn($repository);
     /* @var $registry ManagerRegistry|\PHPUnit_Framework_MockObject_MockObject */
     $registry = $this->getMockBuilder('Doctrine\\Common\\Persistence\\ManagerRegistry')->disableOriginalConstructor()->getMock();
     $registry->expects(static::any())->method('getManagerForClass')->with(self::REQUEST_STATUS_CLASS)->willReturn($manager);
     /* @var $configManager ConfigManager|\PHPUnit_Framework_MockObject_MockObject */
     $configManager = $this->getMockBuilder('Oro\\Bundle\\ConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $configManager->expects(static::any())->method('get')->with('oro_b2b_rfp.default_request_status')->willReturn(RequestStatus::OPEN);
     $this->formType = new RequestType($configManager, $registry);
     $this->formType->setDataClass(self::DATA_CLASS);
     $this->formType->setRequestStatusClass(self::REQUEST_STATUS_CLASS);
     parent::setUp();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->formType = new RequestProductItemType();
     $this->formType->setDataClass('OroB2B\\Bundle\\RFPBundle\\Entity\\RequestProductItem');
 }