1
0
Fork 0
mirror of synced 2024-08-04 04:52:03 +12:00
appwrite/tests/unit/General/CollectionsTest.php

35 lines
993 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
{
foreach ($this->collections as $key => $sections) {
foreach ($sections as $key => $collection) {
if (array_key_exists('attributes', $collection)) {
foreach ($collection['attributes'] as $check) {
$occurrences = 0;
foreach ($collection['attributes'] as $attribute) {
if ($attribute['$id'] == $check['$id']) {
$occurrences++;
}
2021-02-23 01:44:47 +13:00
}
$this->assertEquals(1, $occurrences);
2021-02-23 01:44:47 +13:00
}
}
}
}
}
}