--TEST-- Test php\lang\Module - test include with variables --FILE-- <?php use php\io\Stream; use php\lang\Module; $module = new Module(Stream::of('res://resources/ext/standard/module/basic_003.inc.php')); $foo = 'fail'; $bar = 'fail'; $undefined = 'fail'; $module->call(['foo' => 'success_foo', 'bar' => 'success_bar']); ?> --EXPECT-- string(11) "success_foo" string(11) "success_bar" NULL
--TEST-- Jsoup test #2 --FILE-- <?php use php\io\Stream; use php\jsoup\Jsoup; $source = Stream::of('php://memory', 'w+'); $source->write('<a>foobar</a>'); $source->seek(0); $doc = Jsoup::parse($source, 'UTF-8', 'examle.com'); var_dump($doc->select('a')->text()); ?> --EXPECT-- string(6) "foobar"
/** * Returns the input stream connected to the error output of the * subprocess. The stream obtains data piped from the error output * of the process represented by this `Process` object. * * @return Stream * @throws IllegalStateException */ public function getError() { return Stream::of(''); }
/** * @return Stream */ public function getContent() { return Stream::of(''); }
--TEST-- Test php\io\Stream - test file stream --FILE-- <?php use php\io\FileStream; use php\io\Stream; $memory = Stream::of(__DIR__ . '/stream_002.inc.txt'); var_dump($memory->readFully()); $memory->close(); var_dump(Stream::getContents(__DIR__ . '/stream_002.inc.txt')); $memory = Stream::of('file://' . __DIR__ . '/stream_002.inc.txt'); var_dump($memory->read(3)); $memory->close(); $memory = new FileStream(__DIR__ . '/stream_002.inc.txt'); var_dump($memory->readFully()); $memory->close(); try { $memory->read(10); } catch (\php\io\IOException $e) { var_dump($e->getMessage()); } ?> --EXPECTF-- string(6) "foobar" string(6) "foobar" string(3) "foo" string(6) "foobar" string(13) "Stream Closed"
--TEST-- Test php\io\Stream - test common --FILE-- <?php use php\io\Stream; $memory = Stream::of('php://memory', 'w+'); $memory->write('foobar'); $memory->seek(0); var_dump($memory->readFully()); ?> --EXPECTF-- string(6) "foobar"