File tree Expand file tree Collapse file tree 8 files changed +58
-4
lines changed Expand file tree Collapse file tree 8 files changed +58
-4
lines changed Original file line number Diff line number Diff line change 2626 include :
2727 - php : ' 8.0'
2828 symfony-versions : ' ^6.0'
29+ coverage : ' none'
2930 - php : ' 8.1'
3031 symfony-versions : ' ^6.0'
32+ coverage : ' none'
3133 - description : ' Log Code Coverage'
3234 php : ' 8.1'
3335 coverage : ' xdebug'
Original file line number Diff line number Diff line change 3737
3838 - name : Run script
3939 run : vendor/bin/phpstan analyse
40+
41+ composer-validate :
42+ name : Composer validate
43+ runs-on : ubuntu-latest
44+ steps :
45+ - name : Checkout
46+ uses : actions/checkout@v2
47+
48+ - name : Setup PHP
49+ uses : shivammathur/setup-php@v2
50+
51+ - name : Install dependencies
52+ run : composer install --no-progress --no-interaction --prefer-dist
53+
54+ - name : Run script
55+ run : composer composer-validate
Original file line number Diff line number Diff line change 5252 }
5353 },
5454 "scripts" : {
55+ "composer-validate" : [
56+ " composer validate"
57+ ],
5558 "cs" : [
5659 " vendor/bin/phpcs"
5760 ],
Original file line number Diff line number Diff line change @@ -42,7 +42,8 @@ public function check(): array
4242 }
4343
4444 try {
45- $ entityManager ->getConnection ()->ping ();
45+ $ con = $ entityManager ->getConnection ();
46+ $ con ->executeQuery ($ con ->getDatabasePlatform ()->getDummySelectSQL ())->free ();
4647 } catch (Throwable $ e ) {
4748 return array_merge ($ result , [self ::CHECK_RESULT_KEY => false ]);
4849 }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace SymfonyHealthCheckBundle \Tests \Integration \Mock ;
6+
7+ class AbstractPlatformMock
8+ {
9+ public function getDummySelectSQL (): string
10+ {
11+ $ expression = func_num_args () > 0 ? func_get_arg (0 ) : '1 ' ;
12+
13+ return sprintf ('SELECT %s ' , $ expression );
14+ }
15+ }
Original file line number Diff line number Diff line change 66
77class ConnectionMock
88{
9- public function ping (): bool
9+ public function getDatabasePlatform (): AbstractPlatformMock
1010 {
11- return true ;
11+ return new AbstractPlatformMock ();
12+ }
13+
14+ public function executeQuery (): ExecuteQueryMock
15+ {
16+ return new ExecuteQueryMock ();
1217 }
1318}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace SymfonyHealthCheckBundle \Tests \Integration \Mock ;
6+
7+ class ExecuteQueryMock
8+ {
9+ public function free (): void
10+ {
11+ }
12+ }
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ public function testDoctrineFailPing(): void
104104 ->willReturn ($ connectionMock );
105105
106106 $ connectionMock
107- ->method ('ping ' )
107+ ->method ('getDatabasePlatform ' )
108108 ->with ()
109109 ->will (self ::throwException (new Exception ()));
110110
You can’t perform that action at this time.
0 commit comments