Skip to content

Commit aa1bbd1

Browse files
committed
Split DummyStreamWrapper class into its own file
1 parent c4c0255 commit aa1bbd1

6 files changed

+65
-289
lines changed

ext/gd/tests/gd_create_xbm_non_castable_user_stream.phpt

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -9,71 +9,11 @@ if (!GD_BUNDLED) die("skip requires bundled GD library\n");
99
--FILE--
1010
<?php
1111

12-
class DummyStreamWrapper
13-
{
14-
/** @var resource|null */
15-
public $context;
16-
17-
/** @var resource|null */
18-
public $handle;
19-
20-
public function stream_cast(int $castAs)
21-
{
22-
return false;
23-
}
24-
25-
public function stream_close(): void { }
26-
27-
public function stream_open(string $path, string $mode, int $options = 0, ?string &$openedPath = null): bool
28-
{
29-
return true;
30-
}
31-
32-
public function stream_read(int $count)
33-
{
34-
return false;
35-
}
36-
37-
public function stream_seek(int $offset, int $whence = SEEK_SET): bool
38-
{
39-
return true;
40-
}
41-
42-
public function stream_set_option(int $option, int $arg1, ?int $arg2): bool
43-
{
44-
return false;
45-
}
46-
47-
public function stream_stat()
48-
{
49-
return [];
50-
}
51-
52-
public function stream_tell()
53-
{
54-
return [];
55-
}
56-
57-
public function stream_truncate(int $newSize): bool
58-
{
59-
return true;
60-
}
61-
62-
public function stream_write(string $data) { }
63-
64-
65-
public function unlink(string $path): bool
66-
{
67-
return false;
68-
}
69-
}
12+
require dirname(__DIR__, 3) . '/tests/output/DummyStreamWrapper.inc';
7013
stream_wrapper_register('custom', DummyStreamWrapper::class);
7114

72-
$fp = fopen("custom://myvar", "r+");
73-
7415
/* This tests the underlying _php_image_create_from() C function */
7516
var_dump(imagecreatefromxbm("custom://myvar"));
76-
fclose($fp);
7717

7818
echo "Done";
7919
?>

ext/posix/tests/posix_isatty_non_castable_user_stream.phpt

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,64 +4,8 @@ posix_isatty(): uncastable user stream
44
posix
55
--FILE--
66
<?php
7-
class DummyStreamWrapper
8-
{
9-
/** @var resource|null */
10-
public $context;
117

12-
/** @var resource|null */
13-
public $handle;
14-
15-
public function stream_cast(int $castAs)
16-
{
17-
return false;
18-
}
19-
20-
public function stream_close(): void { }
21-
22-
public function stream_open(string $path, string $mode, int $options = 0, ?string &$openedPath = null): bool
23-
{
24-
return true;
25-
}
26-
27-
public function stream_read(int $count)
28-
{
29-
return false;
30-
}
31-
32-
public function stream_seek(int $offset, int $whence = SEEK_SET): bool
33-
{
34-
return true;
35-
}
36-
37-
public function stream_set_option(int $option, int $arg1, ?int $arg2): bool
38-
{
39-
return false;
40-
}
41-
42-
public function stream_stat()
43-
{
44-
return [];
45-
}
46-
47-
public function stream_tell()
48-
{
49-
return [];
50-
}
51-
52-
public function stream_truncate(int $newSize): bool
53-
{
54-
return true;
55-
}
56-
57-
public function stream_write(string $data) { }
58-
59-
60-
public function unlink(string $path): bool
61-
{
62-
return false;
63-
}
64-
}
8+
require dirname(__DIR__, 3) . '/tests/output/DummyStreamWrapper.inc';
659
stream_wrapper_register('custom', DummyStreamWrapper::class);
6610

6711
$fp = fopen("custom://myvar", "r+");

ext/posix/tests/posix_ttyname_non_castable_user_stream.phpt

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,64 +4,8 @@ posix_ttyname(): uncastable user stream
44
posix
55
--FILE--
66
<?php
7-
class DummyStreamWrapper
8-
{
9-
/** @var resource|null */
10-
public $context;
117

12-
/** @var resource|null */
13-
public $handle;
14-
15-
public function stream_cast(int $castAs)
16-
{
17-
return false;
18-
}
19-
20-
public function stream_close(): void { }
21-
22-
public function stream_open(string $path, string $mode, int $options = 0, ?string &$openedPath = null): bool
23-
{
24-
return true;
25-
}
26-
27-
public function stream_read(int $count)
28-
{
29-
return false;
30-
}
31-
32-
public function stream_seek(int $offset, int $whence = SEEK_SET): bool
33-
{
34-
return true;
35-
}
36-
37-
public function stream_set_option(int $option, int $arg1, ?int $arg2): bool
38-
{
39-
return false;
40-
}
41-
42-
public function stream_stat()
43-
{
44-
return [];
45-
}
46-
47-
public function stream_tell()
48-
{
49-
return [];
50-
}
51-
52-
public function stream_truncate(int $newSize): bool
53-
{
54-
return true;
55-
}
56-
57-
public function stream_write(string $data) { }
58-
59-
60-
public function unlink(string $path): bool
61-
{
62-
return false;
63-
}
64-
}
8+
require dirname(__DIR__, 3) . '/tests/output/DummyStreamWrapper.inc';
659
stream_wrapper_register('custom', DummyStreamWrapper::class);
6610

6711
$fp = fopen("custom://myvar", "r+");

tests/output/DummyStreamWrapper.inc

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
3+
class DummyStreamWrapper
4+
{
5+
/** @var resource|null */
6+
public $context;
7+
8+
/** @var resource|null */
9+
public $handle;
10+
11+
public function stream_cast(int $castAs)
12+
{
13+
return false;
14+
}
15+
16+
public function stream_close(): void { }
17+
18+
public function stream_open(string $path, string $mode, int $options = 0, ?string &$openedPath = null): bool
19+
{
20+
return true;
21+
}
22+
23+
public function stream_read(int $count)
24+
{
25+
return false;
26+
}
27+
28+
public function stream_seek(int $offset, int $whence = SEEK_SET): bool
29+
{
30+
return true;
31+
}
32+
33+
public function stream_set_option(int $option, int $arg1, ?int $arg2): bool
34+
{
35+
return false;
36+
}
37+
38+
public function stream_stat()
39+
{
40+
return [];
41+
}
42+
43+
public function stream_tell()
44+
{
45+
return [];
46+
}
47+
48+
public function stream_truncate(int $newSize): bool
49+
{
50+
return true;
51+
}
52+
53+
public function stream_write(string $data) { }
54+
55+
56+
public function unlink(string $path): bool
57+
{
58+
return false;
59+
}
60+
}

tests/output/sapi_windows_vt100_support_non_castable_user_stream.phpt

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -13,64 +13,8 @@ if(PHP_OS_FAMILY !== "Windows") {
1313
?>
1414
--FILE--
1515
<?php
16-
class DummyStreamWrapper
17-
{
18-
/** @var resource|null */
19-
public $context;
2016

21-
/** @var resource|null */
22-
public $handle;
23-
24-
public function stream_cast(int $castAs)
25-
{
26-
return false;
27-
}
28-
29-
public function stream_close(): void { }
30-
31-
public function stream_open(string $path, string $mode, int $options = 0, ?string &$openedPath = null): bool
32-
{
33-
return true;
34-
}
35-
36-
public function stream_read(int $count)
37-
{
38-
return false;
39-
}
40-
41-
public function stream_seek(int $offset, int $whence = SEEK_SET): bool
42-
{
43-
return true;
44-
}
45-
46-
public function stream_set_option(int $option, int $arg1, ?int $arg2): bool
47-
{
48-
return false;
49-
}
50-
51-
public function stream_stat()
52-
{
53-
return [];
54-
}
55-
56-
public function stream_tell()
57-
{
58-
return [];
59-
}
60-
61-
public function stream_truncate(int $newSize): bool
62-
{
63-
return true;
64-
}
65-
66-
public function stream_write(string $data) { }
67-
68-
69-
public function unlink(string $path): bool
70-
{
71-
return false;
72-
}
73-
}
17+
require __DIR__ . '/DummyStreamWrapper.inc';
7418
stream_wrapper_register('custom', DummyStreamWrapper::class);
7519

7620
$fp = fopen("custom://myvar", "r+");

tests/output/stream_isatty_non_castable_user_stream.phpt

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,64 +2,8 @@
22
stream_isatty(): uncastable user stream
33
--FILE--
44
<?php
5-
class DummyStreamWrapper
6-
{
7-
/** @var resource|null */
8-
public $context;
95

10-
/** @var resource|null */
11-
public $handle;
12-
13-
public function stream_cast(int $castAs)
14-
{
15-
return false;
16-
}
17-
18-
public function stream_close(): void { }
19-
20-
public function stream_open(string $path, string $mode, int $options = 0, ?string &$openedPath = null): bool
21-
{
22-
return true;
23-
}
24-
25-
public function stream_read(int $count)
26-
{
27-
return false;
28-
}
29-
30-
public function stream_seek(int $offset, int $whence = SEEK_SET): bool
31-
{
32-
return true;
33-
}
34-
35-
public function stream_set_option(int $option, int $arg1, ?int $arg2): bool
36-
{
37-
return false;
38-
}
39-
40-
public function stream_stat()
41-
{
42-
return [];
43-
}
44-
45-
public function stream_tell()
46-
{
47-
return [];
48-
}
49-
50-
public function stream_truncate(int $newSize): bool
51-
{
52-
return true;
53-
}
54-
55-
public function stream_write(string $data) { }
56-
57-
58-
public function unlink(string $path): bool
59-
{
60-
return false;
61-
}
62-
}
6+
require __DIR__ . '/DummyStreamWrapper.inc';
637
stream_wrapper_register('custom', DummyStreamWrapper::class);
648

659
$fp = fopen("custom://myvar", "r+");

0 commit comments

Comments
 (0)