~ancarda/psr7-string-stream

ref: 415624673042e8093e1d8ff161baa20473bc4d48 psr7-string-stream/tests/ReadOnlyStringStreamTest.php -rw-r--r-- 497 bytes
41562467Mark Dain Introduce ReadOnlyStringStream 1 year, 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php

declare(strict_types=1);

namespace Tests;

use Ancarda\Psr7\StringStream\ReadOnlyStringStream;
use PHPUnit\Framework\TestCase;
use RuntimeException;

class ReadOnlyStringStreamTest extends TestCase
{
    public function testReadOnly(): void
    {
        $stream = new ReadOnlyStringStream('read only string');
        static::assertFalse($stream->isWritable());

        $this->expectException(RuntimeException::class);
        $stream->write('Cannot write(): Read Only Stream');
    }
}