Change Trigger::$table type to use TableName object
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
a2ed355faf
commit
1582b69591
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Triggers;
|
||||
|
||||
use PhpMyAdmin\Dbal\TableName;
|
||||
use Webmozart\Assert\Assert;
|
||||
use Webmozart\Assert\InvalidArgumentException;
|
||||
|
||||
@ -13,7 +14,7 @@ final class Trigger
|
||||
public readonly string $name,
|
||||
public readonly Timing $timing,
|
||||
public readonly Event $event,
|
||||
public readonly string $table,
|
||||
public readonly TableName $table,
|
||||
public readonly string $statement,
|
||||
public readonly string $definer,
|
||||
) {
|
||||
@ -37,6 +38,8 @@ final class Trigger
|
||||
$event = Event::tryFrom($event);
|
||||
Assert::notNull($event);
|
||||
Assert::string($table);
|
||||
$table = TableName::tryFromValue($table);
|
||||
Assert::notNull($table);
|
||||
Assert::string($statement);
|
||||
Assert::string($definer);
|
||||
|
||||
|
||||
@ -522,7 +522,7 @@ class Triggers
|
||||
|
||||
$oneResult = [];
|
||||
$oneResult['name'] = $newTrigger->name;
|
||||
$oneResult['table'] = $newTrigger->table;
|
||||
$oneResult['table'] = $newTrigger->table->getName();
|
||||
$oneResult['action_timing'] = $newTrigger->timing->value;
|
||||
$oneResult['event_manipulation'] = $newTrigger->event->value;
|
||||
$oneResult['definition'] = $newTrigger->statement;
|
||||
|
||||
@ -29,7 +29,7 @@ class TriggerTest extends TestCase
|
||||
$this->assertSame('trigger_name', $actual->name);
|
||||
$this->assertSame(Timing::Before, $actual->timing);
|
||||
$this->assertSame(Event::Update, $actual->event);
|
||||
$this->assertSame('test_table', $actual->table);
|
||||
$this->assertSame('test_table', $actual->table->getName());
|
||||
$this->assertSame('BEGIN END', $actual->statement);
|
||||
$this->assertSame('definer@localhost', $actual->definer);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user