tests/ModelsTest.php
/**
     * @testdox By default, only Administrators can modify data.
     */
@testdox By default, only Administrators can modify data.
@testdox By default only Administrators can modify data .
public function permission()
    {
        $admin = new \Ormic\Model\User();
        $admin->username = 'admin';
        $admin->save();
        $this->assertTrue($admin->isAdmin());
        $nonAdmin = new \Ormic\Model\User();
        $nonAdmin->username = 'nonadmin';
        $nonAdmin->save();
        $this->assertFalse($nonAdmin->isAdmin());
        $book = new Model\Book();
        $book->setUser($nonAdmin);
        $this->assertFalse($book->canEdit());
        $book->setUser($admin);
        $this->assertTrue($book->canEdit());
    }
public function permission ( ) { $ admin = new \ Ormic \ Model \ User ( ) ; $ admin -> username = 'admin' ; $ admin -> save ( ) ; $ this -> assertTrue ( $ admin -> isAdmin ( ) ) ; $ nonAdmin = new \ Ormic \ Model \ User ( ) ; $ nonAdmin -> username = 'nonadmin' ; $ nonAdmin -> save ( ) ; $ this -> assertFalse ( $ nonAdmin -> isAdmin ( ) ) ; $ book = new Model \ Book ( ) ; $ book -> setUser ( $ nonAdmin ) ; $ this -> assertFalse ( $ book -> canEdit ( ) ) ; $ book -> setUser ( $ admin ) ; $ this -> assertTrue ( $ book -> canEdit ( ) ) ; }
@testdox By default, only Administrators can modify data.
@testdox By default only Administrators can modify data .
// Set up two users, one admin and one not. The first created user is // always an admin. // Start a new model.