Ouzo\Tests\ModelAttributesMatcher::matches PHP Метод

matches() публичный Метод

public matches ( $argument )
    public function matches($argument)
    {
        if (get_class($this->expected) !== get_class($argument)) {
            return false;
        }
        $actualAttributes = Arrays::filterByAllowedKeys($argument->attributes(), $this->expected->getFields());
        return $this->expectedAttributes == $actualAttributes;
    }

Usage Example

Пример #1
0
 /**
  * @test
  */
 public function shouldReturnFalseIfDifferentAttributes()
 {
     //given
     $model1 = new Product(array('name' => 'product1'));
     $model2 = new Product(array('name' => 'product2'));
     $matcher = new ModelAttributesMatcher($model1);
     //when
     $result = $matcher->matches($model2);
     //then
     $this->assertFalse($result);
 }