<?php
/**
* Test functionality of path class
* @author cpks
* @license Public Domain
* @version 1.0
*/
//ini_set('include_path', '..:' . ini_get('include_path'));
require 'path.php';
class pathTest extends PHPUnit_Framework_TestCase {
public function testChanges() {
// Create a path from a string
$fn = new file\path('/var/www/html/phpinfo.php.bak');
$fn->dir = NULL;
$this->assertEquals((string)$fn, 'phpinfo.php.bak');
$fn->ext = NULL;
$this->assertEquals((string)$fn, 'phpinfo.php');
$fn->ext = 'bak';
$this->assertEquals((string)$fn, 'phpinfo.bak');
$fn->dir = 'usr/lib';
$this->assertEquals((string)$fn, 'usr/lib/phpinfo.bak');
$fn->filename = 'foo';
$this->assertEquals((string)$fn, 'usr/lib/foo.bak');
$fn->basename = 'phpifo.php';
$this->assertEquals((string)$fn, 'usr/lib/phpifo.php');
$this->assertEquals($fn->ext, 'php');
$this->assertEquals($fn->dir, 'usr/lib');
$fn->ext = 'txt';
$this->assertEquals($fn->basename, 'phpifo.txt');
}
}
|