48 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| /**
 | |
|  * @author Daniel J. Summers <daniel@bitbadger.solutions>
 | |
|  * @license MIT
 | |
|  */
 | |
| 
 | |
| declare(strict_types=1);
 | |
| 
 | |
| use BitBadger\PDODocument\Op;
 | |
| 
 | |
| pest()->group('unit');
 | |
| 
 | |
| describe('->toSQL()', function () {
 | |
|     test('returns "=" for Equal', function () {
 | |
|         expect(Op::Equal)->toSQL()->toBe('=');
 | |
|     });
 | |
|     test('returns ">" for Greater', function () {
 | |
|         expect(Op::Greater)->toSQL()->toBe('>');
 | |
|     });
 | |
|     test('returns ">=" for GreaterOrEqual', function () {
 | |
|         expect(Op::GreaterOrEqual)->toSQL()->toBe('>=');
 | |
|     });
 | |
|     test('returns "<" for Less', function () {
 | |
|         expect(Op::Less)->toSQL()->toBe('<');
 | |
|     });
 | |
|     test('returns "<=" for LessOrEqual', function () {
 | |
|         expect(Op::LessOrEqual)->toSQL()->toBe('<=');
 | |
|     });
 | |
|     test('returns "<>" for NotEqual', function () {
 | |
|         expect(Op::NotEqual)->toSQL()->toBe('<>');
 | |
|     });
 | |
|     test('returns "BETWEEN" for Between', function () {
 | |
|         expect(Op::Between)->toSQL()->toBe('BETWEEN');
 | |
|     });
 | |
|     test('returns "IN" for In', function () {
 | |
|         expect(Op::In)->toSQL()->toBe('IN');
 | |
|     });
 | |
|     test('returns "?|" (escaped) for InArray', function () {
 | |
|         expect(Op::InArray)->toSQL()->toBe('??|');
 | |
|     });
 | |
|     test('returns "IS NOT NULL" for Exists', function () {
 | |
|         expect(Op::Exists)->toSQL()->toBe('IS NOT NULL');
 | |
|     });
 | |
|     test('returns "IS NULL" for NotExists', function () {
 | |
|         expect(Op::NotExists)->toSQL()->toBe('IS NULL');
 | |
|     });
 | |
| });
 |