pdo-document/tests/unit/OpTest.php

69 lines
2.0 KiB
PHP
Raw Permalink Normal View History

<?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
*/
#[TestDox('Op (Unit tests)')]
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');
}
}