2021-02-23 01:44:47 +13:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Appwrite\Tests;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
class CollectionsTest extends TestCase
|
|
|
|
{
|
|
|
|
protected $collections;
|
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
$this->collections = require('app/config/collections.php');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function tearDown(): void
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testDuplicateRules()
|
|
|
|
{
|
2021-04-15 02:39:04 +12:00
|
|
|
foreach ($this->collections as $key => $collection) {
|
|
|
|
if (array_key_exists('rules', $collection)) {
|
2021-02-23 01:44:47 +13:00
|
|
|
foreach ($collection['rules'] as $check) {
|
|
|
|
$occurences = 0;
|
|
|
|
foreach ($collection['rules'] as $rule) {
|
|
|
|
if ($rule['key'] == $check['key']) {
|
|
|
|
$occurences++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->assertEquals(1, $occurences);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|