Commit dc419b3d authored by Simon Welsh's avatar Simon Welsh

Add support for the $_FILES superglobal

parent 7955833d
Pipeline #26 passed with stage
......@@ -3,7 +3,7 @@
[![build status][build-image]][build-link]
This package provides Hack wrappers for the `$_GET`, `$_POST`, `$_REQUEST`,
`$_COOKIE` and `$_SERVER` super globals.
`$_COOKIE`, `$_FILES` and `$_SERVER` super globals.
## Installation
......
<?hh // strict
namespace _91carriage\Hack;
class Files extends ReadonlyTypedMap {
public static function request(): this {
return new static(/* HH_FIXME[2050]: super global */ $_FILES);
}
}
<?hh // strict
namespace _91carriage\Hack;
class FilesTest extends \PHPUnit_Framework_TestCase {
public function testRequest(): void {
$_FILES = ['hello' => 'world', 'a' => 7];
$instance = Files::request();
$this->assertTrue($instance->hasString('hello'));
$this->assertSame('world', $instance->string('hello'));
$this->assertTrue($instance->hasInt('a'));
$this->assertSame(7, $instance->int('a'));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment