File tree Expand file tree Collapse file tree 8 files changed +204
-66
lines changed
Expand file tree Collapse file tree 8 files changed +204
-66
lines changed Original file line number Diff line number Diff line change 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" ,
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"
6869 },
6970 "extra" : {
7071 "symfony" : {
71- "id" : " 01C6C88WKQP047F412R9EYCFV0" ,
7272 "allow-contrib" : false
7373 }
7474 }
Original file line number Diff line number Diff line change 1+ sensio_framework_extra :
2+ router :
3+ annotations : false
Original file line number Diff line number Diff line change 22
33In 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
1010It 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.
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff line change 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 },
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 },
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 },
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments