class FakeSession { function __construct($user_no) { $principal = new Principal('user_no',$user_no); // Assign each field in the selected record to the object foreach( $principal AS $k => $v ) { $this->{$k} = $v; } $this->username = $principal->username(); $this->user_no = $principal->user_no(); $this->principal_id = $principal->principal_id(); $this->email = $principal->email(); $this->dav_name = $principal->dav_name(); $this->principal = $principal; $this->logged_in = true; } function AllowedTo($do_something) { return true; } }