1
0
Fork 0
mirror of synced 2024-05-19 20:22:33 +12:00
appwrite/tests/unit/General/CollectionsTest.php

37 lines
914 B
PHP
Raw Normal View History

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) {
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
}
}
}
}
}