Merge pull request #19552 from kamil-tekiela/Fix-default-values
[phpmyadmin.git] / tests / unit / ShowGrantsTest.php
bloba388e4ed11be300d1505a2e61c0dffd424e4691d
1 <?php
3 declare(strict_types=1);
5 namespace PhpMyAdmin\Tests;
7 use PhpMyAdmin\ShowGrants;
8 use PHPUnit\Framework\Attributes\CoversClass;
10 #[CoversClass(ShowGrants::class)]
11 class ShowGrantsTest extends AbstractTestCase
13 public function test1(): void
15 $showGrants = new ShowGrants('GRANT ALL PRIVILEGES ON *.* TO \'root\'@\'localhost\' WITH GRANT OPTION');
16 self::assertSame('ALL PRIVILEGES', $showGrants->grants);
17 self::assertSame('*', $showGrants->dbName);
18 self::assertSame('*', $showGrants->tableName);
21 public function test2(): void
23 $showGrants = new ShowGrants('GRANT ALL PRIVILEGES ON `mysql`.* TO \'root\'@\'localhost\' WITH GRANT OPTION');
24 self::assertSame('ALL PRIVILEGES', $showGrants->grants);
25 self::assertSame('mysql', $showGrants->dbName);
26 self::assertSame('*', $showGrants->tableName);
29 public function test3(): void
31 $showGrants = new ShowGrants(
32 'GRANT SELECT, INSERT, UPDATE, DELETE ON `mysql`.`columns_priv` TO \'root\'@\'localhost\'',
34 self::assertSame('SELECT, INSERT, UPDATE, DELETE', $showGrants->grants);
35 self::assertSame('mysql', $showGrants->dbName);
36 self::assertSame('columns_priv', $showGrants->tableName);
39 public function test4(): void
41 $showGrants = new ShowGrants('GRANT ALL PRIVILEGES ON `cptest\_.`.* TO \'cptest\'@\'localhost\'');
42 self::assertSame('cptest\_.', $showGrants->dbName);
44 $showGrants = new ShowGrants(
45 'GRANT ALL PRIVILEGES ON `cptest\_.a.b.c.d.e.f.g.h.i.j.k.'
46 . 'l.m.n.o.p.q.r.s.t.u.v.w.x.y.z`.* TO \'cptest\'@\'localhost\'',
48 self::assertSame('cptest\_.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z', $showGrants->dbName);