mirror of
https://github.com/halaxa/json-machine.git
synced 2025-02-22 23:22:27 +01:00
25 lines
579 B
PHP
25 lines
579 B
PHP
<?php
|
|
|
|
namespace JsonMachineTest;
|
|
|
|
use JsonMachine\Exception\InvalidArgumentException;
|
|
use JsonMachine\StreamChunks;
|
|
|
|
/**
|
|
* @covers \JsonMachine\StreamChunks
|
|
*/
|
|
class StreamChunksTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
public function testThrowsIfNoResource()
|
|
{
|
|
$this->expectException(InvalidArgumentException::class);
|
|
new StreamChunks(false);
|
|
}
|
|
|
|
public function testGeneratorYieldsData()
|
|
{
|
|
$result = iterator_to_array(new StreamChunks(fopen('data://text/plain,test', 'r')));
|
|
$this->assertSame(['test'], $result);
|
|
}
|
|
}
|