Пример #1
0
 public function testSave()
 {
     $event1 = PHPUnit_Testing::getInstance();
     $config1 = Config::getInstance("JooS_Event_PHPUnit_Testing");
     $this->assertEquals(array(), $config1->valueOf());
     $event1->attach(array(__CLASS__, "observerPHPUnitTestingEvent"));
     $config2 = Config::getInstance("JooS_Event_PHPUnit_Testing");
     $this->assertEquals(array(), $config2->valueOf());
     $event1->save();
     $config3 = Config::getInstance("JooS_Event_PHPUnit_Testing");
     $this->assertEquals(array(array(__CLASS__, "observerPHPUnitTestingEvent")), $config3->valueOf());
     Event::clearInstance("JooS\\Event\\PHPUnit_Testing");
 }
Пример #2
0
 public function testDelete()
 {
     $config1 = Config::getInstance("Test_Config1");
     $value1 = $config1->valueOf();
     $this->assertFalse(sizeof($value1) == 0);
     $delete1 = Config::deleteInstance("Test_Config1");
     $this->assertTrue($delete1);
     $config2 = Config::getInstance("Test_Config1");
     $value2 = $config2->valueOf();
     $this->assertTrue(sizeof($value2) == 0);
     $delete2 = Config::deleteInstance("Test_Config1");
     $this->assertFalse($delete2);
 }
Пример #3
0
 /**
  * Return log writers
  * 
  * @return array
  */
 public static function getWriters()
 {
     if (is_null(self::$_writers)) {
         $writers = Config::getInstance("JooS_Log")->writers;
         /* @var $writers JooS_Config */
         if (!is_null($writers)) {
             foreach ($writers->valueOf() as $name) {
                 $name = ucfirst(strtolower($name));
                 $className = Loader::getClassName(__NAMESPACE__ . "\\", $name);
                 if (Loader::loadClass($className)) {
                     $writer = new $className();
                     if ($writer instanceof Log_Interface) {
                         self::addWriter($writer);
                     }
                 }
             }
         } else {
             self::$_writers = array();
         }
     }
     return self::$_writers;
 }
Пример #4
0
 /**
  * Load observers.
  * 
  * @return null
  */
 private function _loadObservers()
 {
     $class = $this->name();
     $name = self::_configName($class);
     $config = Config::getInstance($name);
     $this->_observers = $config->valueOf();
 }