access_control:
- { path: ^/api/doc, roles: IS_AUTHENTICATED_ANONYMOUSLY }
+ - { path: ^/api/version, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
return $this->renderJsonResponse($json);
}
+ /**
+ * Retrieve version number.
+ *
+ * @ApiDoc()
+ *
+ * @return Response
+ */
+ public function getVersionAction()
+ {
+ $version = $this->container->getParameter('wallabag_core.version');
+
+ $json = $this->get('serializer')->serialize($version, 'json');
+
+ return $this->renderJsonResponse($json);
+ }
/**
* Validate that the first id is equal to the second one.
$this->assertCount(0, $entries);
}
+
+ public function testGetVersion()
+ {
+ $this->client->request('GET', '/api/version');
+
+ $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
+
+ $content = json_decode($this->client->getResponse()->getContent(), true);
+
+ $this->assertEquals($this->client->getContainer()->getParameter('wallabag_core.version'), $content);
+ }
}