Commit ef88ceba authored by Thomas Mueller's avatar Thomas Mueller
Browse files

drop SimpleTest compatibility

parent 1dac2ba4
......@@ -609,42 +609,42 @@ class Test_Crypt extends \PHPUnit_Framework_TestCase {
// $decrypted=OC_Encryption\Crypt::decrypt($encrypted,$key);
// $decrypted=rtrim($decrypted, "\0");
// $this->assertNotEquals($encrypted,$source);
// $this->assertEqual($decrypted,$source);
// $this->assertEquals($decrypted,$source);
//
// $chunk=substr($source,0,8192);
// $encrypted=OC_Encryption\Crypt::encrypt($chunk,$key);
// $this->assertEqual(strlen($chunk),strlen($encrypted));
// $this->assertEquals(strlen($chunk),strlen($encrypted));
// $decrypted=OC_Encryption\Crypt::decrypt($encrypted,$key);
// $decrypted=rtrim($decrypted, "\0");
// $this->assertEqual($decrypted,$chunk);
// $this->assertEquals($decrypted,$chunk);
//
// $encrypted=OC_Encryption\Crypt::blockEncrypt($source,$key);
// $decrypted=OC_Encryption\Crypt::blockDecrypt($encrypted,$key);
// $this->assertNotEquals($encrypted,$source);
// $this->assertEqual($decrypted,$source);
// $this->assertEquals($decrypted,$source);
//
// $tmpFileEncrypted=OCP\Files::tmpFile();
// OC_Encryption\Crypt::encryptfile($file,$tmpFileEncrypted,$key);
// $encrypted=file_get_contents($tmpFileEncrypted);
// $decrypted=OC_Encryption\Crypt::blockDecrypt($encrypted,$key);
// $this->assertNotEquals($encrypted,$source);
// $this->assertEqual($decrypted,$source);
// $this->assertEquals($decrypted,$source);
//
// $tmpFileDecrypted=OCP\Files::tmpFile();
// OC_Encryption\Crypt::decryptfile($tmpFileEncrypted,$tmpFileDecrypted,$key);
// $decrypted=file_get_contents($tmpFileDecrypted);
// $this->assertEqual($decrypted,$source);
// $this->assertEquals($decrypted,$source);
//
// $file=OC::$SERVERROOT.'/core/img/weather-clear.png';
// $source=file_get_contents($file); //binary file
// $encrypted=OC_Encryption\Crypt::encrypt($source,$key);
// $decrypted=OC_Encryption\Crypt::decrypt($encrypted,$key);
// $decrypted=rtrim($decrypted, "\0");
// $this->assertEqual($decrypted,$source);
// $this->assertEquals($decrypted,$source);
//
// $encrypted=OC_Encryption\Crypt::blockEncrypt($source,$key);
// $decrypted=OC_Encryption\Crypt::blockDecrypt($encrypted,$key);
// $this->assertEqual($decrypted,$source);
// $this->assertEquals($decrypted,$source);
//
// }
//
......@@ -657,11 +657,11 @@ class Test_Crypt extends \PHPUnit_Framework_TestCase {
// $decrypted=OC_Encryption\Crypt::decrypt($encrypted,$key);
//
// $decrypted=rtrim($decrypted, "\0");
// $this->assertEqual($decrypted,$source);
// $this->assertEquals($decrypted,$source);
//
// $encrypted=OC_Encryption\Crypt::blockEncrypt($source,$key);
// $decrypted=OC_Encryption\Crypt::blockDecrypt($encrypted,$key,strlen($source));
// $this->assertEqual($decrypted,$source);
// $this->assertEquals($decrypted,$source);
// }
}
......@@ -109,7 +109,7 @@
//
// }
// class Test_CryptProxy extends UnitTestCase {
// class Test_CryptProxy extends PHPUnit_Framework_TestCase {
// private $oldConfig;
// private $oldKey;
//
......@@ -161,9 +161,9 @@
// OC_FileProxy::$enabled=true;
//
// $fromFile=OC_Filesystem::file_get_contents('/file');
// $this->assertNotEqual($original,$stored);
// $this->assertEqual(strlen($original),strlen($fromFile));
// $this->assertEqual($original,$fromFile);
// $this->assertNotEquals($original,$stored);
// $this->assertEquals(strlen($original),strlen($fromFile));
// $this->assertEquals($original,$fromFile);
//
// }
//
......@@ -181,12 +181,12 @@
// $stored=$rootView->file_get_contents($userDir.'/file');
// OC_FileProxy::$enabled=true;
//
// $this->assertNotEqual($original,$stored);
// $this->assertNotEquals($original,$stored);
// $fromFile=$rootView->file_get_contents($userDir.'/file');
// $this->assertEqual($original,$fromFile);
// $this->assertEquals($original,$fromFile);
//
// $fromFile=$view->file_get_contents('files/file');
// $this->assertEqual($original,$fromFile);
// $this->assertEquals($original,$fromFile);
// }
//
// public function testBinary(){
......@@ -200,9 +200,9 @@
// OC_FileProxy::$enabled=true;
//
// $fromFile=OC_Filesystem::file_get_contents('/file');
// $this->assertNotEqual($original,$stored);
// $this->assertEqual(strlen($original),strlen($fromFile));
// $this->assertEqual($original,$fromFile);
// $this->assertNotEquals($original,$stored);
// $this->assertEquals(strlen($original),strlen($fromFile));
// $this->assertEquals($original,$fromFile);
//
// $file=__DIR__.'/zeros';
// $original=file_get_contents($file);
......@@ -214,7 +214,7 @@
// OC_FileProxy::$enabled=true;
//
// $fromFile=OC_Filesystem::file_get_contents('/file');
// $this->assertNotEqual($original,$stored);
// $this->assertEqual(strlen($original),strlen($fromFile));
// $this->assertNotEquals($original,$stored);
// $this->assertEquals(strlen($original),strlen($fromFile));
// }
// }
......@@ -117,7 +117,7 @@
// //
// // fclose( $stream );
// //
// // $this->assertEqual( 'foobar', $data );
// // $this->assertEquals( 'foobar', $data );
// //
// //
// // $file = OC::$SERVERROOT.'/3rdparty/MDB2.php';
......@@ -139,15 +139,15 @@
// //
// // $original = file_get_contents( $file );
// //
// // $this->assertEqual( strlen( $original ), strlen( $data ) );
// // $this->assertEquals( strlen( $original ), strlen( $data ) );
// //
// // $this->assertEqual( $original, $data );
// // $this->assertEquals( $original, $data );
// //
// // }
//
// }
//
// // class Test_CryptStream extends UnitTestCase {
// // class Test_CryptStream extends PHPUnit_Framework_TestCase {
// // private $tmpFiles=array();
// //
// // function testStream(){
......@@ -158,7 +158,7 @@
// // $stream=$this->getStream('test1','r',strlen('foobar'));
// // $data=fread($stream,6);
// // fclose($stream);
// // $this->assertEqual('foobar',$data);
// // $this->assertEquals('foobar',$data);
// //
// // $file=OC::$SERVERROOT.'/3rdparty/MDB2.php';
// // $source=fopen($file,'r');
......@@ -170,8 +170,8 @@
// // $stream=$this->getStream('test2','r',filesize($file));
// // $data=stream_get_contents($stream);
// // $original=file_get_contents($file);
// // $this->assertEqual(strlen($original),strlen($data));
// // $this->assertEqual($original,$data);
// // $this->assertEquals(strlen($original),strlen($data));
// // $this->assertEquals($original,$data);
// // }
// //
// // /**
......@@ -207,8 +207,8 @@
// // $stream=$this->getStream('test','r',strlen($source));
// // $data=stream_get_contents($stream);
// // fclose($stream);
// // $this->assertEqual(strlen($data),strlen($source));
// // $this->assertEqual($source,$data);
// // $this->assertEquals(strlen($data),strlen($source));
// // $this->assertEquals($source,$data);
// //
// // $file=__DIR__.'/zeros';
// // $source=file_get_contents($file);
......@@ -220,7 +220,7 @@
// // $stream=$this->getStream('test2','r',strlen($source));
// // $data=stream_get_contents($stream);
// // fclose($stream);
// // $this->assertEqual(strlen($data),strlen($source));
// // $this->assertEqual($source,$data);
// // $this->assertEquals(strlen($data),strlen($source));
// // $this->assertEquals($source,$data);
// // }
// // }
......@@ -203,7 +203,7 @@ class Test_Enc_Util extends \PHPUnit_Framework_TestCase {
//
// $decrypted = $c->legacyDecrypt( $encrypted, $c->legacyKey );
//
// $this->assertEqual( $decrypted, $this->data );
// $this->assertEquals( $decrypted, $this->data );
//
// }
......
......@@ -32,18 +32,18 @@ class Test_Filestorage_FTP extends Test_FileStorage {
'root' => '/',
'secure' => false );
$instance = new OC_Filestorage_FTP($config);
$this->assertEqual('ftp://ftp:ftp@localhost/', $instance->constructUrl(''));
$this->assertEquals('ftp://ftp:ftp@localhost/', $instance->constructUrl(''));
$config['secure'] = true;
$instance = new OC_Filestorage_FTP($config);
$this->assertEqual('ftps://ftp:ftp@localhost/', $instance->constructUrl(''));
$this->assertEquals('ftps://ftp:ftp@localhost/', $instance->constructUrl(''));
$config['secure'] = 'false';
$instance = new OC_Filestorage_FTP($config);
$this->assertEqual('ftp://ftp:ftp@localhost/', $instance->constructUrl(''));
$this->assertEquals('ftp://ftp:ftp@localhost/', $instance->constructUrl(''));
$config['secure'] = 'true';
$instance = new OC_Filestorage_FTP($config);
$this->assertEqual('ftps://ftp:ftp@localhost/', $instance->constructUrl(''));
$this->assertEquals('ftps://ftp:ftp@localhost/', $instance->constructUrl(''));
}
}
......@@ -20,7 +20,7 @@
*
*/
class Test_Group_Ldap extends UnitTestCase {
class Test_Group_Ldap extends PHPUnit_Framework_TestCase {
function setUp() {
OC_Group::clearBackends();
}
......
......@@ -8,24 +8,5 @@ if(!class_exists('PHPUnit_Framework_TestCase')) {
require_once('PHPUnit/Autoload.php');
}
//SimpleTest compatibility
abstract class UnitTestCase extends PHPUnit_Framework_TestCase{
function assertEqual($expected, $actual, $string='') {
$this->assertEquals($expected, $actual, $string);
}
function assertNotEqual($expected, $actual, $string='') {
$this->assertNotEquals($expected, $actual, $string);
}
static function assertTrue($actual, $string='') {
parent::assertTrue((bool)$actual, $string);
}
static function assertFalse($actual, $string='') {
parent::assertFalse((bool)$actual, $string);
}
}
OC_Hook::clear();
OC_Log::$enabled = false;
......@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
abstract class Test_Archive extends UnitTestCase {
abstract class Test_Archive extends PHPUnit_Framework_TestCase {
/**
* @var OC_Archive
*/
......@@ -27,7 +27,7 @@ abstract class Test_Archive extends UnitTestCase {
$this->instance=$this->getExisting();
$allFiles=$this->instance->getFiles();
$expected=array('lorem.txt','logo-wide.png','dir/', 'dir/lorem.txt');
$this->assertEqual(4, count($allFiles), 'only found '.count($allFiles).' out of 4 expected files');
$this->assertEquals(4, count($allFiles), 'only found '.count($allFiles).' out of 4 expected files');
foreach($expected as $file) {
$this->assertContains($file, $allFiles, 'cant find '. $file . ' in archive');
$this->assertTrue($this->instance->fileExists($file), 'file '.$file.' does not exist in archive');
......@@ -36,14 +36,14 @@ abstract class Test_Archive extends UnitTestCase {
$rootContent=$this->instance->getFolder('');
$expected=array('lorem.txt','logo-wide.png', 'dir/');
$this->assertEqual(3, count($rootContent));
$this->assertEquals(3, count($rootContent));
foreach($expected as $file) {
$this->assertContains($file, $rootContent, 'cant find '. $file . ' in archive');
}
$dirContent=$this->instance->getFolder('dir/');
$expected=array('lorem.txt');
$this->assertEqual(1, count($dirContent));
$this->assertEquals(1, count($dirContent));
foreach($expected as $file) {
$this->assertContains($file, $dirContent, 'cant find '. $file . ' in archive');
}
......@@ -53,36 +53,36 @@ abstract class Test_Archive extends UnitTestCase {
$this->instance=$this->getExisting();
$dir=OC::$SERVERROOT.'/tests/data';
$textFile=$dir.'/lorem.txt';
$this->assertEqual(file_get_contents($textFile), $this->instance->getFile('lorem.txt'));
$this->assertEquals(file_get_contents($textFile), $this->instance->getFile('lorem.txt'));
$tmpFile=OCP\Files::tmpFile('.txt');
$this->instance->extractFile('lorem.txt', $tmpFile);
$this->assertEqual(file_get_contents($textFile), file_get_contents($tmpFile));
$this->assertEquals(file_get_contents($textFile), file_get_contents($tmpFile));
}
public function testWrite() {
$dir=OC::$SERVERROOT.'/tests/data';
$textFile=$dir.'/lorem.txt';
$this->instance=$this->getNew();
$this->assertEqual(0, count($this->instance->getFiles()));
$this->assertEquals(0, count($this->instance->getFiles()));
$this->instance->addFile('lorem.txt', $textFile);
$this->assertEqual(1, count($this->instance->getFiles()));
$this->assertEquals(1, count($this->instance->getFiles()));
$this->assertTrue($this->instance->fileExists('lorem.txt'));
$this->assertFalse($this->instance->fileExists('lorem.txt/'));
$this->assertEqual(file_get_contents($textFile), $this->instance->getFile('lorem.txt'));
$this->assertEquals(file_get_contents($textFile), $this->instance->getFile('lorem.txt'));
$this->instance->addFile('lorem.txt', 'foobar');
$this->assertEqual('foobar', $this->instance->getFile('lorem.txt'));
$this->assertEquals('foobar', $this->instance->getFile('lorem.txt'));
}
public function testReadStream() {
$dir=OC::$SERVERROOT.'/tests/data';
$this->instance=$this->getExisting();
$fh=$this->instance->getStream('lorem.txt', 'r');
$this->assertTrue($fh);
$this->assertTrue((bool)$fh);
$content=fread($fh, $this->instance->filesize('lorem.txt'));
fclose($fh);
$this->assertEqual(file_get_contents($dir.'/lorem.txt'), $content);
$this->assertEquals(file_get_contents($dir.'/lorem.txt'), $content);
}
public function testWriteStream() {
$dir=OC::$SERVERROOT.'/tests/data';
......@@ -93,7 +93,7 @@ abstract class Test_Archive extends UnitTestCase {
fclose($source);
fclose($fh);
$this->assertTrue($this->instance->fileExists('lorem.txt'));
$this->assertEqual(file_get_contents($dir.'/lorem.txt'), $this->instance->getFile('lorem.txt'));
$this->assertEquals(file_get_contents($dir.'/lorem.txt'), $this->instance->getFile('lorem.txt'));
}
public function testFolder() {
$this->instance=$this->getNew();
......@@ -111,10 +111,10 @@ abstract class Test_Archive extends UnitTestCase {
$this->instance=$this->getExisting();
$tmpDir=OCP\Files::tmpFolder();
$this->instance->extract($tmpDir);
$this->assertEqual(true, file_exists($tmpDir.'lorem.txt'));
$this->assertEqual(true, file_exists($tmpDir.'dir/lorem.txt'));
$this->assertEqual(true, file_exists($tmpDir.'logo-wide.png'));
$this->assertEqual(file_get_contents($dir.'/lorem.txt'), file_get_contents($tmpDir.'lorem.txt'));
$this->assertEquals(true, file_exists($tmpDir.'lorem.txt'));
$this->assertEquals(true, file_exists($tmpDir.'dir/lorem.txt'));
$this->assertEquals(true, file_exists($tmpDir.'logo-wide.png'));
$this->assertEquals(file_get_contents($dir.'/lorem.txt'), file_get_contents($tmpDir.'lorem.txt'));
OCP\Files::rmdirr($tmpDir);
}
public function testMoveRemove() {
......@@ -126,7 +126,7 @@ abstract class Test_Archive extends UnitTestCase {
$this->instance->rename('lorem.txt', 'target.txt');
$this->assertTrue($this->instance->fileExists('target.txt'));
$this->assertFalse($this->instance->fileExists('lorem.txt'));
$this->assertEqual(file_get_contents($textFile), $this->instance->getFile('target.txt'));
$this->assertEquals(file_get_contents($textFile), $this->instance->getFile('target.txt'));
$this->instance->remove('target.txt');
$this->assertFalse($this->instance->fileExists('target.txt'));
}
......
......@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
abstract class Test_Cache extends UnitTestCase {
abstract class Test_Cache extends PHPUnit_Framework_TestCase {
/**
* @var OC_Cache cache;
*/
......@@ -26,19 +26,19 @@ abstract class Test_Cache extends UnitTestCase {
$this->instance->set('value1', $value);
$this->assertTrue($this->instance->hasKey('value1'));
$received=$this->instance->get('value1');
$this->assertEqual($value, $received, 'Value recieved from cache not equal to the original');
$this->assertEquals($value, $received, 'Value recieved from cache not equal to the original');
$value='ipsum lorum';
$this->instance->set('value1', $value);
$received=$this->instance->get('value1');
$this->assertEqual($value, $received, 'Value not overwritten by second set');
$this->assertEquals($value, $received, 'Value not overwritten by second set');
$value2='foobar';
$this->instance->set('value2', $value2);
$received2=$this->instance->get('value2');
$this->assertTrue($this->instance->hasKey('value1'));
$this->assertTrue($this->instance->hasKey('value2'));
$this->assertEqual($value, $received, 'Value changed while setting other variable');
$this->assertEqual($value2, $received2, 'Second value not equal to original');
$this->assertEquals($value, $received, 'Value changed while setting other variable');
$this->assertEquals($value2, $received2, 'Second value not equal to original');
$this->assertFalse($this->instance->hasKey('not_set'));
$this->assertNull($this->instance->get('not_set'), 'Unset value not equal to null');
......
......@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
class Test_DB extends UnitTestCase {
class Test_DB extends PHPUnit_Framework_TestCase {
protected $backupGlobals = FALSE;
protected static $schema_file = 'static://test_db_scheme';
......@@ -35,18 +35,18 @@ class Test_DB extends UnitTestCase {
public function testQuotes() {
$query = OC_DB::prepare('SELECT `fullname` FROM *PREFIX*'.$this->table2.' WHERE `uri` = ?');
$result = $query->execute(array('uri_1'));
$this->assertTrue($result);
$this->assertTrue((bool)$result);
$row = $result->fetchRow();
$this->assertFalse($row);
$query = OC_DB::prepare('INSERT INTO *PREFIX*'.$this->table2.' (`fullname`,`uri`) VALUES (?,?)');
$result = $query->execute(array('fullname test', 'uri_1'));
$this->assertTrue($result);
$this->assertTrue((bool)$result);
$query = OC_DB::prepare('SELECT `fullname`,`uri` FROM *PREFIX*'.$this->table2.' WHERE `uri` = ?');
$result = $query->execute(array('uri_1'));
$this->assertTrue($result);
$this->assertTrue((bool)$result);
$row = $result->fetchRow();
$this->assertArrayHasKey('fullname', $row);
$this->assertEqual($row['fullname'], 'fullname test');
$this->assertEquals($row['fullname'], 'fullname test');
$row = $result->fetchRow();
$this->assertFalse($row);
}
......@@ -54,19 +54,19 @@ class Test_DB extends UnitTestCase {
public function testNOW() {
$query = OC_DB::prepare('INSERT INTO *PREFIX*'.$this->table2.' (`fullname`,`uri`) VALUES (NOW(),?)');
$result = $query->execute(array('uri_2'));
$this->assertTrue($result);
$this->assertTrue((bool)$result);
$query = OC_DB::prepare('SELECT `fullname`,`uri` FROM *PREFIX*'.$this->table2.' WHERE `uri` = ?');
$result = $query->execute(array('uri_2'));
$this->assertTrue($result);
$this->assertTrue((bool)$result);
}
public function testUNIX_TIMESTAMP() {
$query = OC_DB::prepare('INSERT INTO *PREFIX*'.$this->table2.' (`fullname`,`uri`) VALUES (UNIX_TIMESTAMP(),?)');
$result = $query->execute(array('uri_3'));
$this->assertTrue($result);
$this->assertTrue((bool)$result);
$query = OC_DB::prepare('SELECT `fullname`,`uri` FROM *PREFIX*'.$this->table2.' WHERE `uri` = ?');
$result = $query->execute(array('uri_3'));
$this->assertTrue($result);
$this->assertTrue((bool)$result);
}
public function testinsertIfNotExist() {
......@@ -85,13 +85,13 @@ class Test_DB extends UnitTestCase {
'type' => $entry['type'],
'category' => $entry['category'],
));
$this->assertTrue($result);
$this->assertTrue((bool)$result);
}
$query = OC_DB::prepare('SELECT * FROM *PREFIX*'.$this->table3);
$result = $query->execute();
$this->assertTrue($result);
$this->assertEqual('4', $result->numRows());
$this->assertTrue((bool)$result);
$this->assertEquals('4', $result->numRows());
}
public function testinsertIfNotExistDontOverwrite() {
......@@ -102,14 +102,14 @@ class Test_DB extends UnitTestCase {
// Normal test to have same known data inserted.
$query = OC_DB::prepare('INSERT INTO *PREFIX*'.$this->table2.' (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)');
$result = $query->execute(array($fullname, $uri, $carddata));
$this->assertTrue($result);
$this->assertTrue((bool)$result);
$query = OC_DB::prepare('SELECT `fullname`, `uri`, `carddata` FROM *PREFIX*'.$this->table2.' WHERE `uri` = ?');
$result = $query->execute(array($uri));
$this->assertTrue($result);
$this->assertTrue((bool)$result);
$row = $result->fetchRow();
$this->assertArrayHasKey('carddata', $row);
$this->assertEqual($carddata, $row['carddata']);
$this->assertEqual('1', $result->numRows());
$this->assertEquals($carddata, $row['carddata']);
$this->assertEquals('1', $result->numRows());
// Try to insert a new row
$result = OC_DB::insertIfNotExist('*PREFIX*'.$this->table2,
......@@ -117,17 +117,17 @@ class Test_DB extends UnitTestCase {
'fullname' => $fullname,
'uri' => $uri,
));
$this->assertTrue($result);
$this->assertTrue((bool)$result);
$query = OC_DB::prepare('SELECT `fullname`, `uri`, `carddata` FROM *PREFIX*'.$this->table2.' WHERE `uri` = ?');
$result = $query->execute(array($uri));
$this->assertTrue($result);
$this->assertTrue((bool)$result);
$row = $result->fetchRow();
$this->assertArrayHasKey('carddata', $row);
// Test that previously inserted data isn't overwritten
$this->assertEqual($carddata, $row['carddata']);
$this->assertEquals($carddata, $row['carddata']);
// And that a new row hasn't been inserted.
$this->assertEqual('1', $result->numRows());
$this->assertEquals('1', $result->numRows());
}
}
......@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
class Test_DBSchema extends UnitTestCase {
class Test_DBSchema extends PHPUnit_Framework_TestCase {
protected static $schema_file = 'static://test_db_scheme';
protected static $schema_file2 = 'static://test_db_scheme2';
protected $test_prefix;
......
......@@ -20,7 +20,7 @@
*
*/
abstract class Test_FileStorage extends UnitTestCase {
abstract class Test_FileStorage extends PHPUnit_Framework_TestCase {
/**
* @var OC_Filestorage instance
*/
......@@ -34,7 +34,7 @@ abstract class Test_FileStorage extends UnitTestCase {
$this->assertTrue($this->instance->isReadable('/'), 'Root folder is not readable');
$this->assertTrue($this->instance->is_dir('/'), 'Root folder is not a directory');
$this->assertFalse($this->instance->is_file('/'), 'Root folder is a file');
$this->assertEqual('dir', $this->instance->filetype('/'));
$this->assertEquals('dir', $this->instance->filetype('/'));
//without this, any further testing would be useless, not an acutal requirement for filestorage though
$this->assertTrue($this->instance->isUpdatable('/'), 'Root folder is not writable');
......@@ -48,8 +48,8 @@ abstract class Test_FileStorage extends UnitTestCase {
$this->assertTrue($this->instance->file_exists('/folder'));
$this->assertTrue($this->instance->is_dir('/folder'));
$this->assertFalse($this->instance->is_file('/folder'));
$this->assertEqual('dir', $this->instance->filetype('/folder'));
$this->assertEqual(0, $this->instance->filesize('/folder'));
$this->assertEquals('dir', $this->instance->filetype('/folder'));
$this->assertEquals(0, $this->instance->filesize('/folder'));
$this->assertTrue($this->instance->isReadable('/folder'));
$this->assertTrue($this->instance->isUpdatable('/folder'));
......@@ -60,7 +60,7 @@ abstract class Test_FileStorage extends UnitTestCase {
$content[] = $file;
}
}
$this->assertEqual(array('folder'), $content);
$this->assertEquals(array('folder'), $content);
$this->assertFalse($this->instance->mkdir('/folder')); //cant create existing folders
$this->assertTrue($this->instance->rmdir('/folder'));
......@@ -76,7 +76,7 @@ abstract class Test_FileStorage extends UnitTestCase {
$content[] = $file;
}
}
$this->assertEqual(array(), $content);
$this->assertEquals(array(), $content);
}
/**
......@@ -89,31 +89,31 @@ abstract class Test_FileStorage extends UnitTestCase {
//fill a file with string data
$this->instance->file_put_contents('/lorem.txt', $sourceText);
$this->assertFalse($this->instance->is_dir('/lorem.txt'));
$this->assertEqual($sourceText, $this->instance->file_get_contents('/lorem.txt'), 'data returned from file_get_contents is not equal to the source data');
$this->assertEquals($sourceText, $this->instance->file_get_contents('/lorem.txt'), 'data returned from file_get_contents is not equal to the source data');
//empty the file
$this->instance->file_put_contents('/lorem.txt', '');
$this->assertEqual('', $this->instance->file_get_contents('/lorem.txt'), 'file not emptied');
$this->assertEquals('', $this->instance->file_get_contents('/lorem.txt'), 'file not emptied');
}
/**
* test various known mimetypes
*/
public function testMimeType() {
$this->assertEqual('httpd/unix-directory', $this->instance->getMimeType('/'));
$this->assertEqual(false, $this->instance->getMimeType('/non/existing/file'));
$this->assertEquals('httpd/unix-directory', $this->instance->getMimeType('/'));
$this->assertEquals(false, $this->instance->getMimeType('/non/existing/file'));
$textFile = OC::$SERVERROOT . '/tests/data/lorem.txt';
$this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile, 'r'));
$this->assertEqual('text/plain', $this->instance->getMimeType('/lorem.txt'));
$this->assertEquals('text/plain', $this->instance->getMimeType('/lorem.txt'));
$pngFile = OC::$SERVERROOT . '/tests/data/logo-wide.png';
$this->instance->file_put_contents('/logo-wide.png', file_get_contents($pngFile, 'r'));
$this->assertEqual('image/png', $this->instance->getMimeType('/logo-wide.png'));
$this->assertEquals('image/png', $this->instance->getMimeType('/logo-wide.png'));
$svgFile = OC::$SERVERROOT . '/tests/data/logo-wide.svg';
$this->instance->file_put_contents('/logo-wide.svg', file_get_contents($svgFile, 'r'));
$this->assertEqual('image/svg+xml', $this->instance->getMimeType('/logo-wide.svg'));
$this->assertEquals('image/svg+xml', $this->instance->getMimeType('/logo-wide.svg'));
}