mirror of
				https://github.com/furyfire/trueskill.git
				synced 2025-11-04 02:02:29 +01:00 
			
		
		
		
	Cleanup abstractions of "TestCase" class in unittest
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				ci/woodpecker/push/woodpecker Pipeline was successful
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	ci/woodpecker/push/woodpecker Pipeline was successful
				
			This commit is contained in:
		@@ -4,25 +4,35 @@ namespace DNW\Skills\Tests;
 | 
			
		||||
 | 
			
		||||
use DNW\Skills\Guard;
 | 
			
		||||
use Exception;
 | 
			
		||||
use PHPUnit\Framework\TestCase;
 | 
			
		||||
 | 
			
		||||
class GuardTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    public function testArgumentNotNull(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->expectException(Exception::class);
 | 
			
		||||
        $this->expectExceptionMessage('dummy can not be null');
 | 
			
		||||
        Guard::argumentNotNull(null, "dummy");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testargumentIsValidIndex(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->expectException(Exception::class);
 | 
			
		||||
        Guard::argumentIsValidIndex(25, 10, "dummy");
 | 
			
		||||
        $this->expectExceptionMessage('dummy is an invalid index');
 | 
			
		||||
        Guard::argumentIsValidIndex(10, 10, "dummy");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testargumentIsValidIndex2(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->expectException(Exception::class);
 | 
			
		||||
        $this->expectExceptionMessage('dummy is an invalid index');
 | 
			
		||||
        Guard::argumentIsValidIndex(-1, 10, "dummy");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testargumentInRangeInclusive(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->expectException(Exception::class);
 | 
			
		||||
        $this->expectExceptionMessage('dummy is not in the valid range [0, 100]');
 | 
			
		||||
        Guard::argumentInRangeInclusive(101, 0, 100, "dummy");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user