appwrite/tests/unit/General/CollectionsTest.php

37 lines
914 B
PHP
Raw Normal View History

2021-02-22 12:44:47 +00: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-14 14:39:04 +00:00
foreach ($this->collections as $key => $collection) {
2021-12-01 11:48:23 +00:00
if (array_key_exists('attributes', $collection)) {
foreach ($collection['attributes'] as $check) {
2021-10-12 18:22:41 +00:00
$occurrences = 0;
2021-12-01 11:48:23 +00:00
foreach ($collection['attributes'] as $attribute) {
if ($attribute['$id'] == $check['$id']) {
2021-10-12 18:22:41 +00:00
$occurrences++;
2021-02-22 12:44:47 +00:00
}
}
2021-10-12 18:22:41 +00:00
$this->assertEquals(1, $occurrences);
2021-02-22 12:44:47 +00:00
}
}
}
}
}