Skip to content

Commit 98ad455

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 79b1e4d + d335c4e commit 98ad455

File tree

8 files changed

+204
-66
lines changed

8 files changed

+204
-66
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"czproject/git-php": "^3.12",
99
"php-http/httplug-pack": "^1.1",
1010
"psr/simple-cache": "^1.0",
11-
"robinvdvleuten/ulid": "^1.1",
11+
"robinvdvleuten/ulid": "^3.0",
1212
"sensio/framework-extra-bundle": "^5.1",
1313
"symfony/apache-pack": "^1.0",
1414
"symfony/asset": "^4.0",
@@ -25,6 +25,7 @@
2525
"symfony/yaml": "^4.0"
2626
},
2727
"require-dev": {
28+
"symfony/browser-kit": "^4.1",
2829
"symfony/debug-pack": "^1.0",
2930
"symfony/phpunit-bridge": "^4.0",
3031
"symfony/web-server-bundle": "^4.0"
@@ -68,7 +69,6 @@
6869
},
6970
"extra": {
7071
"symfony": {
71-
"id": "01C6C88WKQP047F412R9EYCFV0",
7272
"allow-contrib": false
7373
}
7474
}

composer.lock

Lines changed: 123 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
sensio_framework_extra:
2+
router:
3+
annotations: false

docs/topics/prerequisites.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
In order to run the server, you'll need a server which
44

5-
* is capable of running Symfony 4. This means: PHP 7.1
5+
* is capable of running Symfony 4. This means: PHP 7.2
66
* has git installed
77
* has Composer installed
88
* is able to load the repos. That means: Access to the internet is needed, also some free disk space.
99

1010
It is recommended to setup some sort of monitoring. We use [Sentry](https://sentry.io).
1111

12-
SSH access is useful to run [commands](commands.md) on the server.
12+
SSH access is useful to run [commands](commands.md) on the server.

src/Service/Provider/UlidProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ class UlidProvider
2727
*/
2828
public function provideUlid()
2929
{
30-
return strtoupper(Ulid::generate());
30+
return (string) Ulid::generate();
3131
}
3232
}

symfony.lock

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@
6565
"config/packages/nyholm_psr7.yaml"
6666
]
6767
},
68-
"paragonie/random_compat": {
69-
"version": "v2.0.11"
70-
},
7168
"php-http/cache-plugin": {
7269
"version": "v1.5.0"
7370
},
@@ -158,6 +155,9 @@
158155
"symfony/asset": {
159156
"version": "v4.0.4"
160157
},
158+
"symfony/browser-kit": {
159+
"version": "v4.3.4"
160+
},
161161
"symfony/cache": {
162162
"version": "v4.0.4"
163163
},
@@ -194,6 +194,9 @@
194194
"symfony/dependency-injection": {
195195
"version": "v4.0.4"
196196
},
197+
"symfony/dom-crawler": {
198+
"version": "v4.3.4"
199+
},
197200
"symfony/dotenv": {
198201
"version": "v4.0.4"
199202
},
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace App\Tests\Controller;
4+
5+
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
6+
7+
class EndpointControllerTest extends WebTestCase
8+
{
9+
public function testUlid()
10+
{
11+
$client = self::createClient();
12+
13+
$client->request('GET', '/ulid');
14+
$response = $client->getResponse();
15+
16+
$this->assertEquals(200, $response->getStatusCode());
17+
$this->assertEquals('application/json', $response->headers->get('Content-Type'));
18+
19+
$data = json_decode($response->getContent(), true);
20+
21+
$this->assertEquals(JSON_ERROR_NONE, json_last_error());
22+
$this->assertArrayHasKey('ulid', $data);
23+
}
24+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace App\Tests\Service\Provider;
4+
5+
use App\Service\Provider\UlidProvider;
6+
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
7+
8+
class UlidProviderTest extends KernelTestCase
9+
{
10+
public static function setUpBeforeClass()
11+
{
12+
parent::setUpBeforeClass();
13+
self::bootKernel();
14+
}
15+
16+
public function testServiceIsAvailable()
17+
{
18+
$ulidProvider = self::$container->get(UlidProvider::class);
19+
$this->assertInstanceOf(UlidProvider::class, $ulidProvider);
20+
21+
return $ulidProvider;
22+
}
23+
24+
/**
25+
* @depends testServiceIsAvailable
26+
*
27+
* @param UlidProvider $ulidProvider
28+
*/
29+
public function testUlidLength(UlidProvider $ulidProvider)
30+
{
31+
$this->assertSame(26, strlen((string) $ulidProvider->provideUlid()));
32+
}
33+
34+
/**
35+
* @depends testServiceIsAvailable
36+
*
37+
* @param UlidProvider $ulidProvider
38+
*/
39+
public function testUlidIsUppercased(UlidProvider $ulidProvider)
40+
{
41+
$this->assertRegExp('/[0-9][A-Z]/', (string) $ulidProvider->provideUlid());
42+
}
43+
}

0 commit comments

Comments
 (0)