Adding ProcessMaker\Util\Common class utility and unit test

This commit is contained in:
Erik Amaru Ortiz
2014-03-05 20:12:21 -04:00
parent 234f112323
commit f455310070
9 changed files with 136 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<?php
namespace Tests\ProcessMaker\Util;
use ProcessMaker\Util;
/**
* Class XmlExporterTest
*
* @package Tests\ProcessMaker\Project
* @author Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
*/
class XmlExporterTest extends \PHPUnit_Framework_TestCase
{
function testGetLastVersion()
{
$lastVer = Util\Common::getLastVersion(__DIR__."/../../fixtures/files_struct/first/sample-*.txt");
$this->assertEquals(3, $lastVer);
}
function testGetLastVersionSec()
{
$lastVer = Util\Common::getLastVersion(__DIR__."/../../fixtures/files_struct/second/sample-*.txt");
$this->assertEquals(5, $lastVer);
}
/**
* Negative test, no matched files found
*/
function testGetLastVersionThr()
{
$lastVer = Util\Common::getLastVersion(sys_get_temp_dir()."/sample-*.txt");
$this->assertEquals(0, $lastVer);
}
}