我有读取器类从stdin读取并返回readed值.
原文链接:https://www.f2er.com/php/136152.htmlclass Reader { const STREAM_READ = 'PHP://stdin'; private $_streamHandle; public function __construct($stream = self::STREAM_READ) { $this->_streamHandle = fopen($stream,'r'); } public function getReadedValue() { $value = trim(fgets($this->_streamHandle)); return $value; } public function __destruct() { fclose($this->_streamHandle); } }
现在是我的问题,我如何测试这个类,从stdin读取一些东西并通过getReadedValue()函数返回readed值?