Jump to content

Using atkMockSecurityManager

From NusaATK
Revision as of 17:31, 9 January 2008 by Boy (talk | contribs) (New page: === Configuring the atkMockDb === Create the testcase using the atkTestCase as its base class, so you can use the setMockDb() method to easily configure your testcases to use the atkMockDb...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Configuring the atkMockDb

Create the testcase using the atkTestCase as its base class, so you can use the setMockDb() method to easily configure your testcases to use the atkMockDb.

Remember to also restore the original database, when you are done with the mock database, or other tests which depend on the regular database may fail!

require_once(atkconfig("atkroot")."atk/test/class.atktestcase.inc");

class test_mynode extends atkTestCase 
{
  public function test_asimpletestcase()
  {
    $secMgr = atknew("atk.security.atkMockSecurityManager");
    $secMgr->m_scheme="group";
    $secMgr->setAllowed(false,'disallowed_right');
    $secMgr->setAllowed(true, 'allowed_right');

    $this->setMockSecurityManager($secMgr);
      
    // Some test stuff

    $this->restoreSecurityManager();
  }
}