/**
  * {@inheritdoc}
  */
 public function apply(Request $request, ParamConverter $configuration)
 {
     $comment = new Comment();
     $comment->setSubject('old subject');
     $request->attributes->set($configuration->getName(), $comment);
     return true;
 }
 /**
  * @expectedException \Ibrows\JsonPatch\Exception\ResolvePathException
  * @expectedExceptionMessage Could not resolve path "subject" on current address.
  */
 public function testJMSGroups()
 {
     $operations = $this->getPatchConverter()->convert([['op' => 'replace', 'path' => '/subject', 'value' => 'something']]);
     $comment = new Comment();
     $comment->setSubject('subject before');
     $context = DeserializationContext::create();
     $context->setGroups(['emptyGroup']);
     $this->getExecutioner()->execute($operations, $comment, ['jms_context' => $context]);
 }
Example #3
0
 /**
  * @expectedException \Ibrows\JsonPatch\Exception\OverridePathException
  * @expectedExceptionMessage Could not add on path "subject" because it already exists.
  */
 public function testOverrideObject()
 {
     $operations = $this->getPatchConverter()->convert([['op' => 'add', 'path' => '/subject', 'value' => 'new subject']]);
     $comment = new Comment();
     $comment->setSubject('old subject');
     $this->getExecutioner()->execute($operations, $comment);
 }