2024-07-21 01:47:21 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @author Daniel J. Summers <daniel@bitbadger.solutions>
|
|
|
|
* @license MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2024-06-08 23:58:45 +00:00
|
|
|
|
|
|
|
namespace Test\Unit;
|
|
|
|
|
|
|
|
use BitBadger\PDODocument\Op;
|
|
|
|
use PHPUnit\Framework\Attributes\TestDox;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unit tests for the Op enumeration
|
|
|
|
*/
|
2024-06-21 13:46:41 +00:00
|
|
|
#[TestDox('Op (Unit tests)')]
|
2024-06-08 23:58:45 +00:00
|
|
|
class OpTest extends TestCase
|
|
|
|
{
|
2024-07-21 01:47:21 +00:00
|
|
|
#[TestDox('To SQL succeeds for EQ')]
|
|
|
|
public function testToSQLSucceedsForEQ(): void
|
2024-06-08 23:58:45 +00:00
|
|
|
{
|
2024-07-21 01:47:21 +00:00
|
|
|
$this->assertEquals('=', Op::EQ->toSQL(), 'EQ operator incorrect');
|
2024-06-08 23:58:45 +00:00
|
|
|
}
|
|
|
|
|
2024-07-21 01:47:21 +00:00
|
|
|
#[TestDox('To SQL succeeds for GT')]
|
|
|
|
public function testToSQLSucceedsForGT(): void
|
2024-06-08 23:58:45 +00:00
|
|
|
{
|
2024-07-21 01:47:21 +00:00
|
|
|
$this->assertEquals('>', Op::GT->toSQL(), 'GT operator incorrect');
|
2024-06-08 23:58:45 +00:00
|
|
|
}
|
|
|
|
|
2024-07-21 01:47:21 +00:00
|
|
|
#[TestDox('To SQL succeeds for GE')]
|
|
|
|
public function testToSQLSucceedsForGE(): void
|
2024-06-08 23:58:45 +00:00
|
|
|
{
|
2024-07-21 01:47:21 +00:00
|
|
|
$this->assertEquals('>=', Op::GE->toSQL(), 'GE operator incorrect');
|
2024-06-08 23:58:45 +00:00
|
|
|
}
|
|
|
|
|
2024-07-21 01:47:21 +00:00
|
|
|
#[TestDox('To SQL succeeds for LT')]
|
|
|
|
public function testToSQLSucceedsForLT(): void
|
2024-06-08 23:58:45 +00:00
|
|
|
{
|
2024-07-21 01:47:21 +00:00
|
|
|
$this->assertEquals('<', Op::LT->toSQL(), 'LT operator incorrect');
|
2024-06-08 23:58:45 +00:00
|
|
|
}
|
|
|
|
|
2024-07-21 01:47:21 +00:00
|
|
|
#[TestDox('To SQL succeeds for LE')]
|
|
|
|
public function testToSQLSucceedsForLE(): void
|
2024-06-08 23:58:45 +00:00
|
|
|
{
|
2024-07-21 01:47:21 +00:00
|
|
|
$this->assertEquals('<=', Op::LE->toSQL(), 'LE operator incorrect');
|
2024-06-08 23:58:45 +00:00
|
|
|
}
|
|
|
|
|
2024-07-21 01:47:21 +00:00
|
|
|
#[TestDox('To SQL succeeds for NE')]
|
|
|
|
public function testToSQLSucceedsForNE(): void
|
2024-06-08 23:58:45 +00:00
|
|
|
{
|
2024-07-21 01:47:21 +00:00
|
|
|
$this->assertEquals('<>', Op::NE->toSQL(), 'NE operator incorrect');
|
2024-06-08 23:58:45 +00:00
|
|
|
}
|
|
|
|
|
2024-07-21 01:47:21 +00:00
|
|
|
#[TestDox('To SQL succeeds for BT')]
|
|
|
|
public function testToSQLSucceedsForBT(): void
|
2024-06-08 23:58:45 +00:00
|
|
|
{
|
2024-07-21 01:47:21 +00:00
|
|
|
$this->assertEquals('BETWEEN', Op::BT->toSQL(), 'BT operator incorrect');
|
2024-06-08 23:58:45 +00:00
|
|
|
}
|
|
|
|
|
2024-07-21 01:47:21 +00:00
|
|
|
#[TestDox('To SQL succeeds for EX')]
|
|
|
|
public function testToSQLSucceedsForEX(): void
|
2024-06-08 23:58:45 +00:00
|
|
|
{
|
2024-07-21 01:47:21 +00:00
|
|
|
$this->assertEquals('IS NOT NULL', Op::EX->toSQL(), 'EX operator incorrect');
|
2024-06-08 23:58:45 +00:00
|
|
|
}
|
|
|
|
|
2024-07-21 01:47:21 +00:00
|
|
|
#[TestDox('To SQL succeeds for NEX')]
|
|
|
|
public function testToSQLSucceedsForNEX(): void
|
2024-06-08 23:58:45 +00:00
|
|
|
{
|
2024-07-21 01:47:21 +00:00
|
|
|
$this->assertEquals('IS NULL', Op::NEX->toSQL(), 'NEX operator incorrect');
|
2024-06-08 23:58:45 +00:00
|
|
|
}
|
|
|
|
}
|