File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131 */
3232class BatchTest extends SystemTestCase
3333{
34- use SystemTestCaseTrait;
3534 use DatabaseRoleTrait;
35+ use SystemTestCaseTrait;
3636
3737 private static $ tableName ;
3838 private static $ isSetup = false ;
@@ -59,22 +59,22 @@ public static function setUpTestFixtures(): void
5959
6060 if (self ::$ database ->info ()['databaseDialect ' ] == DatabaseDialect::GOOGLE_STANDARD_SQL ) {
6161 $ statements = [
62- sprintf ('CREATE ROLE %s ' , self ::$ dbRole ),
63- sprintf ('CREATE ROLE %s ' , self ::$ restrictiveDbRole ),
62+ sprintf ('CREATE ROLE %s ' , self ::DATABASE_ROLE ),
63+ sprintf ('CREATE ROLE %s ' , self ::RESTRICTIVE_DATABASE_ROLE ),
6464 ];
6565
6666 if (!self ::isEmulatorUsed ()) {
6767 $ statements [] = sprintf (
68- 'GRANT SELECT(id) ON TABLE %s TO %s ' ,
68+ 'GRANT SELECT(id) ON TABLE %s TO ROLE %s ' ,
6969 self ::$ tableName ,
70- self ::$ restrictiveDbRole
70+ self ::RESTRICTIVE_DATABASE_ROLE
7171 );
7272 }
7373
7474 $ statements [] = sprintf (
75- 'GRANT SELECT ON TABLE %s TO %s ' ,
75+ 'GRANT SELECT ON TABLE %s TO ROLE %s ' ,
7676 self ::$ tableName ,
77- self ::$ dbRole
77+ self ::DATABASE_ROLE
7878 );
7979
8080 self ::$ database ->updateDdlBatch ($ statements )->pollUntilComplete ();
Original file line number Diff line number Diff line change 2424 */
2525trait DatabaseRoleTrait
2626{
27- private static $ restrictiveDbRole = 'restrictiveReaderRole ' ;
28- private static $ dbRole = 'readerRole ' ;
29-
3027 abstract public static function setUpBeforeClass ();
3128
3229 public function dbProvider ()
3330 {
3431 self ::setUpTestFixtures ();
3532 return [
36- [self ::$ restrictiveDbRole , 'PERMISSION_DENIED ' ],
37- [self ::$ dbRole , null ]
33+ [self ::RESTRICTIVE_DATABASE_ROLE , 'PERMISSION_DENIED ' ],
34+ [self ::DATABASE_ROLE , null ]
3835 ];
3936 }
4037
Original file line number Diff line number Diff line change 3030 */
3131class PgBatchTest extends SystemTestCase
3232{
33- use PgSystemTestCaseTrait;
3433 use DatabaseRoleTrait;
34+ use PgSystemTestCaseTrait;
3535
3636 private static $ tableName ;
3737 private static $ hasSetupBatch = false ;
@@ -63,20 +63,20 @@ public static function setUpTestFixtures(): void
6363
6464 if (self ::$ database ->info ()['databaseDialect ' ] == DatabaseDialect::POSTGRESQL ) {
6565 $ statements = [
66- sprintf ('CREATE ROLE %s ' , self ::$ dbRole ),
67- sprintf ('CREATE ROLE %s ' , self ::$ restrictiveDbRole ),
66+ sprintf ('CREATE ROLE %s ' , self ::DATABASE_ROLE ),
67+ sprintf ('CREATE ROLE %s ' , self ::RESTRICTIVE_DATABASE_ROLE ),
6868 ];
6969
7070 if (!self ::isEmulatorUsed ()) {
7171 $ statements [] = sprintf (
7272 'GRANT SELECT(id) ON TABLE %s TO %s ' ,
7373 self ::$ tableName ,
74- self ::$ restrictiveDbRole
74+ self ::RESTRICTIVE_DATABASE_ROLE
7575 );
7676 $ statements [] = sprintf (
7777 'GRANT SELECT ON TABLE %s TO %s ' ,
7878 self ::$ tableName ,
79- self ::$ dbRole
79+ self ::DATABASE_ROLE
8080 );
8181 }
8282
You can’t perform that action at this time.
0 commit comments