public function tearDown() { foreach ($_SERVER as $key => $value) { unset($_SERVER[$key]); } vsc::setInstance(new vsc()); }
public function test__callStaticNotDev() { $env = new vsc_underTest___callStatic(); $env->setIsDevelopment(false); vsc::setInstance($env); $this->assertInstanceOf(Base::class, Object_underTest___callStatic::__callStatic('test', array())); $this->assertInstanceOf(Base::class, Object_underTest___callStatic::testCall('test')); }
public function test__setNotDev() { $null = new Object_underTest___set(); $env = new vsc_underTest___set(); $env->setIsDevelopment(false); vsc::setInstance($env); $this->assertNull($null->__set(uniqid('test'), uniqid('val:'))); }
public function test__getNotDev() { $null = new Object_underTest___get(); $env = new vsc_underTest___get(); $env->setIsDevelopment(false); vsc::setInstance($env); $this->assertInstanceOf(Base::class, $null->__get(uniqid('test'))); $this->assertInstanceOf(Base::class, $null->test); }
public function test__getForEmptyRequests() { $_GET = []; $_POST = []; $_SERVER = []; $_SESSION = []; $_COOKIE = []; $key = 'test'; vsc::setInstance(new vsc()); $o = new RequestModel(); $this->assertEquals('<span style="font-size:0.8em">[' . $key . ' does not exist in the request]</span>', $o->__get($key)); }
public function testGetErrorHeaderOutputNotCliWitException() { $e = new Exception('test'); $lineNumber = __LINE__ - 1; // the line above $f = new vsc_underTest_functions(); $f->setIsCli(false); vsc::setInstance($f); $s = \vsc\getErrorHeaderOutput($e); $currentPath = __FILE__; $output = <<<START <?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><style>ul {padding:0; font-size:0.8em} li {padding:0.2em;display:inline} address {position:fixed;bottom:0;}</style><title>Internal Error: test...</title></head><body><strong>Internal Error: test</strong><address>© VSC</address><ul><li><a href="#" onclick="p = document.getElementById('trace'); if (p.style.display=='block') p.style.display='none';else p.style.display='block'; return false">toggle trace</a></li></ul><p style="font-size:.8em">Triggered in <strong>{$currentPath}</strong> at line {$lineNumber}</p><pre style="position:fixed;bottom:2em;display:none;font-size:.8em" id="trace"> START; $this->assertEquals($output, $s); }
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); } }
protected function tearDown() { vsc::setInstance(new vsc()); }
public function testBasicSetInstance() { vsc::setInstance(new vsc_underTest_setInstance()); $this->assertInstanceOf(vsc_underTest_setInstance::class, vsc::getEnv()); $this->assertInstanceOf(vsc::class, vsc::getEnv()); }
public function testBasicIsCli() { vsc::setInstance(new vsc()); $this->assertTrue(vsc::getEnv()->isCli()); }
public function testBasicNl() { vsc::setInstance(new vsc()); $this->assertEquals("\n", vsc::nl()); }
protected function setUp() { vsc::setInstance(new vsc()); }
public function tearDown() { vsc::setInstance(new vsc()); }
public function testNotIsCli() { $env = new vsc_underTest__isCli(); vsc::setInstance($env); $this->assertFalse(vsc::isCli()); }
public function testBasicIsDevelopment() { vsc::setInstance(new vsc()); $_SERVER['REMOTE_ADDR'] = '198.111.111.1'; $this->assertTrue(vsc::getEnv()->isDevelopment()); }