@@ -21,79 +21,79 @@ |
||
21 | 21 | */ |
22 | 22 | class UploadManagerTest extends UnitTestCase |
23 | 23 | { |
24 | - /** |
|
25 | - * @var UploadManager |
|
26 | - */ |
|
27 | - private $fixture; |
|
24 | + /** |
|
25 | + * @var UploadManager |
|
26 | + */ |
|
27 | + private $fixture; |
|
28 | 28 | |
29 | - /** |
|
30 | - * @var string |
|
31 | - */ |
|
32 | - private $fakeName = ''; |
|
29 | + /** |
|
30 | + * @var string |
|
31 | + */ |
|
32 | + private $fakeName = ''; |
|
33 | 33 | |
34 | - /** |
|
35 | - * @var string |
|
36 | - */ |
|
37 | - private $fakePrefix = ''; |
|
34 | + /** |
|
35 | + * @var string |
|
36 | + */ |
|
37 | + private $fakePrefix = ''; |
|
38 | 38 | |
39 | - public function setUp() |
|
40 | - { |
|
41 | - $this->fixture = new UploadManager(); |
|
42 | - $this->fakeName = uniqid('name'); |
|
43 | - $this->fakePrefix= uniqid('prefix'); |
|
44 | - } |
|
39 | + public function setUp() |
|
40 | + { |
|
41 | + $this->fixture = new UploadManager(); |
|
42 | + $this->fakeName = uniqid('name'); |
|
43 | + $this->fakePrefix= uniqid('prefix'); |
|
44 | + } |
|
45 | 45 | |
46 | - public function tearDown() |
|
47 | - { |
|
48 | - unset($this->fixture); |
|
49 | - } |
|
46 | + public function tearDown() |
|
47 | + { |
|
48 | + unset($this->fixture); |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * @test |
|
53 | - * @dataProvider propertyProvider |
|
54 | - */ |
|
55 | - public function testProperty($propertyName, $value) |
|
56 | - { |
|
57 | - $setter = 'set' . ucfirst($propertyName); |
|
58 | - $getter = 'get' . ucfirst($propertyName); |
|
59 | - call_user_func_array(array($this->fixture, $setter), array($value)); |
|
60 | - $this->assertEquals($value, call_user_func(array($this->fixture, $getter))); |
|
61 | - } |
|
51 | + /** |
|
52 | + * @test |
|
53 | + * @dataProvider propertyProvider |
|
54 | + */ |
|
55 | + public function testProperty($propertyName, $value) |
|
56 | + { |
|
57 | + $setter = 'set' . ucfirst($propertyName); |
|
58 | + $getter = 'get' . ucfirst($propertyName); |
|
59 | + call_user_func_array(array($this->fixture, $setter), array($value)); |
|
60 | + $this->assertEquals($value, call_user_func(array($this->fixture, $getter))); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Provider |
|
65 | - */ |
|
66 | - public function propertyProvider() |
|
67 | - { |
|
68 | - return array( |
|
69 | - array('uploadFolder', uniqid()), |
|
70 | - array('inputName', uniqid()), |
|
71 | - array('sizeLimit', rand(10, 100)), |
|
72 | - ); |
|
73 | - } |
|
63 | + /** |
|
64 | + * Provider |
|
65 | + */ |
|
66 | + public function propertyProvider() |
|
67 | + { |
|
68 | + return array( |
|
69 | + array('uploadFolder', uniqid()), |
|
70 | + array('inputName', uniqid()), |
|
71 | + array('sizeLimit', rand(10, 100)), |
|
72 | + ); |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * @test |
|
77 | - * @dataProvider fileNameProvider |
|
78 | - */ |
|
79 | - public function sanitizeFileNameTest($actual, $expected) |
|
80 | - { |
|
81 | - $this->assertSame($expected, $this->fixture->sanitizeFileName($actual)); |
|
82 | - } |
|
75 | + /** |
|
76 | + * @test |
|
77 | + * @dataProvider fileNameProvider |
|
78 | + */ |
|
79 | + public function sanitizeFileNameTest($actual, $expected) |
|
80 | + { |
|
81 | + $this->assertSame($expected, $this->fixture->sanitizeFileName($actual)); |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * Provider |
|
86 | - */ |
|
87 | - public function fileNameProvider() |
|
88 | - { |
|
89 | - return array( |
|
90 | - array('éléphant', 'elephant'), |
|
91 | - array('foo bar', 'foo-bar'), |
|
92 | - array('Foo Bar', 'Foo-Bar'), |
|
93 | - array('foo_bar', 'foo_bar'), |
|
94 | - array('foo&bar', 'foo-bar'), |
|
95 | - array('foo!bar', 'foo-bar'), |
|
96 | - array('foo~bar', 'foo-bar'), |
|
97 | - ); |
|
98 | - } |
|
84 | + /** |
|
85 | + * Provider |
|
86 | + */ |
|
87 | + public function fileNameProvider() |
|
88 | + { |
|
89 | + return array( |
|
90 | + array('éléphant', 'elephant'), |
|
91 | + array('foo bar', 'foo-bar'), |
|
92 | + array('Foo Bar', 'Foo-Bar'), |
|
93 | + array('foo_bar', 'foo_bar'), |
|
94 | + array('foo&bar', 'foo-bar'), |
|
95 | + array('foo!bar', 'foo-bar'), |
|
96 | + array('foo~bar', 'foo-bar'), |
|
97 | + ); |
|
98 | + } |
|
99 | 99 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | { |
41 | 41 | $this->fixture = new UploadManager(); |
42 | 42 | $this->fakeName = uniqid('name'); |
43 | - $this->fakePrefix= uniqid('prefix'); |
|
43 | + $this->fakePrefix = uniqid('prefix'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | public function tearDown() |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function testProperty($propertyName, $value) |
56 | 56 | { |
57 | - $setter = 'set' . ucfirst($propertyName); |
|
58 | - $getter = 'get' . ucfirst($propertyName); |
|
57 | + $setter = 'set'.ucfirst($propertyName); |
|
58 | + $getter = 'get'.ucfirst($propertyName); |
|
59 | 59 | call_user_func_array(array($this->fixture, $setter), array($value)); |
60 | 60 | $this->assertEquals($value, call_user_func(array($this->fixture, $getter))); |
61 | 61 | } |
@@ -21,48 +21,48 @@ |
||
21 | 21 | */ |
22 | 22 | class ImageOptimizerTest extends UnitTestCase |
23 | 23 | { |
24 | - /** |
|
25 | - * @var ImageOptimizer |
|
26 | - */ |
|
27 | - private $fixture; |
|
24 | + /** |
|
25 | + * @var ImageOptimizer |
|
26 | + */ |
|
27 | + private $fixture; |
|
28 | 28 | |
29 | - public function setUp() |
|
30 | - { |
|
31 | - $this->fixture = new ImageOptimizer(); |
|
32 | - } |
|
29 | + public function setUp() |
|
30 | + { |
|
31 | + $this->fixture = new ImageOptimizer(); |
|
32 | + } |
|
33 | 33 | |
34 | - public function tearDown() |
|
35 | - { |
|
36 | - unset($this->fixture); |
|
37 | - } |
|
34 | + public function tearDown() |
|
35 | + { |
|
36 | + unset($this->fixture); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * @test |
|
41 | - */ |
|
42 | - public function checkOptimizersPropertyContainsDefaultValues() |
|
43 | - { |
|
44 | - $this->assertAttributeContains('Fab\Media\FileUpload\Optimizer\Resize', 'optimizers', $this->fixture); |
|
45 | - $this->assertAttributeContains('Fab\Media\FileUpload\Optimizer\Rotate', 'optimizers', $this->fixture); |
|
46 | - } |
|
39 | + /** |
|
40 | + * @test |
|
41 | + */ |
|
42 | + public function checkOptimizersPropertyContainsDefaultValues() |
|
43 | + { |
|
44 | + $this->assertAttributeContains('Fab\Media\FileUpload\Optimizer\Resize', 'optimizers', $this->fixture); |
|
45 | + $this->assertAttributeContains('Fab\Media\FileUpload\Optimizer\Rotate', 'optimizers', $this->fixture); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @test |
|
50 | - */ |
|
51 | - public function addNewRandomOptimizer() |
|
52 | - { |
|
53 | - $optimizer = uniqid(); |
|
54 | - $this->fixture->add($optimizer); |
|
55 | - $this->assertAttributeContains($optimizer, 'optimizers', $this->fixture); |
|
56 | - } |
|
48 | + /** |
|
49 | + * @test |
|
50 | + */ |
|
51 | + public function addNewRandomOptimizer() |
|
52 | + { |
|
53 | + $optimizer = uniqid(); |
|
54 | + $this->fixture->add($optimizer); |
|
55 | + $this->assertAttributeContains($optimizer, 'optimizers', $this->fixture); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * @test |
|
60 | - */ |
|
61 | - public function addNewRandomAndRemoveOptimizer() |
|
62 | - { |
|
63 | - $optimizer = uniqid(); |
|
64 | - $this->fixture->add($optimizer); |
|
65 | - $this->fixture->remove($optimizer); |
|
66 | - $this->assertAttributeNotContains($optimizer, 'optimizers', $this->fixture); |
|
67 | - } |
|
58 | + /** |
|
59 | + * @test |
|
60 | + */ |
|
61 | + public function addNewRandomAndRemoveOptimizer() |
|
62 | + { |
|
63 | + $optimizer = uniqid(); |
|
64 | + $this->fixture->add($optimizer); |
|
65 | + $this->fixture->remove($optimizer); |
|
66 | + $this->assertAttributeNotContains($optimizer, 'optimizers', $this->fixture); |
|
67 | + } |
|
68 | 68 | } |
@@ -21,26 +21,26 @@ |
||
21 | 21 | */ |
22 | 22 | class CategoryRendererTest extends UnitTestCase |
23 | 23 | { |
24 | - /** |
|
25 | - * @var CategoryRenderer |
|
26 | - */ |
|
27 | - private $fixture; |
|
24 | + /** |
|
25 | + * @var CategoryRenderer |
|
26 | + */ |
|
27 | + private $fixture; |
|
28 | 28 | |
29 | - public function setUp() |
|
30 | - { |
|
31 | - $this->fixture = new CategoryRenderer(); |
|
32 | - } |
|
29 | + public function setUp() |
|
30 | + { |
|
31 | + $this->fixture = new CategoryRenderer(); |
|
32 | + } |
|
33 | 33 | |
34 | - public function tearDown() |
|
35 | - { |
|
36 | - unset($this->fixture); |
|
37 | - } |
|
34 | + public function tearDown() |
|
35 | + { |
|
36 | + unset($this->fixture); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * @test |
|
41 | - */ |
|
42 | - public function fixtureIsOfTypeGridRendererCategoryRenderer() |
|
43 | - { |
|
44 | - $this->assertInstanceOf('Fab\Media\Grid\CategoryRenderer', $this->fixture); |
|
45 | - } |
|
39 | + /** |
|
40 | + * @test |
|
41 | + */ |
|
42 | + public function fixtureIsOfTypeGridRendererCategoryRenderer() |
|
43 | + { |
|
44 | + $this->assertInstanceOf('Fab\Media\Grid\CategoryRenderer', $this->fixture); |
|
45 | + } |
|
46 | 46 | } |
@@ -21,26 +21,26 @@ |
||
21 | 21 | */ |
22 | 22 | class UsageRendererTest extends UnitTestCase |
23 | 23 | { |
24 | - /** |
|
25 | - * @var UsageRenderer |
|
26 | - */ |
|
27 | - private $fixture; |
|
24 | + /** |
|
25 | + * @var UsageRenderer |
|
26 | + */ |
|
27 | + private $fixture; |
|
28 | 28 | |
29 | - public function setUp() |
|
30 | - { |
|
31 | - $this->fixture = new UsageRenderer(); |
|
32 | - } |
|
29 | + public function setUp() |
|
30 | + { |
|
31 | + $this->fixture = new UsageRenderer(); |
|
32 | + } |
|
33 | 33 | |
34 | - public function tearDown() |
|
35 | - { |
|
36 | - unset($this->fixture); |
|
37 | - } |
|
34 | + public function tearDown() |
|
35 | + { |
|
36 | + unset($this->fixture); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * @test |
|
41 | - */ |
|
42 | - public function fixtureIsOfTypeGridRendererUsageRenderer() |
|
43 | - { |
|
44 | - $this->assertInstanceOf('Fab\Media\Grid\UsageRenderer', $this->fixture); |
|
45 | - } |
|
39 | + /** |
|
40 | + * @test |
|
41 | + */ |
|
42 | + public function fixtureIsOfTypeGridRendererUsageRenderer() |
|
43 | + { |
|
44 | + $this->assertInstanceOf('Fab\Media\Grid\UsageRenderer', $this->fixture); |
|
45 | + } |
|
46 | 46 | } |
@@ -21,26 +21,26 @@ |
||
21 | 21 | */ |
22 | 22 | class FrontendPermissionRendererTest extends UnitTestCase |
23 | 23 | { |
24 | - /** |
|
25 | - * @var FrontendPermissionRenderer |
|
26 | - */ |
|
27 | - private $fixture; |
|
24 | + /** |
|
25 | + * @var FrontendPermissionRenderer |
|
26 | + */ |
|
27 | + private $fixture; |
|
28 | 28 | |
29 | - public function setUp() |
|
30 | - { |
|
31 | - $this->fixture = new FrontendPermissionRenderer(); |
|
32 | - } |
|
29 | + public function setUp() |
|
30 | + { |
|
31 | + $this->fixture = new FrontendPermissionRenderer(); |
|
32 | + } |
|
33 | 33 | |
34 | - public function tearDown() |
|
35 | - { |
|
36 | - unset($this->fixture); |
|
37 | - } |
|
34 | + public function tearDown() |
|
35 | + { |
|
36 | + unset($this->fixture); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * @test |
|
41 | - */ |
|
42 | - public function fixtureIsOfTypeGridRendererFrontendPermissionRenderer() |
|
43 | - { |
|
44 | - $this->assertInstanceOf('Fab\Media\Grid\FrontendPermissionRenderer', $this->fixture); |
|
45 | - } |
|
39 | + /** |
|
40 | + * @test |
|
41 | + */ |
|
42 | + public function fixtureIsOfTypeGridRendererFrontendPermissionRenderer() |
|
43 | + { |
|
44 | + $this->assertInstanceOf('Fab\Media\Grid\FrontendPermissionRenderer', $this->fixture); |
|
45 | + } |
|
46 | 46 | } |
@@ -24,75 +24,75 @@ |
||
24 | 24 | */ |
25 | 25 | class FileUploadTest extends AbstractFunctionalTestCase |
26 | 26 | { |
27 | - /** |
|
28 | - * @var FileUpload |
|
29 | - */ |
|
30 | - private $fixture; |
|
31 | - |
|
32 | - /** |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - private $fakeName = ''; |
|
36 | - |
|
37 | - /** |
|
38 | - * @var string |
|
39 | - */ |
|
40 | - private $fakePrefix = ''; |
|
41 | - |
|
42 | - public function setUp() |
|
43 | - { |
|
44 | - parent::setUp(); |
|
45 | - |
|
46 | - $this->fixture = $this->getMock('Fab\Media\Form\FileUpload', array('addLanguage')); |
|
47 | - $this->fakeName = uniqid('name'); |
|
48 | - $this->fakePrefix= uniqid('prefix'); |
|
49 | - } |
|
50 | - |
|
51 | - public function tearDown() |
|
52 | - { |
|
53 | - unset($this->fixture); |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * @test |
|
58 | - */ |
|
59 | - public function getJavaScriptMethodReturnNotEmptyContent() |
|
60 | - { |
|
61 | - $method = new \ReflectionMethod( |
|
62 | - 'Fab\Media\Form\FileUpload', |
|
63 | - 'getJavaScript' |
|
64 | - ); |
|
65 | - |
|
66 | - $method->setAccessible(true); |
|
67 | - #$actual = $method->invoke($this->fixture); |
|
68 | - $this->markTestIncomplete('Fix test by mocking storage'); |
|
69 | - #$this->assertNotEmpty($actual); |
|
70 | - } |
|
71 | - |
|
72 | - /** |
|
73 | - * @test |
|
74 | - */ |
|
75 | - public function renderFileUploadIsNotEmptyByDefault() |
|
76 | - { |
|
77 | - $this->markTestIncomplete('Fix test by mocking storage'); |
|
78 | - #$this->assertNotEmpty($this->fixture->render()); |
|
79 | - } |
|
80 | - |
|
81 | - /** |
|
82 | - * @test |
|
83 | - */ |
|
84 | - public function getBasePrefixStripsTheSquareBraquets() |
|
85 | - { |
|
86 | - $method = new \ReflectionMethod( |
|
87 | - 'Fab\Media\Form\FileUpload', |
|
88 | - 'getBasePrefix' |
|
89 | - ); |
|
90 | - |
|
91 | - $method->setAccessible(true); |
|
92 | - |
|
93 | - $basePart = uniqid(); |
|
94 | - $fakePrefix = $basePart . '[foo]'; |
|
95 | - $actual = $method->invokeArgs($this->fixture, array($fakePrefix)); |
|
96 | - $this->assertSame($basePart, $actual); |
|
97 | - } |
|
27 | + /** |
|
28 | + * @var FileUpload |
|
29 | + */ |
|
30 | + private $fixture; |
|
31 | + |
|
32 | + /** |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + private $fakeName = ''; |
|
36 | + |
|
37 | + /** |
|
38 | + * @var string |
|
39 | + */ |
|
40 | + private $fakePrefix = ''; |
|
41 | + |
|
42 | + public function setUp() |
|
43 | + { |
|
44 | + parent::setUp(); |
|
45 | + |
|
46 | + $this->fixture = $this->getMock('Fab\Media\Form\FileUpload', array('addLanguage')); |
|
47 | + $this->fakeName = uniqid('name'); |
|
48 | + $this->fakePrefix= uniqid('prefix'); |
|
49 | + } |
|
50 | + |
|
51 | + public function tearDown() |
|
52 | + { |
|
53 | + unset($this->fixture); |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * @test |
|
58 | + */ |
|
59 | + public function getJavaScriptMethodReturnNotEmptyContent() |
|
60 | + { |
|
61 | + $method = new \ReflectionMethod( |
|
62 | + 'Fab\Media\Form\FileUpload', |
|
63 | + 'getJavaScript' |
|
64 | + ); |
|
65 | + |
|
66 | + $method->setAccessible(true); |
|
67 | + #$actual = $method->invoke($this->fixture); |
|
68 | + $this->markTestIncomplete('Fix test by mocking storage'); |
|
69 | + #$this->assertNotEmpty($actual); |
|
70 | + } |
|
71 | + |
|
72 | + /** |
|
73 | + * @test |
|
74 | + */ |
|
75 | + public function renderFileUploadIsNotEmptyByDefault() |
|
76 | + { |
|
77 | + $this->markTestIncomplete('Fix test by mocking storage'); |
|
78 | + #$this->assertNotEmpty($this->fixture->render()); |
|
79 | + } |
|
80 | + |
|
81 | + /** |
|
82 | + * @test |
|
83 | + */ |
|
84 | + public function getBasePrefixStripsTheSquareBraquets() |
|
85 | + { |
|
86 | + $method = new \ReflectionMethod( |
|
87 | + 'Fab\Media\Form\FileUpload', |
|
88 | + 'getBasePrefix' |
|
89 | + ); |
|
90 | + |
|
91 | + $method->setAccessible(true); |
|
92 | + |
|
93 | + $basePart = uniqid(); |
|
94 | + $fakePrefix = $basePart . '[foo]'; |
|
95 | + $actual = $method->invokeArgs($this->fixture, array($fakePrefix)); |
|
96 | + $this->assertSame($basePart, $actual); |
|
97 | + } |
|
98 | 98 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | use Fab\Media\Tests\Functional\AbstractFunctionalTestCase; |
19 | 19 | |
20 | -require_once dirname(dirname(__FILE__)) . '/AbstractFunctionalTestCase.php'; |
|
20 | +require_once dirname(dirname(__FILE__)).'/AbstractFunctionalTestCase.php'; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Test case for class \Fab\Media\Form\FileUpload. |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $this->fixture = $this->getMock('Fab\Media\Form\FileUpload', array('addLanguage')); |
47 | 47 | $this->fakeName = uniqid('name'); |
48 | - $this->fakePrefix= uniqid('prefix'); |
|
48 | + $this->fakePrefix = uniqid('prefix'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | public function tearDown() |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $method->setAccessible(true); |
92 | 92 | |
93 | 93 | $basePart = uniqid(); |
94 | - $fakePrefix = $basePart . '[foo]'; |
|
94 | + $fakePrefix = $basePart.'[foo]'; |
|
95 | 95 | $actual = $method->invokeArgs($this->fixture, array($fakePrefix)); |
96 | 96 | $this->assertSame($basePart, $actual); |
97 | 97 | } |
@@ -24,69 +24,69 @@ |
||
24 | 24 | */ |
25 | 25 | class ConfigurationUtilityTest extends AbstractFunctionalTestCase |
26 | 26 | { |
27 | - /** |
|
28 | - * @var ConfigurationUtility |
|
29 | - */ |
|
30 | - private $fixture; |
|
27 | + /** |
|
28 | + * @var ConfigurationUtility |
|
29 | + */ |
|
30 | + private $fixture; |
|
31 | 31 | |
32 | - public function setUp() |
|
33 | - { |
|
34 | - parent::setUp(); |
|
35 | - $this->fixture = new ConfigurationUtility(); |
|
36 | - } |
|
32 | + public function setUp() |
|
33 | + { |
|
34 | + parent::setUp(); |
|
35 | + $this->fixture = new ConfigurationUtility(); |
|
36 | + } |
|
37 | 37 | |
38 | - public function tearDown() |
|
39 | - { |
|
40 | - unset($this->fixture); |
|
41 | - } |
|
38 | + public function tearDown() |
|
39 | + { |
|
40 | + unset($this->fixture); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @test |
|
45 | - */ |
|
46 | - public function getConfigurationReturnNotEmptyArrayByDefault() |
|
47 | - { |
|
48 | - $actual = $this->fixture->getConfiguration(); |
|
49 | - $this->assertTrue(is_array($actual)); |
|
50 | - $this->assertNotEmpty($actual); |
|
51 | - } |
|
43 | + /** |
|
44 | + * @test |
|
45 | + */ |
|
46 | + public function getConfigurationReturnNotEmptyArrayByDefault() |
|
47 | + { |
|
48 | + $actual = $this->fixture->getConfiguration(); |
|
49 | + $this->assertTrue(is_array($actual)); |
|
50 | + $this->assertNotEmpty($actual); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @test |
|
55 | - */ |
|
56 | - public function thumbnailSizeSettingReturnsNotEmpty() |
|
57 | - { |
|
58 | - $actual = $this->fixture->get('image_thumbnail'); |
|
59 | - $this->assertTrue($actual > 1); |
|
60 | - } |
|
53 | + /** |
|
54 | + * @test |
|
55 | + */ |
|
56 | + public function thumbnailSizeSettingReturnsNotEmpty() |
|
57 | + { |
|
58 | + $actual = $this->fixture->get('image_thumbnail'); |
|
59 | + $this->assertTrue($actual > 1); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @test |
|
64 | - */ |
|
65 | - public function getFooValueReturnsEmpty() |
|
66 | - { |
|
67 | - $expected = ''; |
|
68 | - $actual = $this->fixture->get(uniqid('foo')); |
|
69 | - $this->assertEquals($expected, $actual); |
|
70 | - } |
|
62 | + /** |
|
63 | + * @test |
|
64 | + */ |
|
65 | + public function getFooValueReturnsEmpty() |
|
66 | + { |
|
67 | + $expected = ''; |
|
68 | + $actual = $this->fixture->get(uniqid('foo')); |
|
69 | + $this->assertEquals($expected, $actual); |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * @test |
|
74 | - */ |
|
75 | - public function configurationArrayNotEmptyAfterGetARandomValue() |
|
76 | - { |
|
77 | - $this->fixture->get(uniqid('foo')); |
|
72 | + /** |
|
73 | + * @test |
|
74 | + */ |
|
75 | + public function configurationArrayNotEmptyAfterGetARandomValue() |
|
76 | + { |
|
77 | + $this->fixture->get(uniqid('foo')); |
|
78 | 78 | |
79 | - $actual = $this->fixture->getConfiguration(); |
|
80 | - $this->assertTrue(count($actual) > 0); |
|
81 | - } |
|
79 | + $actual = $this->fixture->getConfiguration(); |
|
80 | + $this->assertTrue(count($actual) > 0); |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * @test |
|
85 | - */ |
|
86 | - public function setConfigurationValueAndCheckReturnedValueIsCorresponding() |
|
87 | - { |
|
88 | - $expected = 'bar'; |
|
89 | - $this->fixture->set('foo', $expected); |
|
90 | - $this->assertSame($expected, $this->fixture->get('foo')); |
|
91 | - } |
|
83 | + /** |
|
84 | + * @test |
|
85 | + */ |
|
86 | + public function setConfigurationValueAndCheckReturnedValueIsCorresponding() |
|
87 | + { |
|
88 | + $expected = 'bar'; |
|
89 | + $this->fixture->set('foo', $expected); |
|
90 | + $this->assertSame($expected, $this->fixture->get('foo')); |
|
91 | + } |
|
92 | 92 | } |
@@ -25,124 +25,124 @@ |
||
25 | 25 | */ |
26 | 26 | class ImagePresetUtilityTest extends AbstractFunctionalTestCase |
27 | 27 | { |
28 | - /** |
|
29 | - * @var ImagePresetUtility |
|
30 | - */ |
|
31 | - private $fixture; |
|
32 | - |
|
33 | - public function setUp() |
|
34 | - { |
|
35 | - parent::setUp(); |
|
36 | - $this->fixture = new ImagePresetUtility(); |
|
37 | - } |
|
38 | - |
|
39 | - public function tearDown() |
|
40 | - { |
|
41 | - GeneralUtility::purgeInstances(); |
|
42 | - unset($this->fixture); |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * @test |
|
47 | - * @expectedException \Fab\Media\Exception\EmptyValueException |
|
48 | - */ |
|
49 | - public function randomPresetShouldReturnException() |
|
50 | - { |
|
51 | - $this->fixture->preset(uniqid()); |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * @test |
|
56 | - */ |
|
57 | - public function methodPresetReturnInstanceOfImagePresetUtility() |
|
58 | - { |
|
59 | - $actual = 'image_thumbnail'; |
|
60 | - $object = $this->fixture->preset($actual); |
|
61 | - $this->assertTrue($object instanceof ImagePresetUtility); |
|
62 | - } |
|
63 | - |
|
64 | - /** |
|
65 | - * @test |
|
66 | - */ |
|
67 | - public function propertyIsEmptyByDefault() |
|
68 | - { |
|
69 | - $this->assertEmpty($this->fixture->getStore()); |
|
70 | - } |
|
71 | - |
|
72 | - /** |
|
73 | - * @test |
|
74 | - */ |
|
75 | - public function setImageThumbnailAsPresetAndCheckTheStoreContainsIt() |
|
76 | - { |
|
77 | - $actual = 'image_thumbnail'; |
|
78 | - $this->fixture->preset($actual); |
|
79 | - $this->assertArrayHasKey($actual, $this->fixture->getStore()); |
|
80 | - } |
|
81 | - |
|
82 | - |
|
83 | - /** |
|
84 | - * @test |
|
85 | - * @dataProvider presetProvider |
|
86 | - */ |
|
87 | - public function testProperty($preset, $setting, $width, $height) |
|
88 | - { |
|
89 | - ConfigurationUtility::getInstance()->set($preset, $setting); |
|
90 | - $this->assertSame($width, $this->fixture->preset($preset)->getWidth()); |
|
91 | - $this->assertSame($height, $this->fixture->preset($preset)->getHeight()); |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * Provider |
|
96 | - */ |
|
97 | - public function presetProvider() |
|
98 | - { |
|
99 | - return array( |
|
100 | - array('image_thumbnail', '110x100', 110, 100), |
|
101 | - array('image_mini', '130x120', 130, 120), |
|
102 | - array('image_small', '340x320', 340, 320), |
|
103 | - array('image_medium', '780x760', 780, 760), |
|
104 | - array('image_large', '1210x1200', 1210, 1200), |
|
105 | - ); |
|
106 | - } |
|
107 | - |
|
108 | - /** |
|
109 | - * @test |
|
110 | - * @expectedException \Fab\Media\Exception\InvalidKeyInArrayException |
|
111 | - */ |
|
112 | - public function getWidthWithoutPresetRaisesAnException() |
|
113 | - { |
|
114 | - $this->fixture->getWidth(); |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * @test |
|
119 | - * @expectedException \Fab\Media\Exception\InvalidKeyInArrayException |
|
120 | - */ |
|
121 | - public function getHeightWithoutPresetRaisesAnException() |
|
122 | - { |
|
123 | - $this->fixture->getHeight(); |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * @test |
|
128 | - */ |
|
129 | - public function setOriginalImageAsPresetWithValue0AndCheckWidthEquals0() |
|
130 | - { |
|
131 | - $actual = 'image_large'; |
|
132 | - ConfigurationUtility::getInstance()->set('image_large', 0); |
|
133 | - $this->assertSame(0, $this->fixture->preset($actual)->getWidth()); |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * @test |
|
138 | - */ |
|
139 | - public function setOriginalImageAsPresetWithRandomValueAndCheckWidthAndHeightCorrespondsToThisRandomValue() |
|
140 | - { |
|
141 | - $preset = 'image_large'; |
|
142 | - $actualWidth = rand(10, 100); |
|
143 | - $actualHeight = rand(10, 100); |
|
144 | - ConfigurationUtility::getInstance()->set('image_large', $actualWidth . 'x' . $actualHeight); |
|
145 | - $this->assertSame($actualWidth, $this->fixture->preset($preset)->getWidth()); |
|
146 | - $this->assertSame($actualHeight, $this->fixture->preset($preset)->getHeight()); |
|
147 | - } |
|
28 | + /** |
|
29 | + * @var ImagePresetUtility |
|
30 | + */ |
|
31 | + private $fixture; |
|
32 | + |
|
33 | + public function setUp() |
|
34 | + { |
|
35 | + parent::setUp(); |
|
36 | + $this->fixture = new ImagePresetUtility(); |
|
37 | + } |
|
38 | + |
|
39 | + public function tearDown() |
|
40 | + { |
|
41 | + GeneralUtility::purgeInstances(); |
|
42 | + unset($this->fixture); |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * @test |
|
47 | + * @expectedException \Fab\Media\Exception\EmptyValueException |
|
48 | + */ |
|
49 | + public function randomPresetShouldReturnException() |
|
50 | + { |
|
51 | + $this->fixture->preset(uniqid()); |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * @test |
|
56 | + */ |
|
57 | + public function methodPresetReturnInstanceOfImagePresetUtility() |
|
58 | + { |
|
59 | + $actual = 'image_thumbnail'; |
|
60 | + $object = $this->fixture->preset($actual); |
|
61 | + $this->assertTrue($object instanceof ImagePresetUtility); |
|
62 | + } |
|
63 | + |
|
64 | + /** |
|
65 | + * @test |
|
66 | + */ |
|
67 | + public function propertyIsEmptyByDefault() |
|
68 | + { |
|
69 | + $this->assertEmpty($this->fixture->getStore()); |
|
70 | + } |
|
71 | + |
|
72 | + /** |
|
73 | + * @test |
|
74 | + */ |
|
75 | + public function setImageThumbnailAsPresetAndCheckTheStoreContainsIt() |
|
76 | + { |
|
77 | + $actual = 'image_thumbnail'; |
|
78 | + $this->fixture->preset($actual); |
|
79 | + $this->assertArrayHasKey($actual, $this->fixture->getStore()); |
|
80 | + } |
|
81 | + |
|
82 | + |
|
83 | + /** |
|
84 | + * @test |
|
85 | + * @dataProvider presetProvider |
|
86 | + */ |
|
87 | + public function testProperty($preset, $setting, $width, $height) |
|
88 | + { |
|
89 | + ConfigurationUtility::getInstance()->set($preset, $setting); |
|
90 | + $this->assertSame($width, $this->fixture->preset($preset)->getWidth()); |
|
91 | + $this->assertSame($height, $this->fixture->preset($preset)->getHeight()); |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * Provider |
|
96 | + */ |
|
97 | + public function presetProvider() |
|
98 | + { |
|
99 | + return array( |
|
100 | + array('image_thumbnail', '110x100', 110, 100), |
|
101 | + array('image_mini', '130x120', 130, 120), |
|
102 | + array('image_small', '340x320', 340, 320), |
|
103 | + array('image_medium', '780x760', 780, 760), |
|
104 | + array('image_large', '1210x1200', 1210, 1200), |
|
105 | + ); |
|
106 | + } |
|
107 | + |
|
108 | + /** |
|
109 | + * @test |
|
110 | + * @expectedException \Fab\Media\Exception\InvalidKeyInArrayException |
|
111 | + */ |
|
112 | + public function getWidthWithoutPresetRaisesAnException() |
|
113 | + { |
|
114 | + $this->fixture->getWidth(); |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * @test |
|
119 | + * @expectedException \Fab\Media\Exception\InvalidKeyInArrayException |
|
120 | + */ |
|
121 | + public function getHeightWithoutPresetRaisesAnException() |
|
122 | + { |
|
123 | + $this->fixture->getHeight(); |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * @test |
|
128 | + */ |
|
129 | + public function setOriginalImageAsPresetWithValue0AndCheckWidthEquals0() |
|
130 | + { |
|
131 | + $actual = 'image_large'; |
|
132 | + ConfigurationUtility::getInstance()->set('image_large', 0); |
|
133 | + $this->assertSame(0, $this->fixture->preset($actual)->getWidth()); |
|
134 | + } |
|
135 | + |
|
136 | + /** |
|
137 | + * @test |
|
138 | + */ |
|
139 | + public function setOriginalImageAsPresetWithRandomValueAndCheckWidthAndHeightCorrespondsToThisRandomValue() |
|
140 | + { |
|
141 | + $preset = 'image_large'; |
|
142 | + $actualWidth = rand(10, 100); |
|
143 | + $actualHeight = rand(10, 100); |
|
144 | + ConfigurationUtility::getInstance()->set('image_large', $actualWidth . 'x' . $actualHeight); |
|
145 | + $this->assertSame($actualWidth, $this->fixture->preset($preset)->getWidth()); |
|
146 | + $this->assertSame($actualHeight, $this->fixture->preset($preset)->getHeight()); |
|
147 | + } |
|
148 | 148 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | use TYPO3\CMS\Core\Utility\GeneralUtility; |
18 | 18 | use Fab\Media\Tests\Functional\AbstractFunctionalTestCase; |
19 | 19 | |
20 | -require_once dirname(dirname(__FILE__)) . '/AbstractFunctionalTestCase.php'; |
|
20 | +require_once dirname(dirname(__FILE__)).'/AbstractFunctionalTestCase.php'; |
|
21 | 21 | |
22 | 22 | |
23 | 23 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $preset = 'image_large'; |
142 | 142 | $actualWidth = rand(10, 100); |
143 | 143 | $actualHeight = rand(10, 100); |
144 | - ConfigurationUtility::getInstance()->set('image_large', $actualWidth . 'x' . $actualHeight); |
|
144 | + ConfigurationUtility::getInstance()->set('image_large', $actualWidth.'x'.$actualHeight); |
|
145 | 145 | $this->assertSame($actualWidth, $this->fixture->preset($preset)->getWidth()); |
146 | 146 | $this->assertSame($actualHeight, $this->fixture->preset($preset)->getHeight()); |
147 | 147 | } |
@@ -9,12 +9,12 @@ |
||
9 | 9 | */ |
10 | 10 | abstract class AbstractFunctionalTestCase extends FunctionalTestCase |
11 | 11 | { |
12 | - protected $testExtensionsToLoad = array('typo3conf/ext/vidi', 'typo3conf/ext/media'); |
|
12 | + protected $testExtensionsToLoad = array('typo3conf/ext/vidi', 'typo3conf/ext/media'); |
|
13 | 13 | |
14 | - protected $coreExtensionsToLoad = array('extbase', 'fluid', 'scheduler'); |
|
14 | + protected $coreExtensionsToLoad = array('extbase', 'fluid', 'scheduler'); |
|
15 | 15 | |
16 | - public function setUp(): void |
|
17 | - { |
|
18 | - parent::setUp(); |
|
19 | - } |
|
16 | + public function setUp(): void |
|
17 | + { |
|
18 | + parent::setUp(); |
|
19 | + } |
|
20 | 20 | } |