1 | <?php |
||
4 | class uploadTest extends TestCase |
||
5 | { |
||
6 | public $bulletproof, |
||
7 | $testingImage, |
||
8 | $_files = []; |
||
9 | |||
10 | /** |
||
11 | * Initialize an array to mimic the properties $_FILES global |
||
12 | */ |
||
13 | public function __construct() |
||
28 | |||
29 | |||
30 | /** |
||
31 | * test array access offset name is created from $_FILES |
||
32 | */ |
||
33 | public function testArrayAccessReadsFileNameFromArray() |
||
37 | |||
38 | /** |
||
39 | * test custom image renaming |
||
40 | */ |
||
41 | public function testImageRenameReturnsNewName() |
||
46 | |||
47 | /** |
||
48 | * test storage creation |
||
49 | */ |
||
50 | public function testImageLocationReturnsAssignedValue() |
||
55 | |||
56 | /** |
||
57 | * test upload fails if image is less than the size set |
||
58 | */ |
||
59 | public function testUploadFailsIfImageSizeIsSmallerThanDefined() |
||
69 | |||
70 | /** |
||
71 | * test image is uploaded based on the mime types set |
||
72 | */ |
||
73 | public function testImageUploadAcceptsOnlyAllowedMimeTypes() |
||
82 | |||
83 | /** |
||
84 | * test image upload does not pass the defined height limit |
||
85 | */ |
||
86 | public function testImageDimensionDefinesImageHeightAndWidthLimit() |
||
97 | |||
98 | /** |
||
99 | * test image name has auto-generated value if name is not provided |
||
100 | */ |
||
101 | public function testReturnValueOfImageNameAfterImageUpload() |
||
107 | |||
108 | /** |
||
109 | * test image size return |
||
110 | */ |
||
111 | public function testReturnValueOfImageSizeAfterImageUpload() |
||
117 | |||
118 | /** |
||
119 | * test image mime return |
||
120 | */ |
||
121 | public function testReturnValueOfImageMimeAfterImageUpload() |
||
127 | |||
128 | /** |
||
129 | * test image width return |
||
130 | */ |
||
131 | public function testReturnValueOfImageWidthAfterImageUpload() |
||
137 | |||
138 | /** |
||
139 | * test image height return |
||
140 | */ |
||
141 | public function testReturnValueOfImageHeightAfterImageUpload() |
||
147 | |||
148 | /** |
||
149 | * test image location return |
||
150 | */ |
||
151 | public function testReturnValueOfImageLocationAfterImageUpload() |
||
158 | |||
159 | /** |
||
160 | * test image full path return |
||
161 | */ |
||
162 | public function testReturnValueOfImageFullPathAfterImageUpload() |
||
171 | |||
172 | /** |
||
173 | * test image json value return |
||
174 | */ |
||
175 | public function testReturnValueOfImageJsonInfoAfterImageUpload() |
||
183 | |||
184 | |||
185 | } |
||
186 | |||
187 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.