pdo-document/tests/unit/OpTest.php

87 lines
2.6 KiB
PHP
Raw 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('toSQL() succeeds for Equal')]
public function testToSQLSucceedsForEqual(): void
{
$this->assertEquals('=', Op::Equal->toSQL(), 'Equal SQL operator incorrect');
}
#[TestDox('toSQL() succeeds for Greater')]
public function testToSQLSucceedsForGreater(): void
{
$this->assertEquals('>', Op::Greater->toSQL(), 'Greater SQL operator incorrect');
}
#[TestDox('toSQL() succeeds for GreaterOrEqual')]
public function testToSQLSucceedsForGreaterOrEqual(): void
{
$this->assertEquals('>=', Op::GreaterOrEqual->toSQL(), 'GreaterOrEqual SQL operator incorrect');
}
#[TestDox('toSQL() succeeds for Less')]
public function testToSQLSucceedsForLess(): void
{
$this->assertEquals('<', Op::Less->toSQL(), 'Less SQL operator incorrect');
}
#[TestDox('toSQL() succeeds for LessOrEqual')]
public function testToSQLSucceedsForLessOrEqual(): void
{
$this->assertEquals('<=', Op::LessOrEqual->toSQL(), 'LessOrEqual SQL operator incorrect');
}
#[TestDox('toSQL() succeeds for NotEqual')]
public function testToSQLSucceedsForNotEqual(): void
{
$this->assertEquals('<>', Op::NotEqual->toSQL(), 'NotEqual SQL operator incorrect');
}
#[TestDox('toSQL() succeeds for Between')]
public function testToSQLSucceedsForBetween(): void
{
$this->assertEquals('BETWEEN', Op::Between->toSQL(), 'Between SQL operator incorrect');
}
#[TestDox('toSQL() succeeds for In')]
public function testToSQLSucceedsForIn(): void
{
$this->assertEquals('IN', Op::In->toSQL(), 'In SQL operator incorrect');
}
#[TestDox('toSQL() succeeds for InArray')]
public function testToSQLSucceedsForInArray(): void
{
$this->assertEquals('??|', Op::InArray->toSQL(), 'InArray SQL operator incorrect');
}
#[TestDox('toSQL() succeeds for Exists')]
public function testToSQLSucceedsForExists(): void
{
$this->assertEquals('IS NOT NULL', Op::Exists->toSQL(), 'Exists SQL operator incorrect');
}
#[TestDox('toSQL() succeeds for NotExists')]
public function testToSQLSucceedsForNEX(): void
{
$this->assertEquals('IS NULL', Op::NotExists->toSQL(), 'NotExists SQL operator incorrect');
}
}