public function testOnPostCallWithRendermodeWithTextHtmlHeader() { $content = new MockContent(); $content->mockedDefineParam('rendermode', ['type' => 'select', 'value' => []]); $listener = new ClassContentListener(); $data = json_encode(self::$contentManager->jsonEncode($content, AbstractContent::JSON_CONCISE_FORMAT)); $request = Request::create('test', "GET"); $response = Response::create($data, 200, ['CONTENT_TYPE' => 'text/html']); $listener->onPostCall($this->createPostResponseEvent($response, $request)); $responseContent = json_decode($response->getContent()); $this->assertFalse(isset($responseContent->parameters->rendermode->options)); }
public function testAutomaticReplacementOnDeleteClassContentElement() { $content = new MockContent(); self::$em->persist($content); self::$em->flush($content); self::$em->clear(); $repository = self::$em->getRepository(get_class($content)); $content = $repository->find($content->getUid()); $titleUid = $content->title->getUid(); $repository->deleteContent($content->title, true); self::$em->flush(); $this->assertNotNull($content->title); $this->assertTrue($titleUid !== $content->title->getUid()); $this->assertNotNull(self::$em->find(get_class($content->title), $content->title->getUid()), 'Replacement title must be persisted into database.'); $this->assertNotNull(self::$contentManager->getDraft($content->title), 'Replacement title must also own a draft'); }