1
0
Fork 0
mirror of synced 2024-07-06 07:00:56 +12:00
appwrite/tests/unit/Migration/MigrationV13Test.php

42 lines
1.2 KiB
PHP
Raw Normal View History

2022-05-09 02:31:50 +12:00
<?php
2022-08-01 22:22:04 +12:00
namespace Tests\Unit\Migration;
2022-05-09 02:31:50 +12:00
use ReflectionClass;
use Appwrite\Migration\Version\V13;
use Utopia\Database\Document;
2022-08-14 22:33:36 +12:00
use Utopia\Database\ID;
2022-05-09 02:31:50 +12:00
class MigrationV13Test extends MigrationTest
{
public function setUp(): void
{
$this->migration = new V13();
$reflector = new ReflectionClass('Appwrite\Migration\Version\V13');
$this->method = $reflector->getMethod('fixDocument');
$this->method->setAccessible(true);
}
2022-08-01 22:22:04 +12:00
public function testMigrateFunctions(): void
2022-05-09 02:31:50 +12:00
{
$document = $this->fixDocument(new Document([
2022-08-14 22:33:36 +12:00
'$id' => ID::custom('func'),
'$collection' => ID::custom('functions'),
2022-05-09 02:31:50 +12:00
'events' => ['account.create', 'users.create']
]));
$this->assertEquals($document->getAttribute('events'), ['users.*.create']);
}
2022-08-01 22:22:04 +12:00
public function testMigrationWebhooks(): void
2022-05-09 02:31:50 +12:00
{
$document = $this->fixDocument(new Document([
2022-08-14 22:33:36 +12:00
'$id' => ID::custom('webh'),
'$collection' => ID::custom('webhooks'),
2022-05-09 02:31:50 +12:00
'events' => ['account.create', 'users.create']
]));
$this->assertEquals($document->getAttribute('events'), ['users.*.create']);
}
}