Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #939 from resurtm/fix-938
Fix #938, solution №2.
- Loading branch information
Showing
3 changed files
with
54 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
class CFileValidatorTest extends CTestCase | ||
{ | ||
public function providerSizeToBytes() | ||
{ | ||
return array( | ||
array('100M', 100*1024*1024), | ||
array('100,5M', 100*1024*1024), | ||
array('150m', 150*1024*1024), | ||
array('150.5m', 150*1024*1024), | ||
array('500K', 500*1024), | ||
array('540.5K', 540*1024), | ||
array('70k', 70*1024), | ||
array('70,2k', 70*1024), | ||
array('1G', 1*1024*1024*1024), | ||
array('1.5g', 1*1024*1024*1024), | ||
array('2g', 2*1024*1024*1024), | ||
array('1.2G', 1*1024*1024*1024), | ||
array('100500', 100500), | ||
array('9000', 9000), | ||
array(null, null), | ||
array('', null), | ||
); | ||
} | ||
|
||
/** | ||
* @dataProvider providerSizeToBytes | ||
* | ||
* @param string $sizeString | ||
* @param integer $assertion | ||
*/ | ||
public function testSizeToBytes($sizeString, $assertion) | ||
{ | ||
$fileValidator=new CFileValidator(); | ||
$this->assertEquals($assertion, $fileValidator->sizeToBytes($sizeString)); | ||
} | ||
} |