CFDBPermittedFunctionsTest

The Contact Form DB CFDBPermittedFunctionsTest class.

Defined (1)

The class is defined in the following location(s).

/phpunit/CFDBPermittedFunctionsTest.php  
  1. class CFDBPermittedFunctionsTest extends PHPUnit_Framework_TestCase { 
  2.  
  3. public function tearDown() { 
  4. CFDBPermittedFunctions::getInstance()->init(); 
  5.  
  6. public function testSet() { 
  7. $p = CFDBPermittedFunctions::getInstance(); 
  8. $this->assertFalse($p->isFunctionPermitted('blahblah')); 
  9.  
  10. $p->setPermitAllFunctions(false); 
  11. $this->assertFalse($p->isFunctionPermitted('blahblah')); 
  12.  
  13. $p->setPermitAllFunctions(true); 
  14. $this->assertTrue($p->isFunctionPermitted('blahblah')); 
  15.  
  16. $p->setPermitAllFunctions(false); 
  17. $this->assertFalse($p->isFunctionPermitted('blahblah')); 
  18.  
  19. public function testAddFunction() { 
  20. $p = CFDBPermittedFunctions::getInstance(); 
  21. $this->assertFalse($p->isFunctionPermitted('blahblah')); 
  22.  
  23. $p->addPermittedFunction("blahblah"); 
  24. $this->assertTrue($p->isFunctionPermitted('blahblah')); 
  25.  
  26. public function testSingleton() { 
  27. $this->assertFalse( 
  28. CFDBPermittedFunctions::getInstance()->isFunctionPermitted('blahblah')); 
  29. CFDBPermittedFunctions::getInstance()->addPermittedFunction('blahblah'); 
  30. $this->assertTrue( 
  31. CFDBPermittedFunctions::getInstance()->isFunctionPermitted('blahblah')); 
  32.  
  33.  
  34. public function testRegisterFunction() { 
  35. $this->assertFalse( 
  36. CFDBPermittedFunctions::getInstance()->isFunctionPermitted('blahblah')); 
  37. cfdb_register_function('blahblah'); 
  38. $this->assertTrue( 
  39. CFDBPermittedFunctions::getInstance()->isFunctionPermitted('blahblah')); 
  40.