2024-06-08 23:58:45 +00:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Test\Unit;
|
|
|
|
|
|
|
|
use BitBadger\PDODocument\Op;
|
|
|
|
use PHPUnit\Framework\Attributes\TestDox;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unit tests for the Op enumeration
|
|
|
|
*/
|
2024-06-12 21:43:17 +00:00
|
|
|
#[TestDox('Op (Unit tests)')]
|
2024-06-08 23:58:45 +00:00
|
|
|
class OpTest extends TestCase
|
|
|
|
{
|
|
|
|
#[TestDox('To string succeeds for EQ')]
|
|
|
|
public function testToStringSucceedsForEQ(): void
|
|
|
|
{
|
|
|
|
$this->assertEquals('=', Op::EQ->toString(), 'EQ operator incorrect');
|
|
|
|
}
|
|
|
|
|
|
|
|
#[TestDox('To string succeeds for GT')]
|
|
|
|
public function testToStringSucceedsForGT(): void
|
|
|
|
{
|
|
|
|
$this->assertEquals('>', Op::GT->toString(), 'GT operator incorrect');
|
|
|
|
}
|
|
|
|
|
|
|
|
#[TestDox('To string succeeds for GE')]
|
|
|
|
public function testToStringSucceedsForGE(): void
|
|
|
|
{
|
|
|
|
$this->assertEquals('>=', Op::GE->toString(), 'GE operator incorrect');
|
|
|
|
}
|
|
|
|
|
|
|
|
#[TestDox('To string succeeds for LT')]
|
|
|
|
public function testToStringSucceedsForLT(): void
|
|
|
|
{
|
|
|
|
$this->assertEquals('<', Op::LT->toString(), 'LT operator incorrect');
|
|
|
|
}
|
|
|
|
|
|
|
|
#[TestDox('To string succeeds for LE')]
|
|
|
|
public function testToStringSucceedsForLE(): void
|
|
|
|
{
|
|
|
|
$this->assertEquals('<=', Op::LE->toString(), 'LE operator incorrect');
|
|
|
|
}
|
|
|
|
|
|
|
|
#[TestDox('To string succeeds for NE')]
|
|
|
|
public function testToStringSucceedsForNE(): void
|
|
|
|
{
|
|
|
|
$this->assertEquals('<>', Op::NE->toString(), 'NE operator incorrect');
|
|
|
|
}
|
|
|
|
|
|
|
|
#[TestDox('To string succeeds for BT')]
|
|
|
|
public function testToStringSucceedsForBT(): void
|
|
|
|
{
|
|
|
|
$this->assertEquals('BETWEEN', Op::BT->toString(), 'BT operator incorrect');
|
|
|
|
}
|
|
|
|
|
|
|
|
#[TestDox('To string succeeds for EX')]
|
|
|
|
public function testToStringSucceedsForEX(): void
|
|
|
|
{
|
|
|
|
$this->assertEquals('IS NOT NULL', Op::EX->toString(), 'EX operator incorrect');
|
|
|
|
}
|
|
|
|
|
|
|
|
#[TestDox('To string succeeds for NEX')]
|
|
|
|
public function testToStringSucceedsForNEX(): void
|
|
|
|
{
|
|
|
|
$this->assertEquals('IS NULL', Op::NEX->toString(), 'NEX operator incorrect');
|
|
|
|
}
|
|
|
|
}
|