ffi = \FFI::load(__DIR__.'/../test.h'); $stdin = $this->ffi->stdin; foreach (range('D', 'A') as $character) { $this->ffi->ungetc(ord($character), $stdin); } parent::setUp(); // TODO: Change the autogenerated stub } /** * @preserveGlobalState disabled */ public function testFailureOnInvalidLibrary() { $this->expectException(\RuntimeException::class); \getch(__DIR__.'/library.so'); } public function testGetchClass() { $getch = new Getch(); foreach (range('A', 'D') as $character) { self::assertSame(\ord($character), $getch->getch()); } } public function testGetchFunction() { foreach (range('A', 'D') as $character) { self::assertSame(\ord($character), getch()); } } public function testUnsupportedOS() { if (PHP_OS_FAMILY !== 'Linux' || PHP_OS_FAMILY !== 'Windows') { self::markTestSkipped('This test only applies to non Linux or Windows systems.'); } $this->expectException(\RuntimeException::class); \getch(); } }