28 lines
		
	
	
		
			597 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			28 lines
		
	
	
		
			597 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| 
								 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace Spark\Pipe;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class PipelineTest extends \PhpUnit\Framework\TestCase
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * @covers Pipeline::setInputFile
							 | 
						||
| 
								 | 
							
								     * @covers Pipeline::setOutputFile
							 | 
						||
| 
								 | 
							
								     * @covers Pipeline::run
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public function testPipingData()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        
							 | 
						||
| 
								 | 
							
								        $rand = random_bytes(1024);
							 | 
						||
| 
								 | 
							
								        file_put_contents("/tmp/rand.in", $rand);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $pipe = new Pipeline();
							 | 
						||
| 
								 | 
							
								        $pipe->setInputFile("/tmp/rand.in");
							 | 
						||
| 
								 | 
							
								        $pipe->setOutputFile("/tmp/rand.out");
							 | 
						||
| 
								 | 
							
								        $pipe->run();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $out = file_get_contents("/tmp/rand.out");
							 | 
						||
| 
								 | 
							
								        $this->assertEquals($rand, $out);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 |