Fix a lot of notices/warnings/deprecation notes in the test directory

This commit is contained in:
Philipp 2020-10-18 20:31:57 +02:00
parent efaec26b1d
commit d55ecb9288
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
77 changed files with 428 additions and 558 deletions

View file

@ -24,6 +24,7 @@ namespace Friendica\Test\src\Core\Config;
use Friendica\Core\Config\Cache;
use Friendica\Test\MockedTest;
use ParagonIE\HiddenString\HiddenString;
use stdClass;
class CacheTest extends MockedTest
{
@ -300,7 +301,7 @@ class CacheTest extends MockedTest
{
$configCache = new Cache([
'database' => [
'password' => new \stdClass(),
'password' => new stdClass(),
'username' => '',
]
]);

View file

@ -67,7 +67,7 @@ abstract class ConfigTest extends MockedTest
/**
* @return IConfig
*/
public abstract function getInstance();
abstract public function getInstance();
public function dataTests()
{
@ -169,8 +169,11 @@ abstract class ConfigTest extends MockedTest
/**
* Test the configuration load() method
*
* @param array $data
* @param array $load
*/
public function testLoad(array $data, array $possibleCats, array $load)
public function testLoad(array $data, array $load)
{
$this->testedConfig = $this->getInstance();
self::assertInstanceOf(Cache::class, $this->testedConfig->getCache());
@ -251,7 +254,7 @@ abstract class ConfigTest extends MockedTest
/**
* Test the configuration load() method with overwrite
*/
public function testCacheLoadDouble(array $data1, array $data2, array $expect)
public function testCacheLoadDouble(array $data1, array $data2, array $expect = [])
{
$this->testedConfig = $this->getInstance();
self::assertInstanceOf(Cache::class, $this->testedConfig->getCache());

View file

@ -45,8 +45,11 @@ class JitConfigTest extends ConfigTest
/**
* @dataProvider dataConfigLoad
*
* @param array $data
* @param array $load
*/
public function testLoad(array $data, array $possibleCats, array $load)
public function testLoad(array $data, array $load)
{
$this->configModel->shouldReceive('isConnected')
->andReturn(true)
@ -64,13 +67,13 @@ class JitConfigTest extends ConfigTest
->once();
}
parent::testLoad($data, $possibleCats, $load);
parent::testLoad($data, $load);
}
/**
* @dataProvider dataDoubleLoad
*/
public function testCacheLoadDouble(array $data1, array $data2, array $expect)
public function testCacheLoadDouble(array $data1, array $data2, array $expect = [])
{
$this->configModel->shouldReceive('isConnected')
->andReturn(true)
@ -96,7 +99,7 @@ class JitConfigTest extends ConfigTest
->once();
}
parent::testCacheLoadDouble($data1, $data2, $expect);
parent::testCacheLoadDouble($data1, $data2);
// Assert the expected categories
foreach ($data2 as $cat => $data) {

View file

@ -44,8 +44,11 @@ class PreloadConfigTest extends ConfigTest
/**
* @dataProvider dataConfigLoad
*
* @param array $data
* @param array $load
*/
public function testLoad(array $data, array $possibleCats, array $load)
public function testLoad(array $data, array $load)
{
$this->configModel->shouldReceive('isConnected')
->andReturn(true)
@ -55,7 +58,7 @@ class PreloadConfigTest extends ConfigTest
->andReturn($data)
->once();
parent::testLoad($data, $possibleCats, $load);
parent::testLoad($data, $load);
// Assert that every category is loaded everytime
foreach ($data as $cat => $values) {
@ -65,8 +68,11 @@ class PreloadConfigTest extends ConfigTest
/**
* @dataProvider dataDoubleLoad
*
* @param array $data1
* @param array $data2
*/
public function testCacheLoadDouble(array $data1, array $data2, array $expect)
public function testCacheLoadDouble(array $data1, array $data2, array $expect = [])
{
$this->configModel->shouldReceive('isConnected')
->andReturn(true)
@ -76,7 +82,7 @@ class PreloadConfigTest extends ConfigTest
->andReturn($data1)
->once();
parent::testCacheLoadDouble($data1, $data2, $expect);
parent::testCacheLoadDouble($data1, $data2);
// Assert that every category is loaded everytime and is NOT overwritten
foreach ($data1 as $cat => $values) {