13
13
14
14
class RulesTest extends \PHPUnit_Framework_TestCase
15
15
{
16
- public function testBaseFileRules ()
16
+ public function testRules ()
17
+ {
18
+ $ model = new News ();
19
+
20
+ $ rules = $ model ->getFileRules ('image_path ' );
21
+ $ this ->assertArrayHasKey ('imageSize ' , $ rules );
22
+ $ this ->assertArrayHasKey ('mimeTypes ' , $ rules );
23
+ $ this ->assertArrayHasKey ('extensions ' , $ rules );
24
+ $ this ->assertArrayHasKey ('maxSize ' , $ rules );
25
+ $ this ->assertArrayHasKey ('tooBig ' , $ rules );
26
+ }
27
+
28
+ public function testRulesWithOnlyCoreValidators ()
29
+ {
30
+ $ model = new News ();
31
+
32
+ $ rules = $ model ->getFileRules ('image_path ' , true );
33
+ $ this ->assertArrayNotHasKey ('imageSize ' , $ rules );
34
+ $ this ->assertArrayHasKey ('mimeTypes ' , $ rules );
35
+ $ this ->assertArrayHasKey ('extensions ' , $ rules );
36
+ $ this ->assertArrayHasKey ('maxSize ' , $ rules );
37
+ $ this ->assertArrayHasKey ('tooBig ' , $ rules );
38
+ }
39
+
40
+ public function testDescription ()
17
41
{
18
42
$ model = new News ();
19
43
@@ -23,15 +47,15 @@ public function testBaseFileRules()
23
47
$ this ->assertContains ('File types: JPG, JPEG, PNG ' , $ rules );
24
48
}
25
49
26
- public function testImageWithStrictSize ()
50
+ public function testDescriptionImageWithStrictSize ()
27
51
{
28
52
$ model = new News ();
29
53
30
54
$ rules = $ model ->getFileRulesDescription ('image_strict_size ' );
31
55
$ this ->assertContains ('Image size: 300x300px ' , $ rules );
32
56
}
33
57
34
- public function testImageWithMinAndMaxSize ()
58
+ public function testDescriptionImageWithMinAndMaxSize ()
35
59
{
36
60
$ model = new News ();
37
61
@@ -40,47 +64,47 @@ public function testImageWithMinAndMaxSize()
40
64
$ this ->assertContains ('Max. size of image: 300x300px ' , $ rules );
41
65
}
42
66
43
- public function testImageWithMinSize ()
67
+ public function testDescriptionImageWithMinSize ()
44
68
{
45
69
$ model = new News ();
46
70
47
71
$ rules = $ model ->getFileRulesDescription ('image_min_size ' );
48
72
$ this ->assertContains ('Min. size of image: 300x300px ' , $ rules );
49
73
}
50
74
51
- public function testImageWithMaxSize ()
75
+ public function testDescriptionImageWithMaxSize ()
52
76
{
53
77
$ model = new News ();
54
78
55
79
$ rules = $ model ->getFileRulesDescription ('image_max_size ' );
56
80
$ this ->assertContains ('Max. size of image: 300x300px ' , $ rules );
57
81
}
58
82
59
- public function testImageWithOnlyMaxWidth ()
83
+ public function testDescriptionImageWithOnlyMaxWidth ()
60
84
{
61
85
$ model = new News ();
62
86
63
87
$ rules = $ model ->getFileRulesDescription ('image_only_maxwidth ' );
64
88
$ this ->assertContains ('Max. width 300px ' , $ rules );
65
89
}
66
90
67
- public function testImageWithOnlyMaxHeight ()
91
+ public function testDescriptionImageWithOnlyMaxHeight ()
68
92
{
69
93
$ model = new News ();
70
94
71
95
$ rules = $ model ->getFileRulesDescription ('image_only_maxheight ' );
72
96
$ this ->assertContains ('Max. height 300px ' , $ rules );
73
97
}
74
98
75
- public function testImageWithOnlyMinWidth ()
99
+ public function testDescriptionImageWithOnlyMinWidth ()
76
100
{
77
101
$ model = new News ();
78
102
79
103
$ rules = $ model ->getFileRulesDescription ('image_only_minwidth ' );
80
104
$ this ->assertContains ('Min. width 300px ' , $ rules );
81
105
}
82
106
83
- public function testImageWithOnlyMinHeight ()
107
+ public function testDescriptionImageWithOnlyMinHeight ()
84
108
{
85
109
$ model = new News ();
86
110
0 commit comments