summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-11-04 21:12:18 +0100
committerRobin Appelman <icewind@owncloud.com>2012-11-04 21:12:18 +0100
commit4b940955ddb3266f625eae83da412a655efef319 (patch)
tree8ed6bb2fae2f5fa3cb61c630e3dc98af5e99d656 /tests/lib
parent8a6bb7965d96b1c4297da8f5dbc9644fec7aeb0f (diff)
parent555dd5c261e52cf64f5a8eb6f4d03635cedafbbe (diff)
downloadnextcloud-server-4b940955ddb3266f625eae83da412a655efef319.tar.gz
nextcloud-server-4b940955ddb3266f625eae83da412a655efef319.zip
merge master into filesystem
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/archive.php60
-rw-r--r--tests/lib/cache.php26
-rw-r--r--tests/lib/cache/apc.php4
-rw-r--r--tests/lib/cache/xcache.php2
-rw-r--r--tests/lib/geo.php2
-rw-r--r--tests/lib/group.php68
-rw-r--r--tests/lib/group/backend.php52
-rw-r--r--tests/lib/streamwrappers.php20
-rw-r--r--tests/lib/template.php8
-rw-r--r--tests/lib/user/backend.php46
10 files changed, 144 insertions, 144 deletions
diff --git a/tests/lib/archive.php b/tests/lib/archive.php
index 04ae722aea7..cd2ca6630a5 100644
--- a/tests/lib/archive.php
+++ b/tests/lib/archive.php
@@ -26,24 +26,24 @@ abstract class Test_Archive extends UnitTestCase {
public function testGetFiles() {
$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');
+ $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');
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');
+ $this->assertTrue($this->instance->fileExists($file), 'file '.$file.' does not exist in archive');
}
$this->assertFalse($this->instance->fileExists('non/existing/file'));
$rootContent=$this->instance->getFolder('');
- $expected=array('lorem.txt','logo-wide.png','dir/');
- $this->assertEqual(3,count($rootContent));
+ $expected=array('lorem.txt','logo-wide.png', 'dir/');
+ $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,47 +53,47 @@ 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->instance->addFile('lorem.txt','foobar');
- $this->assertEqual('foobar',$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'));
}
public function testReadStream() {
$dir=OC::$SERVERROOT.'/tests/data';
$this->instance=$this->getExisting();
- $fh=$this->instance->getStream('lorem.txt','r');
+ $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);
+ $fh=$this->instance->getStream('lorem.txt', 'w');
+ $source=fopen($dir.'/lorem.txt', 'r');
+ 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->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..1a1287ff135 100644
--- a/tests/lib/cache.php
+++ b/tests/lib/cache.php
@@ -13,7 +13,7 @@ abstract class Test_Cache extends UnitTestCase {
protected $instance;
public function tearDown() {
- if($this->instance){
+ if($this->instance) {
$this->instance->clear();
}
}
@@ -23,25 +23,25 @@ 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');
+ $this->assertNull($this->instance->get('not_set'), 'Unset value not equal to null');
$this->assertTrue($this->instance->remove('value1'));
$this->assertFalse($this->instance->hasKey('value1'));
@@ -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/apc.php b/tests/lib/cache/apc.php
index f68b97bcbd9..bb5eb483dbf 100644
--- a/tests/lib/cache/apc.php
+++ b/tests/lib/cache/apc.php
@@ -22,11 +22,11 @@
class Test_Cache_APC extends Test_Cache {
public function setUp() {
- if(!extension_loaded('apc')){
+ if(!extension_loaded('apc')) {
$this->markTestSkipped('The apc extension is not available.');
return;
}
- if(!ini_get('apc.enable_cli') && OC::$CLI){
+ if(!ini_get('apc.enable_cli') && OC::$CLI) {
$this->markTestSkipped('apc not available in CLI.');
return;
}
diff --git a/tests/lib/cache/xcache.php b/tests/lib/cache/xcache.php
index c081036a31f..43bed2db037 100644
--- a/tests/lib/cache/xcache.php
+++ b/tests/lib/cache/xcache.php
@@ -22,7 +22,7 @@
class Test_Cache_XCache extends Test_Cache {
public function setUp() {
- if(!function_exists('xcache_get')){
+ if(!function_exists('xcache_get')) {
$this->markTestSkipped('The xcache extension is not available.');
return;
}
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..7b9ca3414b0 100644
--- a/tests/lib/group.php
+++ b/tests/lib/group.php
@@ -36,30 +36,30 @@ 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));
+ $this->assertEqual(array($user1), OC_Group::usersInGroup($group1));
+ $this->assertEqual(array(), OC_Group::usersInGroup($group2));
- $this->assertEqual(array($group1),OC_Group::getUserGroups($user1));
- $this->assertEqual(array(),OC_Group::getUserGroups($user2));
+ $this->assertEqual(array($group1), OC_Group::getUserGroups($user1));
+ $this->assertEqual(array(), OC_Group::getUserGroups($user2));
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->assertEqual(array(), OC_Group::getUserGroups($user1));
+ $this->assertEqual(array(), OC_Group::usersInGroup($group1));
+ $this->assertFalse(OC_Group::inGroup($user1, $group1));
}
function testMultiBackend() {
@@ -73,42 +73,42 @@ 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->assertEqual(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->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));
+ $this->assertEqual(array($user1), OC_Group::usersInGroup($group1));
- $this->assertEqual(array($group1),OC_Group::getUserGroups($user1));
- $this->assertEqual(array(),OC_Group::getUserGroups($user2));
+ $this->assertEqual(array($group1), OC_Group::getUserGroups($user1));
+ $this->assertEqual(array(), OC_Group::getUserGroups($user2));
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->assertEqual(array(), OC_Group::getUserGroups($user1));
+ $this->assertEqual(array(), OC_Group::usersInGroup($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..89b2785fca6 100644
--- a/tests/lib/streamwrappers.php
+++ b/tests/lib/streamwrappers.php
@@ -22,7 +22,7 @@
class Test_StreamWrappers extends UnitTestCase {
public function testFakeDir() {
- $items=array('foo','bar');
+ $items=array('foo', 'bar');
OC_FakeDirStream::$dirs['test']=$items;
$dh=opendir('fakedir://test');
$result=array();
@@ -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));
@@ -60,15 +60,15 @@ class Test_StreamWrappers extends UnitTestCase {
//test callback
$tmpFile=OC_Helper::TmpFile('.txt');
$file='close://'.$tmpFile;
- OC_CloseStreamWrapper::$callBacks[$tmpFile]=array('Test_StreamWrappers','closeCallBack');
- $fh=fopen($file,'w');
- fwrite($fh,'asd');
+ OC_CloseStreamWrapper::$callBacks[$tmpFile]=array('Test_StreamWrappers', 'closeCallBack');
+ $fh=fopen($file, 'w');
+ fwrite($fh, 'asd');
try{
fclose($fh);
$this->fail('Expected exception');
}catch(Exception $e) {
$path=$e->getMessage();
- $this->assertEqual($path,$tmpFile);
+ $this->assertEqual($path, $tmpFile);
}
}
diff --git a/tests/lib/template.php b/tests/lib/template.php
index dadfdba5e0c..32ae4aca590 100644
--- a/tests/lib/template.php
+++ b/tests/lib/template.php
@@ -24,7 +24,7 @@ require_once("lib/template.php");
class Test_TemplateFunctions extends UnitTestCase {
- public function testP(){
+ public function testP() {
// FIXME: do we need more testcases?
$htmlString = "<script>alert('xss');</script>";
ob_start();
@@ -35,7 +35,7 @@ class Test_TemplateFunctions extends UnitTestCase {
$this->assertEqual("&lt;script&gt;alert(&#039;xss&#039;);&lt;/script&gt;", $result);
}
- public function testPNormalString(){
+ public function testPNormalString() {
$normalString = "This is a good string!";
ob_start();
p($normalString);
@@ -46,7 +46,7 @@ class Test_TemplateFunctions extends UnitTestCase {
}
- public function testPrintUnescaped(){
+ public function testPrintUnescaped() {
$htmlString = "<script>alert('xss');</script>";
ob_start();
@@ -57,7 +57,7 @@ class Test_TemplateFunctions extends UnitTestCase {
$this->assertEqual($htmlString, $result);
}
- public function testPrintUnescapedNormalString(){
+ public function testPrintUnescapedNormalString() {
$normalString = "This is a good string!";
ob_start();
print_unescaped($normalString);
diff --git a/tests/lib/user/backend.php b/tests/lib/user/backend.php
index c69c1bad512..79653481f90 100644
--- a/tests/lib/user/backend.php
+++ b/tests/lib/user/backend.php
@@ -51,22 +51,22 @@ abstract class Test_User_Backend extends UnitTestCase {
$name1=$this->getUser();
$name2=$this->getUser();
- $this->backend->createUser($name1,'');
+ $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->backend->createUser($name2,'');
+ $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() {
@@ -76,24 +76,24 @@ abstract class Test_User_Backend extends UnitTestCase {
$this->assertFalse($this->backend->userExists($name1));
$this->assertFalse($this->backend->userExists($name2));
- $this->backend->createUser($name1,'pass1');
- $this->backend->createUser($name2,'pass2');
+ $this->backend->createUser($name1, 'pass1');
+ $this->backend->createUser($name2, 'pass2');
$this->assertTrue($this->backend->userExists($name1));
$this->assertTrue($this->backend->userExists($name2));
- $this->assertTrue($this->backend->checkPassword($name1,'pass1'));
- $this->assertTrue($this->backend->checkPassword($name2,'pass2'));
+ $this->assertTrue($this->backend->checkPassword($name1, 'pass1'));
+ $this->assertTrue($this->backend->checkPassword($name2, 'pass2'));
- $this->assertFalse($this->backend->checkPassword($name1,'pass2'));
- $this->assertFalse($this->backend->checkPassword($name2,'pass1'));
+ $this->assertFalse($this->backend->checkPassword($name1, 'pass2'));
+ $this->assertFalse($this->backend->checkPassword($name2, 'pass1'));
- $this->assertFalse($this->backend->checkPassword($name1,'dummy'));
- $this->assertFalse($this->backend->checkPassword($name2,'foobar'));
+ $this->assertFalse($this->backend->checkPassword($name1, 'dummy'));
+ $this->assertFalse($this->backend->checkPassword($name2, 'foobar'));
- $this->backend->setPassword($name1,'newpass1');
- $this->assertFalse($this->backend->checkPassword($name1,'pass1'));
- $this->assertTrue($this->backend->checkPassword($name1,'newpass1'));
- $this->assertFalse($this->backend->checkPassword($name2,'newpass1'));
+ $this->backend->setPassword($name1, 'newpass1');
+ $this->assertFalse($this->backend->checkPassword($name1, 'pass1'));
+ $this->assertTrue($this->backend->checkPassword($name1, 'newpass1'));
+ $this->assertFalse($this->backend->checkPassword($name2, 'newpass1'));
}
}