HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-10-0-8-47 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:31:58 UTC 2024 aarch64
User: ubuntu (1000)
PHP: 8.1.2-1ubuntu2.22
Disabled: NONE
Upload Files
File: /var/www/admin.javaapp.co.uk/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/AnyOfTest.php
<?php
namespace Hamcrest\Core;

class AnyOfTest extends \Hamcrest\AbstractMatcherTest
{

    protected function createMatcher()
    {
        return \Hamcrest\Core\AnyOf::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 \Hamcrest\Core\SampleBaseClass('good')),
            equalTo(new \Hamcrest\Core\SampleBaseClass('ugly')),
            equalTo(new \Hamcrest\Core\SampleSubClass('good'))
        );

        assertThat(new \Hamcrest\Core\SampleSubClass('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 \Hamcrest\Core\SampleBaseClass('good')),
            equalTo(new \Hamcrest\Core\SampleBaseClass('ugly')),
            equalTo(new \Hamcrest\Core\SampleSubClass('good'))
        );

        assertThat(new \Hamcrest\Core\SampleSubClass('bad'), $combined);
    }

    public function testNoneOfHasAReadableDescription()
    {
        $this->assertDescription(
            'not ("good" or "bad" or "ugly")',
            noneOf('good', 'bad', 'ugly')
        );
    }
}