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

33 lines
880 B
PHP
Raw Normal View History

2021-02-23 01:44:47 +13:00
<?php
2022-08-01 22:22:04 +12:00
namespace Tests\Unit\General;
2021-02-23 01:44:47 +13:00
use PHPUnit\Framework\TestCase;
class CollectionsTest extends TestCase
{
2022-08-01 22:22:04 +12:00
protected array $collections;
2021-02-23 01:44:47 +13:00
public function setUp(): void
{
$this->collections = require('app/config/collections.php');
}
2022-08-01 22:22:04 +12:00
public function testDuplicateRules(): void
2021-02-23 01:44:47 +13:00
{
2021-04-15 02:39:04 +12:00
foreach ($this->collections as $key => $collection) {
2021-12-02 00:48:23 +13:00
if (array_key_exists('attributes', $collection)) {
foreach ($collection['attributes'] as $check) {
2021-10-13 07:22:41 +13:00
$occurrences = 0;
2021-12-02 00:48:23 +13:00
foreach ($collection['attributes'] as $attribute) {
if ($attribute['$id'] == $check['$id']) {
2021-10-13 07:22:41 +13:00
$occurrences++;
2021-02-23 01:44:47 +13:00
}
}
2021-10-13 07:22:41 +13:00
$this->assertEquals(1, $occurrences);
2021-02-23 01:44:47 +13:00
}
}
}
}
}