/** * Returns the global Env\Request instance * * @return \r8\iface\Env\Request The singleton Env object */ public static function request() { // @codeCoverageIgnoreStart if (!isset(self::$request)) { self::$request = new \r8\Env\Request($_SERVER, new \r8\Input\Reference($_POST), \r8\Input\Files::fromArray($_FILES), self::getHeaders(), self::isCLI()); } // @codeCoverageIgnoreEnd return self::$request; }
public function testFromArray() { $result = \r8\Input\Files::fromArray(array("first" => array('name' => array('File Name', "k" => 'File 2'), 'tmp_name' => array(__FILE__, "k" => r8_DIR_CLASSES . "Autoload.php"), 'error' => array(1234, "k" => 0)), "second" => array('name' => 'File Name', 'tmp_name' => __FILE__, 'error' => 1234))); $this->assertThat($result, $this->isInstanceOf('\\r8\\Input\\Files')); $this->assertTrue($result->fileExists('first')); $this->assertTrue($result->fileExists('second')); }