Skip to content
Snippets Groups Projects
Commit 5a2e7d2d authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Add some very basic API tests

parent b0b02c6d
No related branches found
No related tags found
No related merge requests found
Pipeline #16445 passed
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "a224ab344497eaff627fc37360295ae2", "content-hash": "f316125123858eef6044de806b7dfde5",
"packages": [ "packages": [
{ {
"name": "adldap2/adldap2", "name": "adldap2/adldap2",
...@@ -7688,6 +7688,77 @@ ...@@ -7688,6 +7688,77 @@
], ],
"time": "2020-10-26T13:10:38+00:00" "time": "2020-10-26T13:10:38+00:00"
}, },
{
"name": "symfony/browser-kit",
"version": "v4.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/browser-kit.git",
"reference": "f6f060bdc473c3f3b1f00e2ebdeb3d02eda77f82"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/f6f060bdc473c3f3b1f00e2ebdeb3d02eda77f82",
"reference": "f6f060bdc473c3f3b1f00e2ebdeb3d02eda77f82",
"shasum": ""
},
"require": {
"php": ">=7.1.3",
"symfony/dom-crawler": "^3.4|^4.0|^5.0"
},
"require-dev": {
"symfony/css-selector": "^3.4|^4.0|^5.0",
"symfony/http-client": "^4.3|^5.0",
"symfony/mime": "^4.3|^5.0",
"symfony/process": "^3.4|^4.0|^5.0"
},
"suggest": {
"symfony/process": ""
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\BrowserKit\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/browser-kit/tree/v4.4.19"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-01-27T09:09:26+00:00"
},
{ {
"name": "symfony/debug-bundle", "name": "symfony/debug-bundle",
"version": "v4.4.19", "version": "v4.4.19",
...@@ -7766,6 +7837,159 @@ ...@@ -7766,6 +7837,159 @@
], ],
"time": "2021-01-10T16:25:35+00:00" "time": "2021-01-10T16:25:35+00:00"
}, },
{
"name": "symfony/dom-crawler",
"version": "v4.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
"reference": "21032c566558255e551d23f4a516434c9e3a9a78"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/21032c566558255e551d23f4a516434c9e3a9a78",
"reference": "21032c566558255e551d23f4a516434c9e3a9a78",
"shasum": ""
},
"require": {
"php": ">=7.1.3",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-mbstring": "~1.0"
},
"conflict": {
"masterminds/html5": "<2.6"
},
"require-dev": {
"masterminds/html5": "^2.6",
"symfony/css-selector": "^3.4|^4.0|^5.0"
},
"suggest": {
"symfony/css-selector": ""
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\DomCrawler\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Eases DOM navigation for HTML and XML documents",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/dom-crawler/tree/v4.4.19"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-01-27T09:09:26+00:00"
},
{
"name": "symfony/http-client",
"version": "v4.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client.git",
"reference": "d8df50fe9229576b254c6822eb5cfff36c02c967"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-client/zipball/d8df50fe9229576b254c6822eb5cfff36c02c967",
"reference": "d8df50fe9229576b254c6822eb5cfff36c02c967",
"shasum": ""
},
"require": {
"php": ">=7.1.3",
"psr/log": "^1.0",
"symfony/http-client-contracts": "^1.1.10|^2",
"symfony/polyfill-php73": "^1.11",
"symfony/service-contracts": "^1.0|^2"
},
"provide": {
"php-http/async-client-implementation": "*",
"php-http/client-implementation": "*",
"psr/http-client-implementation": "1.0",
"symfony/http-client-implementation": "1.1"
},
"require-dev": {
"guzzlehttp/promises": "^1.4",
"nyholm/psr7": "^1.0",
"php-http/httplug": "^1.0|^2.0",
"psr/http-client": "^1.0",
"symfony/dependency-injection": "^4.3|^5.0",
"symfony/http-kernel": "^4.4.13",
"symfony/process": "^4.2|^5.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\HttpClient\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-client/tree/v4.4.19"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-01-27T09:09:26+00:00"
},
{ {
"name": "symfony/options-resolver", "name": "symfony/options-resolver",
"version": "v4.4.19", "version": "v4.4.19",
......
framework:
test: true
\ No newline at end of file
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<server name="SHELL_VERBOSITY" value="-1"/> <server name="SHELL_VERBOSITY" value="-1"/>
<server name="SYMFONY_PHPUNIT_REMOVE" value=""/> <server name="SYMFONY_PHPUNIT_REMOVE" value=""/>
<server name="SYMFONY_PHPUNIT_VERSION" value="9"/> <server name="SYMFONY_PHPUNIT_VERSION" value="9"/>
<server name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
</php> </php>
<testsuites> <testsuites>
<testsuite name="Project Test Suite"> <testsuite name="Project Test Suite">
......
...@@ -211,6 +211,9 @@ ...@@ -211,6 +211,9 @@
"symfony/asset": { "symfony/asset": {
"version": "v4.4.16" "version": "v4.4.16"
}, },
"symfony/browser-kit": {
"version": "v4.4.19"
},
"symfony/cache": { "symfony/cache": {
"version": "v4.4.16" "version": "v4.4.16"
}, },
...@@ -257,6 +260,9 @@ ...@@ -257,6 +260,9 @@
"symfony/doctrine-bridge": { "symfony/doctrine-bridge": {
"version": "v4.4.16" "version": "v4.4.16"
}, },
"symfony/dom-crawler": {
"version": "v4.4.19"
},
"symfony/dotenv": { "symfony/dotenv": {
"version": "v4.4.16" "version": "v4.4.16"
}, },
...@@ -311,6 +317,9 @@ ...@@ -311,6 +317,9 @@
"src/Kernel.php" "src/Kernel.php"
] ]
}, },
"symfony/http-client": {
"version": "v4.4.19"
},
"symfony/http-client-contracts": { "symfony/http-client-contracts": {
"version": "v2.3.1" "version": "v2.3.1"
}, },
......
<?php
declare(strict_types=1);
namespace App\Tests;
use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\ApiTestCase;
use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\Client;
use Symfony\Component\HttpFoundation\Response;
class Test extends ApiTestCase
{
/** @var Client */
protected $client;
protected function setUp(): void
{
parent::setUp();
$this->client = static::createClient();
}
public function testIndex()
{
$response = $this->client->request('GET', '/');
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
}
public function testJSONLD()
{
$response = $this->client->request('GET', '/', ['headers' => ['HTTP_ACCEPT' => 'application/ld+json']]);
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
$this->assertJson($response->getContent(false));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment