diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2012-11-03 01:59:36 +0400 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2012-11-03 01:59:36 +0400 |
commit | fd584f446dabb1d3727a932cd5f4dbaafe63f0b8 (patch) | |
tree | 17efc1c42c3e844b69c9c19f6eba1b4cbd16f5e0 /tests | |
parent | 2dbf2c69deaf2bb8bdf02d4539756f8f6d2b9738 (diff) | |
parent | afadf93d317e27fd848f1e70d5849169f862aed9 (diff) |
Merge pull request #220 from fmms/checkstyle02
Checkstyle: many fixes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/archive.php | 44 | ||||
-rw-r--r-- | tests/lib/cache.php | 22 | ||||
-rw-r--r-- | tests/lib/cache/file.php | 2 | ||||
-rw-r--r-- | tests/lib/geo.php | 2 | ||||
-rw-r--r-- | tests/lib/group.php | 44 | ||||
-rw-r--r-- | tests/lib/group/backend.php | 52 | ||||
-rw-r--r-- | tests/lib/streamwrappers.php | 12 | ||||
-rw-r--r-- | tests/lib/user/backend.php | 18 |
8 files changed, 98 insertions, 98 deletions
diff --git a/tests/lib/archive.php b/tests/lib/archive.php index 04ae722aea7..408dc2bbae8 100644 --- a/tests/lib/archive.php +++ b/tests/lib/archive.php @@ -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->assertEqual(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->assertEqual(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->assertEqual(1, count($dirContent)); foreach($expected as $file) { $this->assertContains($file, $dirContent, 'cant find '. $file . ' in archive'); } @@ -53,26 +53,26 @@ 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->assertEqual(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->instance->extractFile('lorem.txt', $tmpFile); + $this->assertEqual(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->instance->addFile('lorem.txt',$textFile); - $this->assertEqual(1,count($this->instance->getFiles())); + $this->assertEqual(0, count($this->instance->getFiles())); + $this->instance->addFile('lorem.txt', $textFile); + $this->assertEqual(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->assertEqual(file_get_contents($textFile), $this->instance->getFile('lorem.txt')); $this->instance->addFile('lorem.txt','foobar'); - $this->assertEqual('foobar',$this->instance->getFile('lorem.txt')); + $this->assertEqual('foobar', $this->instance->getFile('lorem.txt')); } public function testReadStream() { @@ -80,20 +80,20 @@ abstract class Test_Archive extends UnitTestCase { $this->instance=$this->getExisting(); $fh=$this->instance->getStream('lorem.txt','r'); $this->assertTrue($fh); - $content=fread($fh,$this->instance->filesize('lorem.txt')); + $content=fread($fh, $this->instance->filesize('lorem.txt')); fclose($fh); - $this->assertEqual(file_get_contents($dir.'/lorem.txt'),$content); + $this->assertEqual(file_get_contents($dir.'/lorem.txt'), $content); } public function testWriteStream() { $dir=OC::$SERVERROOT.'/tests/data'; $this->instance=$this->getNew(); $fh=$this->instance->getStream('lorem.txt','w'); $source=fopen($dir.'/lorem.txt','r'); - OCP\Files::streamCopy($source,$fh); + OCP\Files::streamCopy($source, $fh); 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->assertEqual(file_get_contents($dir.'/lorem.txt'), $this->instance->getFile('lorem.txt')); } public function testFolder() { $this->instance=$this->getNew(); @@ -111,29 +111,29 @@ 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->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')); OCP\Files::rmdirr($tmpDir); } public function testMoveRemove() { $dir=OC::$SERVERROOT.'/tests/data'; $textFile=$dir.'/lorem.txt'; $this->instance=$this->getNew(); - $this->instance->addFile('lorem.txt',$textFile); + $this->instance->addFile('lorem.txt', $textFile); $this->assertFalse($this->instance->fileExists('target.txt')); $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->assertEqual(file_get_contents($textFile), $this->instance->getFile('target.txt')); $this->instance->remove('target.txt'); $this->assertFalse($this->instance->fileExists('target.txt')); } public function testRecursive() { $dir=OC::$SERVERROOT.'/tests/data'; $this->instance=$this->getNew(); - $this->instance->addRecursive('/dir',$dir); + $this->instance->addRecursive('/dir', $dir); $this->assertTrue($this->instance->fileExists('/dir/lorem.txt')); $this->assertTrue($this->instance->fileExists('/dir/data.zip')); $this->assertTrue($this->instance->fileExists('/dir/data.tar.gz')); diff --git a/tests/lib/cache.php b/tests/lib/cache.php index 08653d4a310..7f3eb3ee6fa 100644 --- a/tests/lib/cache.php +++ b/tests/lib/cache.php @@ -23,22 +23,22 @@ abstract class Test_Cache extends UnitTestCase { $this->assertFalse($this->instance->hasKey('value1')); $value='foobar'; - $this->instance->set('value1',$value); + $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->assertEqual($value, $received,'Value recieved from cache not equal to the original'); $value='ipsum lorum'; - $this->instance->set('value1',$value); + $this->instance->set('value1', $value); $received=$this->instance->get('value1'); - $this->assertEqual($value,$received,'Value not overwritten by second set'); + $this->assertEqual($value, $received,'Value not overwritten by second set'); $value2='foobar'; - $this->instance->set('value2',$value2); + $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->assertEqual($value, $received,'Value changed while setting other variable'); + $this->assertEqual($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'); @@ -49,10 +49,10 @@ abstract class Test_Cache extends UnitTestCase { function testClear() { $value='ipsum lorum'; - $this->instance->set('1_value1',$value); - $this->instance->set('1_value2',$value); - $this->instance->set('2_value1',$value); - $this->instance->set('3_value1',$value); + $this->instance->set('1_value1', $value); + $this->instance->set('1_value2', $value); + $this->instance->set('2_value1', $value); + $this->instance->set('3_value1', $value); $this->assertTrue($this->instance->clear('1_')); $this->assertFalse($this->instance->hasKey('1_value1')); diff --git a/tests/lib/cache/file.php b/tests/lib/cache/file.php index 00be005d08d..47b18e5b9f4 100644 --- a/tests/lib/cache/file.php +++ b/tests/lib/cache/file.php @@ -39,7 +39,7 @@ class Test_Cache_File extends Test_Cache { //set up temporary storage OC_Filesystem::clearMounts(); - OC_Filesystem::mount('OC_Filestorage_Temporary',array(),'/'); + OC_Filesystem::mount('OC_Filestorage_Temporary', array(),'/'); OC_User::clearBackends(); OC_User::useBackend(new OC_User_Dummy()); diff --git a/tests/lib/geo.php b/tests/lib/geo.php index cae3d550b33..d4951ee79e7 100644 --- a/tests/lib/geo.php +++ b/tests/lib/geo.php @@ -8,7 +8,7 @@ class Test_Geo extends UnitTestCase { function testTimezone() { - $result = OC_Geo::timezone(3,3); + $result = OC_Geo::timezone(3, 3); $expected = 'Africa/Porto-Novo'; $this->assertEquals($expected, $result); diff --git a/tests/lib/group.php b/tests/lib/group.php index 0bea9a00886..9ad397b94a6 100644 --- a/tests/lib/group.php +++ b/tests/lib/group.php @@ -36,19 +36,19 @@ class Test_Group extends UnitTestCase { $user1=uniqid(); $user2=uniqid(); - $this->assertFalse(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::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->assertTrue(OC_Group::addToGroup($user1,$group1)); + $this->assertTrue(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->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(OC_Group::addToGroup($user1, $group1)); $this->assertEqual(array($user1),OC_Group::usersInGroup($group1)); $this->assertEqual(array(),OC_Group::usersInGroup($group2)); @@ -59,7 +59,7 @@ class Test_Group extends UnitTestCase { OC_Group::deleteGroup($group1); $this->assertEqual(array(),OC_Group::getUserGroups($user1)); $this->assertEqual(array(),OC_Group::usersInGroup($group1)); - $this->assertFalse(OC_Group::inGroup($user1,$group1)); + $this->assertFalse(OC_Group::inGroup($user1, $group1)); } function testMultiBackend() { @@ -73,8 +73,8 @@ 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->assertEqual(array($group1), $backend1->getGroups()); + $this->assertEqual(array(), $backend2->getGroups()); $this->assertEqual(array($group1),OC_Group::getGroups()); $this->assertTrue(OC_Group::groupExists($group1)); @@ -82,24 +82,24 @@ class Test_Group extends UnitTestCase { $backend1->createGroup($group2); - $this->assertEqual(array($group1,$group2),OC_Group::getGroups()); + $this->assertEqual(array($group1, $group2),OC_Group::getGroups()); $this->assertTrue(OC_Group::groupExists($group1)); $this->assertTrue(OC_Group::groupExists($group2)); $user1=uniqid(); $user2=uniqid(); - $this->assertFalse(OC_Group::inGroup($user1,$group1)); - $this->assertFalse(OC_Group::inGroup($user2,$group1)); + $this->assertFalse(OC_Group::inGroup($user1, $group1)); + $this->assertFalse(OC_Group::inGroup($user2, $group1)); - $this->assertTrue(OC_Group::addToGroup($user1,$group1)); + $this->assertTrue(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->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(OC_Group::addToGroup($user1, $group1)); $this->assertEqual(array($user1),OC_Group::usersInGroup($group1)); @@ -109,6 +109,6 @@ class Test_Group extends UnitTestCase { OC_Group::deleteGroup($group1); $this->assertEqual(array(),OC_Group::getUserGroups($user1)); $this->assertEqual(array(),OC_Group::usersInGroup($group1)); - $this->assertFalse(OC_Group::inGroup($user1,$group1)); + $this->assertFalse(OC_Group::inGroup($user1, $group1)); } } diff --git a/tests/lib/group/backend.php b/tests/lib/group/backend.php index 61e008b6ca5..f61abed5f29 100644 --- a/tests/lib/group/backend.php +++ b/tests/lib/group/backend.php @@ -52,20 +52,20 @@ 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->assertTrue((array_search($name1,$this->backend->getGroups())!==false)); - $this->assertFalse((array_search($name2,$this->backend->getGroups())!==false)); + $this->assertEqual(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->assertTrue((array_search($name1,$this->backend->getGroups())!==false)); - $this->assertTrue((array_search($name2,$this->backend->getGroups())!==false)); + $this->assertEqual(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->assertTrue((array_search($name1,$this->backend->getGroups())!==false)); - $this->assertFalse((array_search($name2,$this->backend->getGroups())!==false)); + $this->assertEqual(1, $count); + $this->assertTrue((array_search($name1, $this->backend->getGroups())!==false)); + $this->assertFalse((array_search($name2, $this->backend->getGroups())!==false)); } public function testUser() { @@ -77,29 +77,29 @@ abstract class Test_Group_Backend extends UnitTestCase { $user1=$this->getUserName(); $user2=$this->getUserName(); - $this->assertFalse($this->backend->inGroup($user1,$group1)); - $this->assertFalse($this->backend->inGroup($user2,$group1)); - $this->assertFalse($this->backend->inGroup($user1,$group2)); - $this->assertFalse($this->backend->inGroup($user2,$group2)); + $this->assertFalse($this->backend->inGroup($user1, $group1)); + $this->assertFalse($this->backend->inGroup($user2, $group1)); + $this->assertFalse($this->backend->inGroup($user1, $group2)); + $this->assertFalse($this->backend->inGroup($user2, $group2)); - $this->assertTrue($this->backend->addToGroup($user1,$group1)); + $this->assertTrue($this->backend->addToGroup($user1, $group1)); - $this->assertTrue($this->backend->inGroup($user1,$group1)); - $this->assertFalse($this->backend->inGroup($user2,$group1)); - $this->assertFalse($this->backend->inGroup($user1,$group2)); - $this->assertFalse($this->backend->inGroup($user2,$group2)); + $this->assertTrue($this->backend->inGroup($user1, $group1)); + $this->assertFalse($this->backend->inGroup($user2, $group1)); + $this->assertFalse($this->backend->inGroup($user1, $group2)); + $this->assertFalse($this->backend->inGroup($user2, $group2)); - $this->assertFalse($this->backend->addToGroup($user1,$group1)); + $this->assertFalse($this->backend->addToGroup($user1, $group1)); - $this->assertEqual(array($user1),$this->backend->usersInGroup($group1)); - $this->assertEqual(array(),$this->backend->usersInGroup($group2)); + $this->assertEqual(array($user1), $this->backend->usersInGroup($group1)); + $this->assertEqual(array(), $this->backend->usersInGroup($group2)); - $this->assertEqual(array($group1),$this->backend->getUserGroups($user1)); - $this->assertEqual(array(),$this->backend->getUserGroups($user2)); + $this->assertEqual(array($group1), $this->backend->getUserGroups($user1)); + $this->assertEqual(array(), $this->backend->getUserGroups($user2)); $this->backend->deleteGroup($group1); - $this->assertEqual(array(),$this->backend->getUserGroups($user1)); - $this->assertEqual(array(),$this->backend->usersInGroup($group1)); - $this->assertFalse($this->backend->inGroup($user1,$group1)); + $this->assertEqual(array(), $this->backend->getUserGroups($user1)); + $this->assertEqual(array(), $this->backend->usersInGroup($group1)); + $this->assertFalse($this->backend->inGroup($user1, $group1)); } } diff --git a/tests/lib/streamwrappers.php b/tests/lib/streamwrappers.php index 46838ff9754..f864a9e3611 100644 --- a/tests/lib/streamwrappers.php +++ b/tests/lib/streamwrappers.php @@ -30,16 +30,16 @@ class Test_StreamWrappers extends UnitTestCase { $result[]=$file; $this->assertContains($file, $items); } - $this->assertEqual(count($items),count($result)); + $this->assertEqual(count($items), count($result)); } public function testStaticStream() { $sourceFile=OC::$SERVERROOT.'/tests/data/lorem.txt'; $staticFile='static://test'; $this->assertFalse(file_exists($staticFile)); - file_put_contents($staticFile,file_get_contents($sourceFile)); + file_put_contents($staticFile, file_get_contents($sourceFile)); $this->assertTrue(file_exists($staticFile)); - $this->assertEqual(file_get_contents($sourceFile),file_get_contents($staticFile)); + $this->assertEqual(file_get_contents($sourceFile), file_get_contents($staticFile)); unlink($staticFile); clearstatcache(); $this->assertFalse(file_exists($staticFile)); @@ -51,8 +51,8 @@ class Test_StreamWrappers extends UnitTestCase { $tmpFile=OC_Helper::TmpFile('.txt'); $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)); + file_put_contents($file, file_get_contents($sourceFile)); + $this->assertEqual(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->assertEqual($path, $tmpFile); } } diff --git a/tests/lib/user/backend.php b/tests/lib/user/backend.php index c69c1bad512..eb3aa91b683 100644 --- a/tests/lib/user/backend.php +++ b/tests/lib/user/backend.php @@ -53,20 +53,20 @@ 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->assertTrue((array_search($name1,$this->backend->getUsers())!==false)); - $this->assertFalse((array_search($name2,$this->backend->getUsers())!==false)); + $this->assertEqual(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->assertTrue((array_search($name1,$this->backend->getUsers())!==false)); - $this->assertTrue((array_search($name2,$this->backend->getUsers())!==false)); + $this->assertEqual(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->assertTrue((array_search($name1,$this->backend->getUsers())!==false)); - $this->assertFalse((array_search($name2,$this->backend->getUsers())!==false)); + $this->assertEqual(1, $count); + $this->assertTrue((array_search($name1, $this->backend->getUsers())!==false)); + $this->assertFalse((array_search($name2, $this->backend->getUsers())!==false)); } public function testLogin() { |