Beispiel #1
0
 public function testIsValid()
 {
     $TestVar = new Base();
     $this->assertTrue(Base::isValid($TestVar));
     $this->assertTrue(Object::isValid($TestVar));
     $TestVar = new RESTProcessorA_underTest_isValid();
     $this->assertTrue(RESTProcessorA_underTest_isValid::isValid($TestVar));
     $this->assertTrue(RESTProcessorA::isValid($TestVar));
     $this->assertTrue(ProcessorA::isValid($TestVar));
     $this->assertTrue(Object::isValid($TestVar));
     $TestVar = new ProcessorA_underTest_isValid();
     $this->assertTrue(ProcessorA_underTest_isValid::isValid($TestVar));
     $this->assertTrue(ProcessorA::isValid($TestVar));
     $this->assertTrue(Object::isValid($TestVar));
     $TestVar = new RESTController();
     $this->assertTrue(RESTController::isValid($TestVar));
     $this->assertTrue(FrontControllerA::isValid($TestVar));
     $this->assertTrue(Object::isValid($TestVar));
     $TestVar = new FrontControllerA_underTest_isValid();
     $this->assertTrue(FrontControllerA_underTest_isValid::isValid($TestVar));
     $this->assertTrue(FrontControllerA::isValid($TestVar));
     $this->assertTrue(Object::isValid($TestVar));
     $TestVar = new ModelA_underTest_isValid();
     $this->assertTrue(ModelA_underTest_isValid::isValid($TestVar));
     $this->assertTrue(ModelA::isValid($TestVar));
 }
Beispiel #2
0
 public function test__setDev()
 {
     $null = new Base();
     $env = new vsc_underTest___toString();
     $env->setIsDevelopment(true);
     vsc::setInstance($env);
     try {
         $null->__set(uniqid('test'), uniqid('val:'));
     } catch (\Exception $e) {
         $this->assertInstanceOf(ExceptionUnimplemented::class, $e);
         $this->assertInstanceOf(Exception::class, $e);
     }
     try {
         $null->test = uniqid('val:');
     } catch (\Exception $e) {
         $this->assertInstanceOf(ExceptionUnimplemented::class, $e);
         $this->assertInstanceOf(Exception::class, $e);
     }
 }
Beispiel #3
0
 /**
  * @param string $sIncName
  * @param mixed $value
  * @throws ExceptionUnimplemented
  * @throws \ReflectionException
  */
 public function __set($sIncName, $value)
 {
     if (is_null($sIncName)) {
         throw new \ReflectionException('Can\'t set a value to a null property on the current object [' . get_class($this) . ']');
     }
     try {
         $oProperty = new \ReflectionProperty($this, $sIncName);
         if (!$oProperty->isPublic()) {
             // trying for a setter
             $sSetterName = 'set' . ucfirst($sIncName);
             $oSetter = new \ReflectionMethod($this, $sSetterName);
             $oSetter->invoke($this, $value);
         } else {
             $oProperty->setValue($this, $value);
         }
         $this->_current = $sIncName;
         return;
     } catch (\ReflectionException $e) {
         //			$this->_current = $sIncName;
         //			$this->$sIncName = $value;
     }
     parent::__set($sIncName, $value);
 }
Beispiel #4
0
 public function test__get()
 {
     $null = new Base();
     $this->assertInstanceOf(Base::class, $null->__get('test'));
     $this->assertInstanceOf(Base::class, $null->test);
 }
Beispiel #5
0
 public function test__call()
 {
     $null = new Base();
     $this->assertInstanceOf(Base::class, $null->__call('getSomething', array()));
     $this->assertInstanceOf(Base::class, $null->getSomething('test'));
 }