]> source.dussan.org Git - nextcloud-server.git/commitdiff
drop SimpleTest compatibility
authorThomas Mueller <thomas.mueller@tmit.eu>
Thu, 24 Jan 2013 15:47:17 +0000 (16:47 +0100)
committerThomas Mueller <thomas.mueller@tmit.eu>
Thu, 24 Jan 2013 15:47:17 +0000 (16:47 +0100)
23 files changed:
apps/files_encryption/test/crypt.php
apps/files_encryption/test/proxy.php
apps/files_encryption/test/stream.php
apps/files_encryption/test/util.php
apps/files_external/tests/ftp.php
apps/user_ldap/tests/group_ldap.php
tests/bootstrap.php
tests/lib/archive.php
tests/lib/cache.php
tests/lib/db.php
tests/lib/dbschema.php
tests/lib/filestorage.php
tests/lib/filesystem.php
tests/lib/geo.php
tests/lib/group.php
tests/lib/group/backend.php
tests/lib/helper.php
tests/lib/share/share.php
tests/lib/streamwrappers.php
tests/lib/template.php
tests/lib/user/backend.php
tests/lib/util.php
tests/lib/vcategories.php

index 5a7820dc9da28b9c65c8af6982728e7bb05ccfd2..19c10ab0ab5b358a363358004d223e2e7a965d58 100755 (executable)
@@ -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);
 //     }
        
 }
index 51e77100baa69eb9b100faaeee2acb042aaec4ca..709730f7609ca2464a1faa2c410569b50fa80c19 100644 (file)
 // 
 // }
 
-// class Test_CryptProxy extends UnitTestCase {
+// class Test_CryptProxy extends PHPUnit_Framework_TestCase {
 //     private $oldConfig;
 //     private $oldKey;
 //     
 //             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);
 // 
 //     }
 // 
 //             $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(){
 //             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);
 //             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));
 //     }
 // }
index 4211cab3104361c7941636e2b4177b0f615eaa04..ba82ac80eabb17dc16d01dce0d61d0f042c8a1b0 100644 (file)
 // // 
 // //          fclose( $stream );
 // // 
-// //          $this->assertEqual( 'foobar', $data );
+// //          $this->assertEquals( 'foobar', $data );
 // // 
 // // 
 // //          $file = OC::$SERVERROOT.'/3rdparty/MDB2.php';
 // // 
 // //          $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(){
 // //          $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');
 // //          $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);
 // //  }
 // // 
 // //  /**
 // //          $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);
 // //          $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);
 // //  }
 // // }
index 016787fbfbabdb38a36dc13d8e037f5a1beeda57..a299ec67f598644cb739300ba9f2308164b01d21 100755 (executable)
@@ -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 );
 //     
 //     }
 
index d0404b5f34cdbf11e7618a62c1bfeaf9ea03f8b3..91e4589ed184d10daa41cf1e2af6a5a1b8245bb6 100644 (file)
@@ -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(''));
        }
 }
index f99902d32f5cb028b4d922507c2e8af7f0f73e00..ae635597b71fcd15de2fa6b707e58fead4f3fc00 100644 (file)
@@ -20,7 +20,7 @@
 *
 */
 
-class Test_Group_Ldap extends UnitTestCase {
+class Test_Group_Ldap extends PHPUnit_Framework_TestCase {
        function setUp() {
                OC_Group::clearBackends();
        }
index 115a15883a08461638b874aee22c570c61918762..b97161ee6e4263ff3561ee9a64d9d1896b2407dd 100644 (file)
@@ -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;
index cd2ca6630a5f6d99cb4ec464ce4b37ba34d06fea..be5cc897a67b1134f824700080abd21b3edb9b7a 100644 (file)
@@ -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'));
        }
index 1a1287ff1352af6eb2fdb846e2f25a837d047c12..3dcf39f7d605df9b0c325264b25414c6f8d037e5 100644 (file)
@@ -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');
index c2eb38dae8367ba1a174305539db0c4610917557..440f3fb6bfd5be3ca5a98726834eb6e6509eb0f6 100644 (file)
@@ -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());
 
        }
 }
index cd408160afb3770ddaeeb28363602ca51e3b7013..fb60ce7dbb7d3f542fe975a18dba672227b7fca1 100644 (file)
@@ -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;
index e82a6f54e3d2773c1efe3183ad466adc0ea3970f..c408efb754321bbfc78e0f4e0955f8c84417f424 100644 (file)
@@ -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'));
        }
 
        public function testCopyAndMove() {
@@ -121,12 +121,12 @@ abstract class Test_FileStorage extends UnitTestCase {
                $this->instance->file_put_contents('/source.txt', file_get_contents($textFile));
                $this->instance->copy('/source.txt', '/target.txt');
                $this->assertTrue($this->instance->file_exists('/target.txt'));
-               $this->assertEqual($this->instance->file_get_contents('/source.txt'), $this->instance->file_get_contents('/target.txt'));
+               $this->assertEquals($this->instance->file_get_contents('/source.txt'), $this->instance->file_get_contents('/target.txt'));
 
                $this->instance->rename('/source.txt', '/target2.txt');
                $this->assertTrue($this->instance->file_exists('/target2.txt'));
                $this->assertFalse($this->instance->file_exists('/source.txt'));
-               $this->assertEqual(file_get_contents($textFile), $this->instance->file_get_contents('/target.txt'));
+               $this->assertEquals(file_get_contents($textFile), $this->instance->file_get_contents('/target.txt'));
        }
 
        public function testLocal() {
@@ -134,7 +134,7 @@ abstract class Test_FileStorage extends UnitTestCase {
                $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile));
                $localFile = $this->instance->getLocalFile('/lorem.txt');
                $this->assertTrue(file_exists($localFile));
-               $this->assertEqual(file_get_contents($localFile), file_get_contents($textFile));
+               $this->assertEquals(file_get_contents($localFile), file_get_contents($textFile));
 
                $this->instance->mkdir('/folder');
                $this->instance->file_put_contents('/folder/lorem.txt', file_get_contents($textFile));
@@ -145,9 +145,9 @@ abstract class Test_FileStorage extends UnitTestCase {
 
                $this->assertTrue(is_dir($localFolder));
                $this->assertTrue(file_exists($localFolder . '/lorem.txt'));
-               $this->assertEqual(file_get_contents($localFolder . '/lorem.txt'), file_get_contents($textFile));
-               $this->assertEqual(file_get_contents($localFolder . '/bar.txt'), 'asd');
-               $this->assertEqual(file_get_contents($localFolder . '/recursive/file.txt'), 'foo');
+               $this->assertEquals(file_get_contents($localFolder . '/lorem.txt'), file_get_contents($textFile));
+               $this->assertEquals(file_get_contents($localFolder . '/bar.txt'), 'asd');
+               $this->assertEquals(file_get_contents($localFolder . '/recursive/file.txt'), 'foo');
        }
 
        public function testStat() {
@@ -162,12 +162,12 @@ abstract class Test_FileStorage extends UnitTestCase {
 
                $this->assertTrue(($ctimeStart - 1) <= $mTime);
                $this->assertTrue($mTime <= ($ctimeEnd + 1));
-               $this->assertEqual(filesize($textFile), $this->instance->filesize('/lorem.txt'));
+               $this->assertEquals(filesize($textFile), $this->instance->filesize('/lorem.txt'));
 
                $stat = $this->instance->stat('/lorem.txt');
                //only size and mtime are requered in the result
-               $this->assertEqual($stat['size'], $this->instance->filesize('/lorem.txt'));
-               $this->assertEqual($stat['mtime'], $mTime);
+               $this->assertEquals($stat['size'], $this->instance->filesize('/lorem.txt'));
+               $this->assertEquals($stat['mtime'], $mTime);
 
                $mtimeStart = time();
                $supportsTouch = $this->instance->touch('/lorem.txt');
@@ -181,7 +181,7 @@ abstract class Test_FileStorage extends UnitTestCase {
 
                        if ($this->instance->touch('/lorem.txt', 100) !== false) {
                                $mTime = $this->instance->filemtime('/lorem.txt');
-                               $this->assertEqual($mTime, 100);
+                               $this->assertEquals($mTime, 100);
                        }
                }
 
@@ -207,7 +207,7 @@ abstract class Test_FileStorage extends UnitTestCase {
                $svgFile = OC::$SERVERROOT . '/tests/data/logo-wide.svg';
                $this->instance->file_put_contents('/logo-wide.svg', file_get_contents($svgFile, 'r'));
                $result = $this->instance->search('logo');
-               $this->assertEqual(2, count($result));
+               $this->assertEquals(2, count($result));
                $this->assertContains('/logo-wide.svg', $result);
                $this->assertContains('/logo-wide.png', $result);
        }
@@ -229,6 +229,6 @@ abstract class Test_FileStorage extends UnitTestCase {
 
                $fh = $this->instance->fopen('foo', 'r');
                $content = stream_get_contents($fh);
-               $this->assertEqual(file_get_contents($textFile), $content);
+               $this->assertEquals(file_get_contents($textFile), $content);
        }
 }
index 5cced4946d9b9aba4738eaf18cefd3f15ebce990..ee31ef4364d3d716e9c2ca2ebbf0e8be6584b0a1 100644 (file)
@@ -20,7 +20,7 @@
  *
  */
 
-class Test_Filesystem extends UnitTestCase {
+class Test_Filesystem extends PHPUnit_Framework_TestCase {
        /**
         * @var array tmpDirs
         */
@@ -47,28 +47,28 @@ class Test_Filesystem extends UnitTestCase {
 
        public function testMount() {
                OC_Filesystem::mount('OC_Filestorage_Local', self::getStorageData(), '/');
-               $this->assertEqual('/', OC_Filesystem::getMountPoint('/'));
-               $this->assertEqual('/', OC_Filesystem::getMountPoint('/some/folder'));
-               $this->assertEqual('', OC_Filesystem::getInternalPath('/'));
-               $this->assertEqual('some/folder', OC_Filesystem::getInternalPath('/some/folder'));
+               $this->assertEquals('/', OC_Filesystem::getMountPoint('/'));
+               $this->assertEquals('/', OC_Filesystem::getMountPoint('/some/folder'));
+               $this->assertEquals('', OC_Filesystem::getInternalPath('/'));
+               $this->assertEquals('some/folder', OC_Filesystem::getInternalPath('/some/folder'));
 
                OC_Filesystem::mount('OC_Filestorage_Local', self::getStorageData(), '/some');
-               $this->assertEqual('/', OC_Filesystem::getMountPoint('/'));
-               $this->assertEqual('/some/', OC_Filesystem::getMountPoint('/some/folder'));
-               $this->assertEqual('/some/', OC_Filesystem::getMountPoint('/some/'));
-               $this->assertEqual('/', OC_Filesystem::getMountPoint('/some'));
-               $this->assertEqual('folder', OC_Filesystem::getInternalPath('/some/folder'));
+               $this->assertEquals('/', OC_Filesystem::getMountPoint('/'));
+               $this->assertEquals('/some/', OC_Filesystem::getMountPoint('/some/folder'));
+               $this->assertEquals('/some/', OC_Filesystem::getMountPoint('/some/'));
+               $this->assertEquals('/', OC_Filesystem::getMountPoint('/some'));
+               $this->assertEquals('folder', OC_Filesystem::getInternalPath('/some/folder'));
        }
 
        public function testNormalize() {
-               $this->assertEqual('/path', OC_Filesystem::normalizePath('/path/'));
-               $this->assertEqual('/path/', OC_Filesystem::normalizePath('/path/', false));
-               $this->assertEqual('/path', OC_Filesystem::normalizePath('path'));
-               $this->assertEqual('/path', OC_Filesystem::normalizePath('\path'));
-               $this->assertEqual('/foo/bar', OC_Filesystem::normalizePath('/foo//bar/'));
-               $this->assertEqual('/foo/bar', OC_Filesystem::normalizePath('/foo////bar'));
+               $this->assertEquals('/path', OC_Filesystem::normalizePath('/path/'));
+               $this->assertEquals('/path/', OC_Filesystem::normalizePath('/path/', false));
+               $this->assertEquals('/path', OC_Filesystem::normalizePath('path'));
+               $this->assertEquals('/path', OC_Filesystem::normalizePath('\path'));
+               $this->assertEquals('/foo/bar', OC_Filesystem::normalizePath('/foo//bar/'));
+               $this->assertEquals('/foo/bar', OC_Filesystem::normalizePath('/foo////bar'));
                if (class_exists('Normalizer')) {
-                       $this->assertEqual("/foo/bar\xC3\xBC", OC_Filesystem::normalizePath("/foo/baru\xCC\x88"));
+                       $this->assertEquals("/foo/bar\xC3\xBC", OC_Filesystem::normalizePath("/foo/baru\xCC\x88"));
                }
        }
 
@@ -100,10 +100,10 @@ class Test_Filesystem extends UnitTestCase {
                $rootView->mkdir('/' . $user);
                $rootView->mkdir('/' . $user . '/files');
 
-               $this->assertFalse($rootView->file_put_contents('/.htaccess', 'foo'));
-               $this->assertFalse(OC_Filesystem::file_put_contents('/.htaccess', 'foo'));
+               $this->assertFalse((bool)$rootView->file_put_contents('/.htaccess', 'foo'));
+               $this->assertFalse((bool)OC_Filesystem::file_put_contents('/.htaccess', 'foo'));
                $fh = fopen(__FILE__, 'r');
-               $this->assertFalse(OC_Filesystem::file_put_contents('/.htaccess', $fh));
+               $this->assertFalse((bool)OC_Filesystem::file_put_contents('/.htaccess', $fh));
        }
 
        public function testHooks() {
@@ -134,6 +134,6 @@ class Test_Filesystem extends UnitTestCase {
 
        public function dummyHook($arguments) {
                $path = $arguments['path'];
-               $this->assertEqual($path, OC_Filesystem::normalizePath($path)); //the path passed to the hook should already be normalized
+               $this->assertEquals($path, OC_Filesystem::normalizePath($path)); //the path passed to the hook should already be normalized
        }
 }
index d4951ee79e79bbe16862536019418cd1b1ec1d44..82e6160868770c250134f10dbcf78d2da1ce15a0 100644 (file)
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-class Test_Geo extends UnitTestCase {
+class Test_Geo extends PHPUnit_Framework_TestCase {
        function testTimezone() {
                $result = OC_Geo::timezone(3, 3);
                $expected = 'Africa/Porto-Novo';
index 28264b0f168c060e9d8269c415d1400fc667f5d6..9128bd7ddce741b3c6f4a5b6f31b5f90213c55e1 100644 (file)
@@ -22,7 +22,7 @@
 *
 */
 
-class Test_Group extends UnitTestCase {
+class Test_Group extends PHPUnit_Framework_TestCase {
        function setUp() {
                OC_Group::clearBackends();
        }
@@ -43,24 +43,24 @@ class Test_Group extends UnitTestCase {
                $this->assertFalse(OC_Group::inGroup($user1, $group2));
                $this->assertFalse(OC_Group::inGroup($user2, $group2));
 
-               $this->assertTrue(OC_Group::addToGroup($user1, $group1));
+               $this->assertTrue((bool)OC_Group::addToGroup($user1, $group1));
 
                $this->assertTrue(OC_Group::inGroup($user1, $group1));
                $this->assertFalse(OC_Group::inGroup($user2, $group1));
                $this->assertFalse(OC_Group::inGroup($user1, $group2));
                $this->assertFalse(OC_Group::inGroup($user2, $group2));
 
-               $this->assertFalse(OC_Group::addToGroup($user1, $group1));
+               $this->assertFalse((bool)OC_Group::addToGroup($user1, $group1));
 
-               $this->assertEqual(array($user1), OC_Group::usersInGroup($group1));
-               $this->assertEqual(array(), OC_Group::usersInGroup($group2));
+               $this->assertEquals(array($user1), OC_Group::usersInGroup($group1));
+               $this->assertEquals(array(), OC_Group::usersInGroup($group2));
 
-               $this->assertEqual(array($group1), OC_Group::getUserGroups($user1));
-               $this->assertEqual(array(), OC_Group::getUserGroups($user2));
+               $this->assertEquals(array($group1), OC_Group::getUserGroups($user1));
+               $this->assertEquals(array(), OC_Group::getUserGroups($user2));
 
                OC_Group::deleteGroup($group1);
-               $this->assertEqual(array(), OC_Group::getUserGroups($user1));
-               $this->assertEqual(array(), OC_Group::usersInGroup($group1));
+               $this->assertEquals(array(), OC_Group::getUserGroups($user1));
+               $this->assertEquals(array(), OC_Group::usersInGroup($group1));
                $this->assertFalse(OC_Group::inGroup($user1, $group1));
        }
 
@@ -69,7 +69,7 @@ class Test_Group extends UnitTestCase {
                OC_Group::useBackend(new OC_Group_Dummy());
                $emptyGroup = null;
 
-               $this->assertEqual(false, OC_Group::createGroup($emptyGroup));
+               $this->assertEquals(false, OC_Group::createGroup($emptyGroup));
        }
 
 
@@ -80,8 +80,8 @@ class Test_Group extends UnitTestCase {
 
                $groupCopy = $group;
 
-               $this->assertEqual(false, OC_Group::createGroup($groupCopy));
-               $this->assertEqual(array($group), OC_Group::getGroups());
+               $this->assertEquals(false, OC_Group::createGroup($groupCopy));
+               $this->assertEquals(array($group), OC_Group::getGroups());
        }
 
 
@@ -90,8 +90,8 @@ class Test_Group extends UnitTestCase {
                $adminGroup = 'admin';
                OC_Group::createGroup($adminGroup);
 
-               $this->assertEqual(false, OC_Group::deleteGroup($adminGroup));
-               $this->assertEqual(array($adminGroup), OC_Group::getGroups());  
+               $this->assertEquals(false, OC_Group::deleteGroup($adminGroup));
+               $this->assertEquals(array($adminGroup), OC_Group::getGroups());
        }
 
 
@@ -100,8 +100,8 @@ class Test_Group extends UnitTestCase {
                $groupNonExistent = 'notExistent';
                $user = uniqid();
 
-               $this->assertEqual(false, OC_Group::addToGroup($user, $groupNonExistent));
-               $this->assertEqual(array(), OC_Group::getGroups());
+               $this->assertEquals(false, OC_Group::addToGroup($user, $groupNonExistent));
+               $this->assertEquals(array(), OC_Group::getGroups());
        }
 
 
@@ -122,7 +122,7 @@ class Test_Group extends UnitTestCase {
                OC_Group::addToGroup($user3, $group1);
                OC_Group::addToGroup($user3, $group2);
 
-               $this->assertEqual(array($user1, $user2, $user3), 
+               $this->assertEquals(array($user1, $user2, $user3),
                                        OC_Group::usersInGroups(array($group1, $group2, $group3)));
 
                // FIXME: needs more parameter variation
@@ -141,16 +141,16 @@ class Test_Group extends UnitTestCase {
                OC_Group::createGroup($group1);
 
                //groups should be added to the first registered backend
-               $this->assertEqual(array($group1), $backend1->getGroups());
-               $this->assertEqual(array(), $backend2->getGroups());
+               $this->assertEquals(array($group1), $backend1->getGroups());
+               $this->assertEquals(array(), $backend2->getGroups());
 
-               $this->assertEqual(array($group1), OC_Group::getGroups());
+               $this->assertEquals(array($group1), OC_Group::getGroups());
                $this->assertTrue(OC_Group::groupExists($group1));
                $this->assertFalse(OC_Group::groupExists($group2));
 
                $backend1->createGroup($group2);
 
-               $this->assertEqual(array($group1, $group2), OC_Group::getGroups());
+               $this->assertEquals(array($group1, $group2), OC_Group::getGroups());
                $this->assertTrue(OC_Group::groupExists($group1));
                $this->assertTrue(OC_Group::groupExists($group2));
 
@@ -161,22 +161,22 @@ class Test_Group extends UnitTestCase {
                $this->assertFalse(OC_Group::inGroup($user2, $group1));
 
 
-               $this->assertTrue(OC_Group::addToGroup($user1, $group1));
+               $this->assertTrue((bool)OC_Group::addToGroup($user1, $group1));
 
                $this->assertTrue(OC_Group::inGroup($user1, $group1));
                $this->assertFalse(OC_Group::inGroup($user2, $group1));
                $this->assertFalse($backend2->inGroup($user1, $group1));
 
-               $this->assertFalse(OC_Group::addToGroup($user1, $group1));
+               $this->assertFalse((bool)OC_Group::addToGroup($user1, $group1));
 
-               $this->assertEqual(array($user1), OC_Group::usersInGroup($group1));
+               $this->assertEquals(array($user1), OC_Group::usersInGroup($group1));
 
-               $this->assertEqual(array($group1), OC_Group::getUserGroups($user1));
-               $this->assertEqual(array(), OC_Group::getUserGroups($user2));
+               $this->assertEquals(array($group1), OC_Group::getUserGroups($user1));
+               $this->assertEquals(array(), OC_Group::getUserGroups($user2));
 
                OC_Group::deleteGroup($group1);
-               $this->assertEqual(array(), OC_Group::getUserGroups($user1));
-               $this->assertEqual(array(), OC_Group::usersInGroup($group1));
+               $this->assertEquals(array(), OC_Group::getUserGroups($user1));
+               $this->assertEquals(array(), OC_Group::usersInGroup($group1));
                $this->assertFalse(OC_Group::inGroup($user1, $group1));
        }
 }
index f61abed5f297fa1ee111319be94338e5ac9f9c02..d308232a78b5ed5a991d7091ddf28169c8357cbd 100644 (file)
@@ -20,7 +20,7 @@
 *
 */
 
-abstract class Test_Group_Backend extends UnitTestCase {
+abstract class Test_Group_Backend extends PHPUnit_Framework_TestCase {
        /**
         * @var OC_Group_Backend $backend
         */
@@ -52,18 +52,18 @@ abstract class Test_Group_Backend extends UnitTestCase {
                $name2=$this->getGroupName();
                $this->backend->createGroup($name1);
                $count=count($this->backend->getGroups())-$startCount;
-               $this->assertEqual(1, $count);
+               $this->assertEquals(1, $count);
                $this->assertTrue((array_search($name1, $this->backend->getGroups())!==false));
                $this->assertFalse((array_search($name2, $this->backend->getGroups())!==false));
                $this->backend->createGroup($name2);
                $count=count($this->backend->getGroups())-$startCount;
-               $this->assertEqual(2, $count);
+               $this->assertEquals(2, $count);
                $this->assertTrue((array_search($name1, $this->backend->getGroups())!==false));
                $this->assertTrue((array_search($name2, $this->backend->getGroups())!==false));
 
                $this->backend->deleteGroup($name2);
                $count=count($this->backend->getGroups())-$startCount;
-               $this->assertEqual(1, $count);
+               $this->assertEquals(1, $count);
                $this->assertTrue((array_search($name1, $this->backend->getGroups())!==false));
                $this->assertFalse((array_search($name2, $this->backend->getGroups())!==false));
        }
@@ -91,15 +91,15 @@ abstract class Test_Group_Backend extends UnitTestCase {
                
                $this->assertFalse($this->backend->addToGroup($user1, $group1));
 
-               $this->assertEqual(array($user1), $this->backend->usersInGroup($group1));
-               $this->assertEqual(array(), $this->backend->usersInGroup($group2));
+               $this->assertEquals(array($user1), $this->backend->usersInGroup($group1));
+               $this->assertEquals(array(), $this->backend->usersInGroup($group2));
 
-               $this->assertEqual(array($group1), $this->backend->getUserGroups($user1));
-               $this->assertEqual(array(), $this->backend->getUserGroups($user2));
+               $this->assertEquals(array($group1), $this->backend->getUserGroups($user1));
+               $this->assertEquals(array(), $this->backend->getUserGroups($user2));
 
                $this->backend->deleteGroup($group1);
-               $this->assertEqual(array(), $this->backend->getUserGroups($user1));
-               $this->assertEqual(array(), $this->backend->usersInGroup($group1));
+               $this->assertEquals(array(), $this->backend->getUserGroups($user1));
+               $this->assertEquals(array(), $this->backend->usersInGroup($group1));
                $this->assertFalse($this->backend->inGroup($user1, $group1));
        }
 }
index cfb9a7995795f0611e5b4d276e85c2716302c91f..336e8f8b3c5ccf90bec70aa37efb644d188e118a 100644 (file)
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-class Test_Helper extends UnitTestCase {
+class Test_Helper extends PHPUnit_Framework_TestCase {
 
        function testHumanFileSize() {
                $result = OC_Helper::humanFileSize(0);
index 92f5d065cf26fb7c1bb2703f74a2244d96721420..ab43e47726b9977515213669a58f2db5cc5a17a6 100644 (file)
@@ -19,7 +19,7 @@
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-class Test_Share extends UnitTestCase {
+class Test_Share extends PHPUnit_Framework_TestCase {
 
        protected $itemType;
        protected $userBackend;
index 89b2785fca6e705bb776d72ea5597f0315dfdfbc..aebbc93b9024a36ecf46dce5affac4bb768c2c9c 100644 (file)
@@ -20,7 +20,7 @@
 *
 */
 
-class Test_StreamWrappers extends UnitTestCase {
+class Test_StreamWrappers extends PHPUnit_Framework_TestCase {
        public function testFakeDir() {
                $items=array('foo', 'bar');
                OC_FakeDirStream::$dirs['test']=$items;
@@ -30,7 +30,7 @@ class Test_StreamWrappers extends UnitTestCase {
                        $result[]=$file;
                        $this->assertContains($file, $items);
                }
-               $this->assertEqual(count($items), count($result));
+               $this->assertEquals(count($items), count($result));
        }
 
        public function testStaticStream() {
@@ -39,7 +39,7 @@ class Test_StreamWrappers extends UnitTestCase {
                $this->assertFalse(file_exists($staticFile));
                file_put_contents($staticFile, file_get_contents($sourceFile));
                $this->assertTrue(file_exists($staticFile));
-               $this->assertEqual(file_get_contents($sourceFile), file_get_contents($staticFile));
+               $this->assertEquals(file_get_contents($sourceFile), file_get_contents($staticFile));
                unlink($staticFile);
                clearstatcache();
                $this->assertFalse(file_exists($staticFile));
@@ -52,7 +52,7 @@ class Test_StreamWrappers extends UnitTestCase {
                $file='close://'.$tmpFile;
                $this->assertTrue(file_exists($file));
                file_put_contents($file, file_get_contents($sourceFile));
-               $this->assertEqual(file_get_contents($sourceFile), file_get_contents($file));
+               $this->assertEquals(file_get_contents($sourceFile), file_get_contents($file));
                unlink($file);
                clearstatcache();
                $this->assertFalse(file_exists($file));
@@ -68,7 +68,7 @@ class Test_StreamWrappers extends UnitTestCase {
                        $this->fail('Expected exception');
                }catch(Exception $e) {
                        $path=$e->getMessage();
-                       $this->assertEqual($path, $tmpFile);
+                       $this->assertEquals($path, $tmpFile);
                }
        }
 
index 2899c3512b219c39412684ffdde20fe943530b11..6e88d4c07fc0218479a19fd2696159169080f40a 100644 (file)
@@ -22,7 +22,7 @@
 
 OC::autoload('OC_Template');
 
-class Test_TemplateFunctions extends UnitTestCase {
+class Test_TemplateFunctions extends PHPUnit_Framework_TestCase {
 
        public function testP() {
                // FIXME: do we need more testcases?
@@ -31,7 +31,7 @@ class Test_TemplateFunctions extends UnitTestCase {
                p($htmlString);
                $result = ob_get_clean();
 
-               $this->assertEqual("&lt;script&gt;alert(&#039;xss&#039;);&lt;/script&gt;", $result);
+               $this->assertEquals("&lt;script&gt;alert(&#039;xss&#039;);&lt;/script&gt;", $result);
        }
 
        public function testPNormalString() {
@@ -40,7 +40,7 @@ class Test_TemplateFunctions extends UnitTestCase {
                p($normalString);
                $result = ob_get_clean();
 
-               $this->assertEqual("This is a good string!", $result);
+               $this->assertEquals("This is a good string!", $result);
        }
 
 
@@ -51,7 +51,7 @@ class Test_TemplateFunctions extends UnitTestCase {
                print_unescaped($htmlString);
                $result = ob_get_clean();
 
-               $this->assertEqual($htmlString, $result);
+               $this->assertEquals($htmlString, $result);
        }
 
        public function testPrintUnescapedNormalString() {
@@ -60,7 +60,7 @@ class Test_TemplateFunctions extends UnitTestCase {
                print_unescaped($normalString);
                $result = ob_get_clean();
 
-               $this->assertEqual("This is a good string!", $result);
+               $this->assertEquals("This is a good string!", $result);
        }
 
 
index 0b744770ea28faea45f37e119b54af509179e2a1..40674424c96efb918f0c518532566122a4c60e80 100644 (file)
@@ -30,7 +30,7 @@
  * For an example see /tests/lib/user/dummy.php
  */
 
-abstract class Test_User_Backend extends UnitTestCase {
+abstract class Test_User_Backend extends PHPUnit_Framework_TestCase {
        /**
         * @var OC_User_Backend $backend
         */
@@ -53,18 +53,18 @@ abstract class Test_User_Backend extends UnitTestCase {
                $name2=$this->getUser();
                $this->backend->createUser($name1, '');
                $count=count($this->backend->getUsers())-$startCount;
-               $this->assertEqual(1, $count);
+               $this->assertEquals(1, $count);
                $this->assertTrue((array_search($name1, $this->backend->getUsers())!==false));
                $this->assertFalse((array_search($name2, $this->backend->getUsers())!==false));
                $this->backend->createUser($name2, '');
                $count=count($this->backend->getUsers())-$startCount;
-               $this->assertEqual(2, $count);
+               $this->assertEquals(2, $count);
                $this->assertTrue((array_search($name1, $this->backend->getUsers())!==false));
                $this->assertTrue((array_search($name2, $this->backend->getUsers())!==false));
 
                $this->backend->deleteUser($name2);
                $count=count($this->backend->getUsers())-$startCount;
-               $this->assertEqual(1, $count);
+               $this->assertEquals(1, $count);
                $this->assertTrue((array_search($name1, $this->backend->getUsers())!==false));
                $this->assertFalse((array_search($name2, $this->backend->getUsers())!==false));
        }
index 27635cb805558cf3b46130c7f1ace9a3e0cd9c47..ebff3c7381a2fb7f679140e392599b6f396de6d5 100644 (file)
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 
-class Test_Util extends UnitTestCase {
+class Test_Util extends PHPUnit_Framework_TestCase {
 
        // Constructor
        function Test_Util() {
index 63516a063daa62f4cbe37f7054ef9626c0153546..e79dd49870c89f33b5ef1f309b5a5cc41c5d4233 100644 (file)
@@ -22,7 +22,7 @@
 
 //require_once("../lib/template.php");
 
-class Test_VCategories extends UnitTestCase {
+class Test_VCategories extends PHPUnit_Framework_TestCase {
 
        protected $objectType;
        protected $user;
@@ -49,7 +49,7 @@ class Test_VCategories extends UnitTestCase {
 
                $catmgr = new OC_VCategories($this->objectType, $this->user, $defcategories);
 
-               $this->assertEqual(4, count($catmgr->categories()));
+               $this->assertEquals(4, count($catmgr->categories()));
        }
 
        public function testAddCategories() {
@@ -59,25 +59,25 @@ class Test_VCategories extends UnitTestCase {
 
                foreach($categories as $category) {
                        $result = $catmgr->add($category);
-                       $this->assertTrue($result);
+                       $this->assertTrue((bool)$result);
                }
 
                $this->assertFalse($catmgr->add('Family'));
                $this->assertFalse($catmgr->add('fAMILY'));
 
-               $this->assertEqual(4, count($catmgr->categories()));
+               $this->assertEquals(4, count($catmgr->categories()));
        }
 
        public function testdeleteCategories() {
                $defcategories = array('Friends', 'Family', 'Work', 'Other');
                $catmgr = new OC_VCategories($this->objectType, $this->user, $defcategories);
-               $this->assertEqual(4, count($catmgr->categories()));
+               $this->assertEquals(4, count($catmgr->categories()));
 
                $catmgr->delete('family');
-               $this->assertEqual(3, count($catmgr->categories()));
+               $this->assertEquals(3, count($catmgr->categories()));
 
                $catmgr->delete(array('Friends', 'Work', 'Other'));
-               $this->assertEqual(0, count($catmgr->categories()));
+               $this->assertEquals(0, count($catmgr->categories()));
 
        }
 
@@ -90,8 +90,8 @@ class Test_VCategories extends UnitTestCase {
                        $catmgr->addToCategory($id, 'Family');
                }
 
-               $this->assertEqual(1, count($catmgr->categories()));
-               $this->assertEqual(9, count($catmgr->idsForCategory('Family')));
+               $this->assertEquals(1, count($catmgr->categories()));
+               $this->assertEquals(9, count($catmgr->idsForCategory('Family')));
        }
 
        /**
@@ -110,8 +110,8 @@ class Test_VCategories extends UnitTestCase {
                        $this->assertFalse(in_array($id, $catmgr->idsForCategory('Family')));
                }
 
-               $this->assertEqual(1, count($catmgr->categories()));
-               $this->assertEqual(0, count($catmgr->idsForCategory('Family')));
+               $this->assertEquals(1, count($catmgr->categories()));
+               $this->assertEquals(0, count($catmgr->idsForCategory('Family')));
        }
 
 }