Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
cb3a598c
Commit
cb3a598c
authored
Nov 10, 2014
by
Joas Schilling
Browse files
Make root tests extend the \Test\TestCase
parent
76ebd3a0
Changes
46
Hide whitespace changes
Inline
Side-by-side
tests/lib/activitymanager.php
View file @
cb3a598c
...
...
@@ -8,12 +8,14 @@
*
*/
class
Test_ActivityManager
extends
PHPUnit_Framework_
TestCase
{
class
Test_ActivityManager
extends
\
Test\
TestCase
{
/** @var \OC\ActivityManager */
private
$activityManager
;
public
function
setUp
()
{
protected
function
setUp
()
{
parent
::
setUp
();
$this
->
activityManager
=
new
\
OC\ActivityManager
();
$this
->
activityManager
->
registerExtension
(
function
()
{
return
new
NoOpExtension
();
...
...
tests/lib/api.php
View file @
cb3a598c
...
...
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
class
Test_API
extends
PHPUnit_Framework_
TestCase
{
class
Test_API
extends
\
Test\
TestCase
{
// Helps build a response variable
...
...
tests/lib/app.php
View file @
cb3a598c
...
...
@@ -7,7 +7,7 @@
* See the COPYING-README file.
*/
class
Test_App
extends
PHPUnit_Framework_
TestCase
{
class
Test_App
extends
\
Test\
TestCase
{
private
$oldAppConfigService
;
...
...
tests/lib/appconfig.php
View file @
cb3a598c
...
...
@@ -7,8 +7,10 @@
* See the COPYING-README file.
*/
class
Test_Appconfig
extends
PHPUnit_Framework_
TestCase
{
class
Test_Appconfig
extends
\
Test\
TestCase
{
public
static
function
setUpBeforeClass
()
{
parent
::
setUpBeforeClass
();
$query
=
\
OC_DB
::
prepare
(
'INSERT INTO `*PREFIX*appconfig` VALUES (?, ?, ?)'
);
$query
->
execute
(
array
(
'testapp'
,
'enabled'
,
'true'
));
...
...
@@ -33,6 +35,8 @@ class Test_Appconfig extends PHPUnit_Framework_TestCase {
$query
->
execute
(
array
(
'someapp'
));
$query
->
execute
(
array
(
'123456'
));
$query
->
execute
(
array
(
'anotherapp'
));
parent
::
tearDownAfterClass
();
}
public
function
testGetApps
()
{
...
...
tests/lib/archive.php
View file @
cb3a598c
...
...
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
abstract
class
Test_Archive
extends
PHPUnit_Framework_
TestCase
{
abstract
class
Test_Archive
extends
\
Test\
TestCase
{
/**
* @var OC_Archive
*/
...
...
tests/lib/archive/tar.php
View file @
cb3a598c
...
...
@@ -7,11 +7,12 @@
*/
class
Test_Archive_TAR
extends
Test_Archive
{
public
function
setUp
()
{
protected
function
setUp
()
{
parent
::
setUp
();
if
(
OC_Util
::
runningOnWindows
())
{
$this
->
markTestSkipped
(
'[Windows] tar archives are not supported on Windows'
);
}
parent
::
setUp
();
}
protected
function
getExisting
()
{
...
...
tests/lib/archive/zip.php
View file @
cb3a598c
...
...
@@ -6,8 +6,15 @@
* See the COPYING-README file.
*/
if
(
!
OC_Util
::
runningOnWindows
())
{
class
Test_Archive_ZIP
extends
Test_Archive
{
protected
function
setUp
()
{
parent
::
setUp
();
if
(
OC_Util
::
runningOnWindows
())
{
$this
->
markTestSkipped
(
'[Windows] '
);
}
}
protected
function
getExisting
()
{
$dir
=
OC
::
$SERVERROOT
.
'/tests/data'
;
return
new
OC_Archive_ZIP
(
$dir
.
'/data.zip'
);
...
...
@@ -17,4 +24,3 @@ class Test_Archive_ZIP extends Test_Archive {
return
new
OC_Archive_ZIP
(
OCP\Files
::
tmpFile
(
'.zip'
));
}
}
}
tests/lib/autoloader.php
View file @
cb3a598c
...
...
@@ -8,13 +8,14 @@
namespace
Test
;
class
AutoLoader
extends
\
PHPUnit_Framework_
TestCase
{
class
AutoLoader
extends
TestCase
{
/**
* @var \OC\Autoloader $loader
*/
private
$loader
;
public
function
setUp
()
{
protected
function
setUp
()
{
parent
::
setUp
();
$this
->
loader
=
new
\
OC\AutoLoader
();
}
...
...
tests/lib/avatar.php
View file @
cb3a598c
...
...
@@ -6,12 +6,14 @@
* later.
* See the COPYING-README file.
*/
class
Test_Avatar
extends
PHPUnit_Framework_
TestCase
{
class
Test_Avatar
extends
\
Test\
TestCase
{
private
$user
;
public
function
setUp
()
{
$this
->
user
=
uniqid
();
protected
function
setUp
()
{
parent
::
setUp
();
$this
->
user
=
$this
->
getUniqueID
();
$storage
=
new
\
OC\Files\Storage\Temporary
(
array
());
\
OC\Files\Filesystem
::
mount
(
$storage
,
array
(),
'/'
.
$this
->
user
.
'/'
);
}
...
...
tests/lib/cache.php
View file @
cb3a598c
...
...
@@ -6,16 +6,17 @@
* See the COPYING-README file.
*/
abstract
class
Test_Cache
extends
PHPUnit_Framework_
TestCase
{
abstract
class
Test_Cache
extends
\
Test\
TestCase
{
/**
* @var \OC\Cache cache;
*/
protected
$instance
;
p
ublic
function
tearDown
()
{
p
rotected
function
tearDown
()
{
if
(
$this
->
instance
)
{
$this
->
instance
->
clear
();
}
parent
::
tearDown
();
}
function
testSimple
()
{
...
...
tests/lib/cache/file.php
View file @
cb3a598c
...
...
@@ -33,8 +33,10 @@ class FileCache extends \Test_Cache {
function
skip
()
{
//$this->skipUnless(OC_User::isLoggedIn());
}
public
function
setUp
()
{
protected
function
setUp
()
{
parent
::
setUp
();
//clear all proxies and hooks so we can do clean testing
\
OC_FileProxy
::
clearProxies
();
\
OC_Hook
::
clear
(
'OC_Filesystem'
);
...
...
@@ -70,7 +72,7 @@ class FileCache extends \Test_Cache {
$this
->
instance
=
new
\
OC\Cache\File
();
}
p
ublic
function
tearDown
()
{
p
rotected
function
tearDown
()
{
\
OC_User
::
setUserId
(
$this
->
user
);
\
OC_Config
::
setValue
(
'cachedirectory'
,
$this
->
datadir
);
...
...
tests/lib/cache/usercache.php
View file @
cb3a598c
...
...
@@ -30,7 +30,9 @@ class UserCache extends \Test_Cache {
/** @var \OC\Files\Storage\Storage */
private
$storage
;
public
function
setUp
()
{
protected
function
setUp
()
{
parent
::
setUp
();
//clear all proxies and hooks so we can do clean testing
\
OC_FileProxy
::
clearProxies
();
\
OC_Hook
::
clear
(
'OC_Filesystem'
);
...
...
@@ -66,7 +68,7 @@ class UserCache extends \Test_Cache {
$this
->
instance
=
new
\
OC\Cache\UserCache
();
}
p
ublic
function
tearDown
()
{
p
rotected
function
tearDown
()
{
\
OC_User
::
setUserId
(
$this
->
user
);
\
OC_Config
::
setValue
(
'cachedirectory'
,
$this
->
datadir
);
...
...
tests/lib/config.php
View file @
cb3a598c
...
...
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
class
Test_Config
extends
PHPUnit_Framework_
TestCase
{
class
Test_Config
extends
\
Test\
TestCase
{
const
TESTCONTENT
=
'<?php $CONFIG=array("foo"=>"bar", "beers" => array("Appenzeller", "Guinness", "Kölsch"), "alcohol_free" => false);'
;
/** @var array */
...
...
@@ -18,15 +18,18 @@ class Test_Config extends PHPUnit_Framework_TestCase {
/** @var string */
private
$randomTmpDir
;
function
setUp
()
{
protected
function
setUp
()
{
parent
::
setUp
();
$this
->
randomTmpDir
=
\
OC_Helper
::
tmpFolder
();
$this
->
configFile
=
$this
->
randomTmpDir
.
'testconfig.php'
;
file_put_contents
(
$this
->
configFile
,
self
::
TESTCONTENT
);
$this
->
config
=
new
OC\Config
(
$this
->
randomTmpDir
,
'testconfig.php'
);
}
p
ublic
function
tearDown
()
{
p
rotected
function
tearDown
()
{
unlink
(
$this
->
configFile
);
parent
::
tearDown
();
}
public
function
testGetKeys
()
{
...
...
tests/lib/db.php
View file @
cb3a598c
...
...
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
class
Test_DB
extends
PHPUnit_Framework_
TestCase
{
class
Test_DB
extends
\
Test\
TestCase
{
protected
$backupGlobals
=
FALSE
;
protected
static
$schema_file
=
'static://test_db_scheme'
;
...
...
@@ -32,7 +32,9 @@ class Test_DB extends PHPUnit_Framework_TestCase {
*/
private
$table4
;
public
function
setUp
()
{
protected
function
setUp
()
{
parent
::
setUp
();
$dbfile
=
OC
::
$SERVERROOT
.
'/tests/data/db_structure.xml'
;
$r
=
'_'
.
OC_Util
::
generateRandomBytes
(
4
)
.
'_'
;
...
...
@@ -48,9 +50,11 @@ class Test_DB extends PHPUnit_Framework_TestCase {
$this
->
table4
=
$this
->
test_prefix
.
'decimal'
;
}
p
ublic
function
tearDown
()
{
p
rotected
function
tearDown
()
{
OC_DB
::
removeDBStructure
(
self
::
$schema_file
);
unlink
(
self
::
$schema_file
);
parent
::
tearDown
();
}
public
function
testQuotes
()
{
...
...
tests/lib/dbschema.php
View file @
cb3a598c
...
...
@@ -9,13 +9,15 @@
use
OCP\Security\ISecureRandom
;
class
Test_DBSchema
extends
PHPUnit_Framework_
TestCase
{
class
Test_DBSchema
extends
\
Test\
TestCase
{
protected
$schema_file
=
'static://test_db_scheme'
;
protected
$schema_file2
=
'static://test_db_scheme2'
;
protected
$table1
;
protected
$table2
;
public
function
setUp
()
{
protected
function
setUp
()
{
parent
::
setUp
();
$dbfile
=
OC
::
$SERVERROOT
.
'/tests/data/db_structure.xml'
;
$dbfile2
=
OC
::
$SERVERROOT
.
'/tests/data/db_structure2.xml'
;
...
...
@@ -32,9 +34,11 @@ class Test_DBSchema extends PHPUnit_Framework_TestCase {
$this
->
table2
=
$r
.
'cntcts_cards'
;
}
p
ublic
function
tearDown
()
{
p
rotected
function
tearDown
()
{
unlink
(
$this
->
schema_file
);
unlink
(
$this
->
schema_file2
);
parent
::
tearDown
();
}
// everything in one test, they depend on each other
...
...
tests/lib/errorHandler.php
View file @
cb3a598c
...
...
@@ -20,7 +20,7 @@
*
*/
class
Test_ErrorHandler
extends
\
PHPUnit_Framework_
TestCase
{
class
Test_ErrorHandler
extends
\
Test\
TestCase
{
/**
* provide username, password combinations for testRemovePassword
...
...
tests/lib/geo.php
View file @
cb3a598c
...
...
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
class
Test_Geo
extends
PHPUnit_Framework_
TestCase
{
class
Test_Geo
extends
\
Test\
TestCase
{
/**
* @medium
...
...
tests/lib/helper.php
View file @
cb3a598c
...
...
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
class
Test_Helper
extends
PHPUnit_Framework_
TestCase
{
class
Test_Helper
extends
\
Test\
TestCase
{
/**
* @dataProvider humanFileSizeProvider
...
...
tests/lib/httphelper.php
View file @
cb3a598c
...
...
@@ -6,14 +6,16 @@
* See the COPYING-README file.
*/
class
TestHTTPHelper
extends
\
PHPUnit_Framework_
TestCase
{
class
TestHTTPHelper
extends
\
Test\
TestCase
{
/** @var \OC\AllConfig*/
private
$config
;
/** @var \OC\HTTPHelper */
private
$httpHelperMock
;
function
setUp
()
{
protected
function
setUp
()
{
parent
::
setUp
();
$this
->
config
=
$this
->
getMockBuilder
(
'\OC\AllConfig'
)
->
disableOriginalConstructor
()
->
getMock
();
$this
->
httpHelperMock
=
$this
->
getMockBuilder
(
'\OC\HTTPHelper'
)
...
...
tests/lib/image.php
View file @
cb3a598c
...
...
@@ -6,10 +6,12 @@
* See the COPYING-README file.
*/
class
Test_Image
extends
PHPUnit_Framework_
TestCase
{
class
Test_Image
extends
\
Test\
TestCase
{
public
static
function
tearDownAfterClass
()
{
@
unlink
(
OC
::
$SERVERROOT
.
'/tests/data/testimage2.png'
);
@
unlink
(
OC
::
$SERVERROOT
.
'/tests/data/testimage2.jpg'
);
parent
::
tearDownAfterClass
();
}
public
function
testGetMimeTypeForFile
()
{
...
...
Prev
1
2
3
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment