1
0
Fork 0
mirror of synced 2024-09-19 10:59:50 +12:00
appwrite/tests/unit/Utopia/Database/Validator/Query/SelectTest.php

46 lines
1.1 KiB
PHP
Raw Normal View History

2023-03-23 10:10:47 +13:00
<?php
namespace Tests\Unit\Utopia\Database\Validator\Query;
use Appwrite\Utopia\Database\Validator\Query\Base;
2023-03-24 03:33:11 +13:00
use Appwrite\Utopia\Database\Validator\Query\Order;
2023-03-23 10:10:47 +13:00
use Appwrite\Utopia\Database\Validator\Query\Select;
2023-03-24 03:33:11 +13:00
use Utopia\Database\Database;
use Utopia\Database\Document;
2023-03-23 10:10:47 +13:00
use Utopia\Database\Query;
use PHPUnit\Framework\TestCase;
class SelectTest extends TestCase
{
/**
* @var Base
*/
protected $validator = null;
public function setUp(): void
{
2023-03-24 03:33:11 +13:00
$this->validator = new Select(
attributes: [
new Document([
'key' => 'attr',
'type' => Database::VAR_STRING,
'array' => false,
]),
],
);
2023-03-23 10:10:47 +13:00
}
public function tearDown(): void
{
}
public function testValue(): void
{
// Test for Success
2023-03-24 03:33:11 +13:00
$this->assertEquals($this->validator->isValid(Query::select(['*', 'attr'])), true, $this->validator->getDescription());
2023-03-23 10:10:47 +13:00
// Test for Failure
$this->assertEquals($this->validator->isValid(Query::limit(1)), false, $this->validator->getDescription());
}
}