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

class 
SetTest extends HamcrestAbstractMatcherTest
{

    public static 
$_classProperty;
    public 
$_instanceProperty;

    protected function 
setUp()
    {
        
self::$_classProperty null;
        unset(
$this->_instanceProperty);
    }

    protected function 
createMatcher()
    {
        return 
HamcrestCoreSet::set('property_name');
    }

    public function 
testEvaluatesToTrueIfArrayPropertyIsSet()
    {
        
assertThat(array('foo' => 'bar'), set('foo'));
    }

    public function 
testNegatedEvaluatesToFalseIfArrayPropertyIsSet()
    {
        
assertThat(array('foo' => 'bar'), not(notSet('foo')));
    }

    public function 
testEvaluatesToTrueIfClassPropertyIsSet()
    {
        
self::$_classProperty 'bar';
        
assertThat('HamcrestCoreSetTest'set('_classProperty'));
    }

    public function 
testNegatedEvaluatesToFalseIfClassPropertyIsSet()
    {
        
self::$_classProperty 'bar';
        
assertThat('HamcrestCoreSetTest'not(notSet('_classProperty')));
    }

    public function 
testEvaluatesToTrueIfObjectPropertyIsSet()
    {
        
$this->_instanceProperty 'bar';
        
assertThat($thisset('_instanceProperty'));
    }

    public function 
testNegatedEvaluatesToFalseIfObjectPropertyIsSet()
    {
        
$this->_instanceProperty 'bar';
        
assertThat($thisnot(notSet('_instanceProperty')));
    }

    public function 
testEvaluatesToFalseIfArrayPropertyIsNotSet()
    {
        
assertThat(array('foo' => 'bar'), not(set('baz')));
    }

    public function 
testNegatedEvaluatesToTrueIfArrayPropertyIsNotSet()
    {
        
assertThat(array('foo' => 'bar'), notSet('baz'));
    }

    public function 
testEvaluatesToFalseIfClassPropertyIsNotSet()
    {
        
assertThat('HamcrestCoreSetTest'not(set('_classProperty')));
    }

    public function 
testNegatedEvaluatesToTrueIfClassPropertyIsNotSet()
    {
        
assertThat('HamcrestCoreSetTest'notSet('_classProperty'));
    }

    public function 
testEvaluatesToFalseIfObjectPropertyIsNotSet()
    {
        
assertThat($thisnot(set('_instanceProperty')));
    }

    public function 
testNegatedEvaluatesToTrueIfObjectPropertyIsNotSet()
    {
        
assertThat($thisnotSet('_instanceProperty'));
    }

    public function 
testHasAReadableDescription()
    {
        
$this->assertDescription('set property foo'set('foo'));
        
$this->assertDescription('unset property bar'notSet('bar'));
    }

    public function 
testDecribesPropertySettingInMismatchMessage()
    {
        
$this->assertMismatchDescription(
            
'was not set',
            
set('bar'),
            array(
'foo' => 'bar')
        );
        
$this->assertMismatchDescription(
            
'was "bar"',
            
notSet('foo'),
            array(
'foo' => 'bar')
        );
        
self::$_classProperty 'bar';
        
$this->assertMismatchDescription(
            
'was "bar"',
            
notSet('_classProperty'),
            
'HamcrestCoreSetTest'
        
);
        
$this->_instanceProperty 'bar';
        
$this->assertMismatchDescription(
            
'was "bar"',
            
notSet('_instanceProperty'),
            
$this
        
);
    }
}
Онлайн: 1
Реклама