tests/DatalogTest.php
/**
     * @testdox All changes are attributed to a user.
     * @test
     */
@testdox All changes are attributed to a user.
@test
@testdox All changes are attributed to a user . @test
public function attribution()
    {
        $user1 = new \Ormic\Model\User();
        $user1->username = 'One';
        $user1->save();
        $this->assertEquals(1, $user1->id);
        $user2 = new \Ormic\Model\User();
        $user2->username = 'Two';
        $user2->save();
        $this->assertEquals(2, $user2->id);
        $book = new Model\Book();
        $book->setUser($user1);
        $book->title = 'Test Book';
        $book->save();
        $datalog1 = $book->getDatalog();
        $this->assertEquals(1, $datalog1[0]->user_id);
        $book->setUser($user2);
        $book->title = 'Test Title';
        $book->save();
        $datalog2 = $book->getDatalog();
        $this->assertEquals(2, $datalog2[0]->user_id);
    }
public function attribution ( ) { $ user1 = new \ Ormic \ Model \ User ( ) ; $ user1 -> username = 'One' ; $ user1 -> save ( ) ; $ this -> assertEquals ( 1 , $ user1 -> id ) ; $ user2 = new \ Ormic \ Model \ User ( ) ; $ user2 -> username = 'Two' ; $ user2 -> save ( ) ; $ this -> assertEquals ( 2 , $ user2 -> id ) ; $ book = new Model \ Book ( ) ; $ book -> setUser ( $ user1 ) ; $ book -> title = 'Test Book' ; $ book -> save ( ) ; $ datalog1 = $ book -> getDatalog ( ) ; $ this -> assertEquals ( 1 , $ datalog1 [ 0 ] -> user_id ) ; $ book -> setUser ( $ user2 ) ; $ book -> title = 'Test Title' ; $ book -> save ( ) ; $ datalog2 = $ book -> getDatalog ( ) ; $ this -> assertEquals ( 2 , $ datalog2 [ 0 ] -> user_id ) ; }
@testdox All changes are attributed to a user.
@testdox All changes are attributed to a user .
// Create two users. // Create a record to edit. // Make sure it was edited by the correct user. // Edit the record, and check the new datalog record.