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

class 
AllOfTest extends HamcrestAbstractMatcherTest
{

    protected function 
createMatcher()
    {
        return 
HamcrestCoreAllOf::allOf('irrelevant');
    }

    public function 
testEvaluatesToTheLogicalConjunctionOfTwoOtherMatchers()
    {
        
assertThat('good', allOf('good', 'good'));

        
assertThat('good', not(allOf('bad', 'good')));
        
assertThat('good', not(allOf('good', 'bad')));
        
assertThat('good', not(allOf('bad', 'bad')));
    }

    public function 
testEvaluatesToTheLogicalConjunctionOfManyOtherMatchers()
    {
        
assertThat('good', allOf('good', 'good', 'good', 'good', 'good'));
        
assertThat('good', not(allOf('good', endsWith('d'), 'bad', 'good', 'good')));
    }

    public function 
testSupportsMixedTypes()
    {
        
$all = allOf(
            
equalTo(new HamcrestCoreSampleBaseClass('good')),
            
equalTo(new HamcrestCoreSampleBaseClass('good')),
            
equalTo(new HamcrestCoreSampleSubClass('ugly'))
        );

        
$negated = not($all);

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

    public function 
testHasAReadableDescription()
    {
        
$this->assertDescription(
            
'("good" and "bad" and "ugly")',
            
allOf('good', 'bad', 'ugly')
        );
    }

    public function 
testMismatchDescriptionDescribesFirstFailingMatch()
    {
        
$this->assertMismatchDescription(
            
'"good" was "bad"',
            
allOf('bad', 'good'),
            
'bad'
        
);
    }
}
Онлайн: 2
Реклама