public function testRunWithAdditionalGroup() { /** @var Client $clientOld */ $clientOld = $this->em->getRepository('Test\\TestBundle\\Entity\\Client')->find(1); $this->em->detach($clientOld); $clientToSerialize = new Client(); $clientToSerialize->setName('Oper'); $clientToSerialize->setPatronymic('Polyiakova'); $context = SerializationContext::create()->setGroups([PatchAction::GROUP_DEFAULT, PatchAction::GROUP_PATCH, 'some']); $resp = $this->action->setClassName('Test\\TestBundle\\Entity\\Client')->setEntityId(1)->setRequestContent($this->serializer->serialize($clientToSerialize, 'json', $context))->setSerializationContextGroups(['some'])->init()->run(); $this->em->clear(); $this->assertTrue($resp->isSuccess()); $this->assertEquals(RestResponse::STATUS_CODE_OK, $resp->getStatusCode()); /** @var Client $clientFromResp */ $clientFromResp = $resp->getData(); /** @var Client $clientFromDB */ $clientFromDB = $this->em->getRepository('Test\\TestBundle\\Entity\\Client')->find(1); $this->assertEquals(1, $clientFromDB->getId()); $this->assertEquals(1, $clientFromResp->getId()); $this->assertEquals('Oper', $clientFromDB->getName()); $this->assertEquals('Oper', $clientFromResp->getName()); $this->assertEquals('Polyiakova', $clientFromDB->getPatronymic()); $this->assertEquals('Polyiakova', $clientFromResp->getPatronymic()); }