sameValueAs() public method

Tells whether two Url are sameValueAs by comparing their components
public sameValueAs ( ValueObjects\ValueObjectInterface $url ) : boolean
$url ValueObjects\ValueObjectInterface
return boolean
Beispiel #1
0
 public function testSameValueAs()
 {
     $url2 = new Url(new SchemeName('http'), new StringLiteral('user'), new StringLiteral('pass'), new Hostname('foo.com'), new PortNumber(80), new Path('/bar'), new QueryString('?querystring'), new FragmentIdentifier('#fragmentidentifier'));
     $url3 = new Url(new SchemeName('git+ssh'), new StringLiteral(''), new StringLiteral(''), new Hostname('github.com'), new NullPortNumber(), new Path('/nicolopignatelli/valueobjects'), new QueryString('?querystring'), new FragmentIdentifier('#fragmentidentifier'));
     $this->assertTrue($this->url->sameValueAs($url2));
     $this->assertTrue($url2->sameValueAs($this->url));
     $this->assertFalse($this->url->sameValueAs($url3));
     $mock = $this->getMock('ValueObjects\\ValueObjectInterface');
     $this->assertFalse($this->url->sameValueAs($mock));
 }