/** * Test toString */ public function testToString() { $value = 'Opened'; $requestStatus = new RequestStatus(); $requestStatus->setLabel($value); $this->assertEquals($value, (string) $requestStatus); }
protected function assertRequestChangeStatus() { $requestStatusEntity = new RequestStatus(); $requestStatusEntity->setLabel('StatusLabel'); $status = $this->getMock('Symfony\\Component\\Form\\FormInterface'); $status->expects($this->once())->method('getData')->will($this->returnValue($requestStatusEntity)); $note = $this->getMock('Symfony\\Component\\Form\\FormInterface'); $note->expects($this->once())->method('getData')->will($this->returnValue('note')); $this->form->expects($this->exactly(2))->method('get')->with($this->logicalOr($this->equalTo('status'), $this->equalTo('note')))->will($this->returnCallback(function ($param) use($status, $note) { $data = null; switch ($param) { case 'status': $data = $status; break; case 'note': $data = $note; break; default: break; } return $data; })); $this->form->expects($this->once())->method('submit')->with($this->request); $this->templating->expects($this->once())->method('render')->with('OroB2BRFPBundle:Request:note.html.twig', ['status' => $requestStatusEntity->getLabel(), 'note' => 'note'])->will($this->returnValue('message')); }
/** * {@inheritdoc} */ public function loadEntities(ObjectManager $objectManager) { $localeSettings = $this->container->get('oro_locale.settings'); $defaultLocale = $localeSettings->getLocale(); $locales = $this->getTranslationLocales(); if (!in_array($defaultLocale, $locales, true)) { throw new \LogicException('There are no default locale in translations!'); } foreach ($this->items as $item) { $status = new RequestStatus(); $status->setSortOrder($item['order']); $status->setName($item['name']); foreach ($locales as $locale) { $label = $this->translate($item['name'], static::PREFIX, $locale); if ($locale == $defaultLocale) { $status->setLabel($label)->setLocale($locale); } else { $status->addTranslation((new RequestStatusTranslation())->setLocale($locale)->setField('label')->setContent($label)); } } $objectManager->persist($status); } $objectManager->flush(); }