REDROOM
PHP 8.3.31
Path:
Logout
Edit File
Size: 3.28 KB
Close
/home/getspomw/royalsquad.us/vendor/laravel/prompts/src/Concerns/FakesInputOutput.php
Text
Base64
<?php namespace Laravel\Prompts\Concerns; use Laravel\Prompts\Output\BufferedConsoleOutput; use Laravel\Prompts\Terminal; use PHPUnit\Framework\Assert; use RuntimeException; trait FakesInputOutput { /** * Fake the terminal and queue key presses to be simulated. * * @param array<string> $keys */ public static function fake(array $keys = []): void { // Force interactive mode when testing because we will be mocking the terminal. static::interactive(); $mock = \Mockery::mock(Terminal::class); $mock->shouldReceive('write')->byDefault(); $mock->shouldReceive('exit')->byDefault(); $mock->shouldReceive('setTty')->byDefault(); $mock->shouldReceive('restoreTty')->byDefault(); $mock->shouldReceive('cols')->byDefault()->andReturn(80); $mock->shouldReceive('lines')->byDefault()->andReturn(24); $mock->shouldReceive('initDimensions')->byDefault(); static::fakeKeyPresses($keys, function (string $key) use ($mock): void { $mock->shouldReceive('read')->once()->andReturn($key); }); static::$terminal = $mock; self::setOutput(new BufferedConsoleOutput); } /** * Implementation of the looping mechanism for simulating key presses. * * By ignoring the `$callable` parameter which contains the default logic * for simulating fake key presses, we can use a custom implementation * to emit key presses instead, allowing us to use different inputs. * * @param array<string> $keys * @param callable(string $key): void $callable */ public static function fakeKeyPresses(array $keys, callable $callable): void { foreach ($keys as $key) { $callable($key); } } /** * Assert that the output contains the given string. */ public static function assertOutputContains(string $string): void { Assert::assertStringContainsString($string, static::content()); } /** * Assert that the output doesn't contain the given string. */ public static function assertOutputDoesntContain(string $string): void { Assert::assertStringNotContainsString($string, static::content()); } /** * Assert that the stripped output contains the given string. */ public static function assertStrippedOutputContains(string $string): void { Assert::assertStringContainsString($string, static::strippedContent()); } /** * Assert that the stripped output doesn't contain the given string. */ public static function assertStrippedOutputDoesntContain(string $string): void { Assert::assertStringNotContainsString($string, static::strippedContent()); } /** * Get the buffered console output. */ public static function content(): string { if (! static::output() instanceof BufferedConsoleOutput) { throw new RuntimeException('Prompt must be faked before accessing content.'); } return static::output()->content(); } /** * Get the buffered console output, stripped of escape sequences. */ public static function strippedContent(): string { return preg_replace("/\e\[[0-9;?]*[A-Za-z]/", '', static::content()); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 12
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
Colors.php
3.76 KB
lrw-rw-rw-
2025-09-17 06:52:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Cursor.php
1.53 KB
lrw-rw-rw-
2025-09-17 06:52:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Erase.php
611 B
lrw-rw-rw-
2025-09-17 06:52:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Events.php
753 B
lrw-rw-rw-
2025-09-17 06:52:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FakesInputOutput.php
3.28 KB
lrw-rw-rw-
2025-09-17 06:52:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Fallback.php
1.40 KB
lrw-rw-rw-
2025-09-17 06:52:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Interactivity.php
761 B
lrw-rw-rw-
2025-09-17 06:52:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Scrolling.php
2.92 KB
lrw-rw-rw-
2025-09-17 06:52:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Termwind.php
525 B
lrw-rw-rw-
2025-09-17 06:52:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Themes.php
3.91 KB
lrw-rw-rw-
2025-09-17 06:52:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Truncation.php
2.84 KB
lrw-rw-rw-
2025-09-17 06:52:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TypedValue.php
4.92 KB
lrw-rw-rw-
2025-09-17 06:52:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).