pdo-document/tests/unit/OpTest.php

75 lines
2.0 KiB
PHP
Raw Permalink Normal View History

<?php
/**
* @author Daniel J. Summers <daniel@bitbadger.solutions>
* @license MIT
*/
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
*/
#[TestDox('Op (Unit tests)')]
class OpTest extends TestCase
{
#[TestDox('To SQL succeeds for EQ')]
public function testToSQLSucceedsForEQ(): void
{
$this->assertEquals('=', Op::EQ->toSQL(), 'EQ operator incorrect');
}
#[TestDox('To SQL succeeds for GT')]
public function testToSQLSucceedsForGT(): void
{
$this->assertEquals('>', Op::GT->toSQL(), 'GT operator incorrect');
}
#[TestDox('To SQL succeeds for GE')]
public function testToSQLSucceedsForGE(): void
{
$this->assertEquals('>=', Op::GE->toSQL(), 'GE operator incorrect');
}
#[TestDox('To SQL succeeds for LT')]
public function testToSQLSucceedsForLT(): void
{
$this->assertEquals('<', Op::LT->toSQL(), 'LT operator incorrect');
}
#[TestDox('To SQL succeeds for LE')]
public function testToSQLSucceedsForLE(): void
{
$this->assertEquals('<=', Op::LE->toSQL(), 'LE operator incorrect');
}
#[TestDox('To SQL succeeds for NE')]
public function testToSQLSucceedsForNE(): void
{
$this->assertEquals('<>', Op::NE->toSQL(), 'NE operator incorrect');
}
#[TestDox('To SQL succeeds for BT')]
public function testToSQLSucceedsForBT(): void
{
$this->assertEquals('BETWEEN', Op::BT->toSQL(), 'BT operator incorrect');
}
#[TestDox('To SQL succeeds for EX')]
public function testToSQLSucceedsForEX(): void
{
$this->assertEquals('IS NOT NULL', Op::EX->toSQL(), 'EX operator incorrect');
}
#[TestDox('To SQL succeeds for NEX')]
public function testToSQLSucceedsForNEX(): void
{
$this->assertEquals('IS NULL', Op::NEX->toSQL(), 'NEX operator incorrect');
}
}