예제 #1
0
 public function testScope()
 {
     $s = new Scope(array("read", "write", "foo"));
     $this->assertFalse($s->isEmpty());
     $this->assertTrue($s->hasScope(new Scope(array("read"))));
     $this->assertTrue($s->hasScope(new Scope(array("write"))));
     $this->assertTrue($s->hasScope(new Scope(array("foo"))));
     $this->assertTrue($s->hasAnyScope(new Scope(array("foo", "bar"))));
     $this->assertTrue($s->equals(new Scope(array("foo", "write", "read"))));
     $this->assertFalse($s->equals(new Scope(array("read", "write"))));
     $this->assertFalse($s->equals(new Scope(array("bar", "foo", "read", "write"))));
     $this->assertFalse($s->hasAnyScope(new Scope(array("bar", "baz"))));
     $this->assertEquals("foo read write", $s->toString());
     $this->assertEquals("foo read write", $s->__toString());
     $this->assertEquals("foo,read,write", $s->toString(","));
 }