public function testAddingErrorToNonEditableSystemEntity() { $this->entity->setIsSystem(true); $this->entity->setIsEditable(false); $this->form->expects($this->once())->method('setData')->with($this->entity); $this->form->expects($this->once())->method('addError'); $this->request->setMethod('POST'); $this->translator->expects($this->once())->method('trans'); $this->assertFalse($this->handler->process($this->entity)); }
/** * @dataProvider localeDataProvider * * @param string|null $defaultLocale * @param int|null $id * @param bool $expectedRefresh */ public function testShouldPresetDefaultLocale($defaultLocale, $id, $expectedRefresh) { $this->form->expects($this->once())->method('setData')->with($this->entity); $this->manager->expects($expectedRefresh ? $this->once() : $this->never())->method('refresh')->with($this->entity); $this->setEntityId($id); $this->handler->setDefaultLocale($defaultLocale); $this->handler->process($this->entity); $this->assertSame($defaultLocale, $this->entity->getLocale()); }