Вход Регистрация
Файл: src/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/AnyOfTest.php
Строк: 91
<?php
namespace HamcrestCore;

class 
AnyOfTest extends HamcrestAbstractMatcherTest
{

    protected function 
createMatcher()
    {
        return 
HamcrestCoreAnyOf::anyOf('irrelevant');
    }

    public function 
testAnyOfEvaluatesToTheLogicalDisjunctionOfTwoOtherMatchers()
    {
        
assertThat('good', anyOf('bad', 'good'));
        
assertThat('good', anyOf('good', 'good'));
        
assertThat('good', anyOf('good', 'bad'));

        
assertThat('good', not(anyOf('bad', startsWith('b'))));
    }

    public function 
testAnyOfEvaluatesToTheLogicalDisjunctionOfManyOtherMatchers()
    {
        
assertThat('good', anyOf('bad', 'good', 'bad', 'bad', 'bad'));
        
assertThat('good', not(anyOf('bad', 'bad', 'bad', 'bad', 'bad')));
    }

    public function 
testAnyOfSupportsMixedTypes()
    {
        
$combined = anyOf(
            
equalTo(new HamcrestCoreSampleBaseClass('good')),
            
equalTo(new HamcrestCoreSampleBaseClass('ugly')),
            
equalTo(new HamcrestCoreSampleSubClass('good'))
        );

        
assertThat(new HamcrestCoreSampleSubClass('good'), $combined);
    }

    public function 
testAnyOfHasAReadableDescription()
    {
        
$this->assertDescription(
            
'("good" or "bad" or "ugly")',
            
anyOf('good', 'bad', 'ugly')
        );
    }

    public function 
testNoneOfEvaluatesToTheLogicalDisjunctionOfTwoOtherMatchers()
    {
        
assertThat('good', not(noneOf('bad', 'good')));
        
assertThat('good', not(noneOf('good', 'good')));
        
assertThat('good', not(noneOf('good', 'bad')));

        
assertThat('good', noneOf('bad', startsWith('b')));
    }

    public function 
testNoneOfEvaluatesToTheLogicalDisjunctionOfManyOtherMatchers()
    {
        
assertThat('good', not(noneOf('bad', 'good', 'bad', 'bad', 'bad')));
        
assertThat('good', noneOf('bad', 'bad', 'bad', 'bad', 'bad'));
    }

    public function 
testNoneOfSupportsMixedTypes()
    {
        
$combined = noneOf(
            
equalTo(new HamcrestCoreSampleBaseClass('good')),
            
equalTo(new HamcrestCoreSampleBaseClass('ugly')),
            
equalTo(new HamcrestCoreSampleSubClass('good'))
        );

        
assertThat(new HamcrestCoreSampleSubClass('bad'), $combined);
    }

    public function 
testNoneOfHasAReadableDescription()
    {
        
$this->assertDescription(
            
'not ("good" or "bad" or "ugly")',
            
noneOf('good', 'bad', 'ugly')
        );
    }
}
Онлайн: 2
Реклама