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