@@ 26-76 (lines=51) @@ | ||
23 | use InvalidArgumentException; |
|
24 | use Mockery as m; |
|
25 | ||
26 | class DeCompressTest extends RealFileTestCase |
|
27 | { |
|
28 | public function testDeCompressNotOnLocalFileWillThrowAnException() |
|
29 | { |
|
30 | $file = m::mock(NodeInterface::class); |
|
31 | $flow = new DeCompress(); |
|
32 | ||
33 | $this->expectException(InvalidArgumentException::class); |
|
34 | ||
35 | $flow->flow($file); |
|
36 | } |
|
37 | ||
38 | public function testDeCompress() |
|
39 | { |
|
40 | $file = $this->makeFile('decompress/initial/source', 'some text'); |
|
41 | $compressed = Flow::compress(Gzip::NAME)->flow($file); |
|
42 | $flow = new DeCompress(); |
|
43 | ||
44 | $output = $flow->flow($compressed); |
|
45 | ||
46 | static::assertNotSame($file, $output); |
|
47 | static::assertInstanceOf(LocalFile::class, $output); |
|
48 | static::assertEquals(CompressionFactory::TYPE_NONE, $output->getCompression()); |
|
49 | } |
|
50 | ||
51 | public function testStaticFlow() |
|
52 | { |
|
53 | $file = $this->makeFile('decompress/static/source', 'some text'); |
|
54 | $compressed = Flow::compress(Gzip::NAME)->flow($file); |
|
55 | $flow = Flow::decompress(); |
|
56 | ||
57 | $output = $flow->flow($compressed); |
|
58 | ||
59 | static::assertNotSame($file, $output); |
|
60 | static::assertInstanceOf(LocalFile::class, $output); |
|
61 | static::assertEquals(CompressionFactory::TYPE_NONE, $output->getCompression()); |
|
62 | } |
|
63 | ||
64 | public function testInvokeFlow() |
|
65 | { |
|
66 | $file = $this->makeFile('decompress/invoke/source', 'some text'); |
|
67 | $compressed = Flow::compress(Gzip::NAME)->flow($file); |
|
68 | $flow = new DeCompress(); |
|
69 | ||
70 | $output = call_user_func($flow, $compressed); |
|
71 | ||
72 | static::assertNotSame($file, $output); |
|
73 | static::assertInstanceOf(LocalFile::class, $output); |
|
74 | static::assertEquals(CompressionFactory::TYPE_NONE, $output->getCompression()); |
|
75 | } |
|
76 | } |
|
77 |
@@ 26-76 (lines=51) @@ | ||
23 | use InvalidArgumentException; |
|
24 | use Mockery as m; |
|
25 | ||
26 | class GunzipTest extends RealFileTestCase |
|
27 | { |
|
28 | public function testDeCompressNotOnLocalFileWillThrowAnException() |
|
29 | { |
|
30 | $file = m::mock(NodeInterface::class); |
|
31 | $flow = new Gunzip(); |
|
32 | ||
33 | $this->expectException(InvalidArgumentException::class); |
|
34 | ||
35 | $flow->flow($file); |
|
36 | } |
|
37 | ||
38 | public function testDeCompress() |
|
39 | { |
|
40 | $file = $this->makeFile('gunzip/initial/source', 'some text'); |
|
41 | $compressed = Flow::compress(Gzip::NAME)->flow($file); |
|
42 | $flow = new Gunzip(); |
|
43 | ||
44 | $output = $flow->flow($compressed); |
|
45 | ||
46 | static::assertNotSame($file, $output); |
|
47 | static::assertInstanceOf(LocalFile::class, $output); |
|
48 | static::assertEquals(CompressionFactory::TYPE_NONE, $output->getCompression()); |
|
49 | } |
|
50 | ||
51 | public function testStaticFlow() |
|
52 | { |
|
53 | $file = $this->makeFile('gunzip/static/source', 'some text'); |
|
54 | $compressed = Flow::compress(Gzip::NAME)->flow($file); |
|
55 | $flow = Flow::gunzip(); |
|
56 | ||
57 | $output = $flow->flow($compressed); |
|
58 | ||
59 | static::assertNotSame($file, $output); |
|
60 | static::assertInstanceOf(LocalFile::class, $output); |
|
61 | static::assertEquals(CompressionFactory::TYPE_NONE, $output->getCompression()); |
|
62 | } |
|
63 | ||
64 | public function testInvokeFlow() |
|
65 | { |
|
66 | $file = $this->makeFile('gunzip/invoke/source', 'some text'); |
|
67 | $compressed = Flow::compress(Gzip::NAME)->flow($file); |
|
68 | $flow = new Gunzip(); |
|
69 | ||
70 | $output = call_user_func($flow, $compressed); |
|
71 | ||
72 | static::assertNotSame($file, $output); |
|
73 | static::assertInstanceOf(LocalFile::class, $output); |
|
74 | static::assertEquals(CompressionFactory::TYPE_NONE, $output->getCompression()); |
|
75 | } |
|
76 | } |
|
77 |
@@ 26-76 (lines=51) @@ | ||
23 | use InvalidArgumentException; |
|
24 | use Mockery as m; |
|
25 | ||
26 | class UnzipTest extends RealFileTestCase |
|
27 | { |
|
28 | public function testCompressNotOnLocalFileWillThrowAnException() |
|
29 | { |
|
30 | $file = m::mock(NodeInterface::class); |
|
31 | $flow = new Unzip(); |
|
32 | ||
33 | $this->expectException(InvalidArgumentException::class); |
|
34 | ||
35 | $flow->flow($file); |
|
36 | } |
|
37 | ||
38 | public function testDeCompress() |
|
39 | { |
|
40 | $file = $this->makeFile('unzip/initial/source.txt', 'some text'); |
|
41 | $compressed = Flow::compress(Zip::NAME)->flow($file); |
|
42 | $flow = new Unzip(); |
|
43 | ||
44 | $output = $flow->flow($compressed); |
|
45 | ||
46 | static::assertNotSame($file, $output); |
|
47 | static::assertInstanceOf(LocalFile::class, $output); |
|
48 | static::assertEquals(CompressionFactory::TYPE_NONE, $output->getCompression()); |
|
49 | } |
|
50 | ||
51 | public function testStaticFlow() |
|
52 | { |
|
53 | $file = $this->makeFile('unzip/static/source.txt', 'some text'); |
|
54 | $compressed = Flow::compress(Zip::NAME)->flow($file); |
|
55 | $flow = Flow::unzip(); |
|
56 | ||
57 | $output = $flow->flow($compressed); |
|
58 | ||
59 | static::assertNotSame($file, $output); |
|
60 | static::assertInstanceOf(LocalFile::class, $output); |
|
61 | static::assertEquals(CompressionFactory::TYPE_NONE, $output->getCompression()); |
|
62 | } |
|
63 | ||
64 | public function testInvokeFlow() |
|
65 | { |
|
66 | $file = $this->makeFile('unzip/invoke/source.txt', 'some text'); |
|
67 | $compressed = Flow::compress(Zip::NAME)->flow($file); |
|
68 | $flow = new Unzip(); |
|
69 | ||
70 | $output = call_user_func($flow, $compressed); |
|
71 | ||
72 | static::assertNotSame($file, $output); |
|
73 | static::assertInstanceOf(LocalFile::class, $output); |
|
74 | static::assertEquals(CompressionFactory::TYPE_NONE, $output->getCompression()); |
|
75 | } |
|
76 | } |
|
77 |