factory() public static méthode

Static method to instantiate the resource object and return itself to facilitate chaining methods together.
public static factory ( string $name ) : Resource
$name string
Résultat Resource
Exemple #1
0
 public function testRemoveDeny()
 {
     $editor = Role::factory('editor');
     $editor->addPermission('edit');
     $page = Resource::factory('page');
     $a = Acl::factory($editor, $page);
     $a->allow('editor', 'page', 'edit');
     $a->deny('editor', 'page', 'edit');
     $this->assertFalse($a->isAllowed($editor, 'page', 'edit'));
     $a->removeDeny('editor', 'page', 'edit');
     $a->removeDeny('editor');
     $this->assertTrue($a->isAllowed($editor, 'page', 'edit'));
 }
Exemple #2
0
 public function testToString()
 {
     $p = Resource::factory('page');
     $this->assertEquals('page', (string) $p);
 }