/** * Create a collection type with given parameter. * * @param int $id * @param string $key * @param string $name * * @return CollectionType */ private function createCollectionType($id, $key, $name) { $collectionType = new CollectionType(); $collectionType->setId($id); $collectionType->setKey($key); $collectionType->setName($name); return $collectionType; }
/** * @description Test PUT action without details */ public function testPutNoDetails() { $client = $this->createAuthenticatedClient(); // Add New Collection Type $collectionType = new CollectionType(); $collectionType->setName('Second Collection Type'); $collectionType->setKey('my-type'); $collectionType->setDescription('Second Collection Type'); $this->em->persist($collectionType); $this->em->flush(); // Test put with only details $client->request('PUT', '/api/collections/' . $this->collection1->getId(), ['style' => ['type' => 'quader', 'color' => '#00ccff'], 'type' => ['id' => $collectionType->getId()]]); $this->assertEquals(200, $client->getResponse()->getStatusCode()); $client->request('GET', '/api/collections/' . $this->collection1->getId() . '?locale=en-gb'); $response = json_decode($client->getResponse()->getContent()); $this->assertEquals(200, $client->getResponse()->getStatusCode()); $style = new \stdClass(); $style->type = 'quader'; $style->color = '#00ccff'; $this->assertEquals($style, $response->style); $this->assertNotNull($response->type->id); }