Fix a lot of notices/warnings/deprecation notes in the test directory
This commit is contained in:
parent
efaec26b1d
commit
d55ecb9288
77 changed files with 428 additions and 558 deletions
|
|
@ -24,12 +24,13 @@ namespace Friendica\Test\src\App;
|
|||
use Detection\MobileDetect;
|
||||
use Friendica\App\Mode;
|
||||
use Friendica\App\Module;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Config\Cache;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Test\MockedTest;
|
||||
use Friendica\Test\Util\DBAMockTrait;
|
||||
use Friendica\Test\Util\VFSTrait;
|
||||
use Friendica\Util\BasePath;
|
||||
use Mockery;
|
||||
use Mockery\MockInterface;
|
||||
|
||||
class ModeTest extends MockedTest
|
||||
|
|
@ -48,19 +49,19 @@ class ModeTest extends MockedTest
|
|||
private $databaseMock;
|
||||
|
||||
/**
|
||||
* @var \Friendica\Core\Config\Cache|MockInterface
|
||||
* @var Cache|MockInterface
|
||||
*/
|
||||
private $configCacheMock;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->setUpVfsDir();
|
||||
|
||||
$this->basePathMock = \Mockery::mock(BasePath::class);
|
||||
$this->databaseMock = \Mockery::mock(Database::class);
|
||||
$this->configCacheMock = \Mockery::mock(Config\Cache::class);
|
||||
$this->basePathMock = Mockery::mock(BasePath::class);
|
||||
$this->databaseMock = Mockery::mock(Database::class);
|
||||
$this->configCacheMock = Mockery::mock(Cache::class);
|
||||
}
|
||||
|
||||
public function testItEmpty()
|
||||
|
|
@ -280,7 +281,7 @@ class ModeTest extends MockedTest
|
|||
{
|
||||
$server = [];
|
||||
$module = new Module(Module::DEFAULT, Module::DEFAULT_CLASS, [], false);
|
||||
$mobileDetect = \Mockery::mock(MobileDetect::class);
|
||||
$mobileDetect = Mockery::mock(MobileDetect::class);
|
||||
$mobileDetect->shouldReceive('isMobile')->andReturn(true);
|
||||
$mobileDetect->shouldReceive('isTablet')->andReturn(true);
|
||||
|
||||
|
|
@ -298,7 +299,7 @@ class ModeTest extends MockedTest
|
|||
{
|
||||
$server = [];
|
||||
$module = new Module(Module::DEFAULT, Module::DEFAULT_CLASS, [], false);
|
||||
$mobileDetect = \Mockery::mock(MobileDetect::class);
|
||||
$mobileDetect = Mockery::mock(MobileDetect::class);
|
||||
$mobileDetect->shouldReceive('isMobile')->andReturn(false);
|
||||
$mobileDetect->shouldReceive('isTablet')->andReturn(false);
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ use Friendica\LegacyModule;
|
|||
use Friendica\Module\HTTPException\PageNotFound;
|
||||
use Friendica\Module\WellKnown\HostMeta;
|
||||
use Friendica\Test\DatabaseTest;
|
||||
use Mockery;
|
||||
|
||||
class ModuleTest extends DatabaseTest
|
||||
{
|
||||
|
|
@ -170,13 +171,13 @@ class ModuleTest extends DatabaseTest
|
|||
*/
|
||||
public function testModuleClass($assert, string $name, string $command, bool $privAdd)
|
||||
{
|
||||
$config = \Mockery::mock(IConfig::class);
|
||||
$config = Mockery::mock(IConfig::class);
|
||||
$config->shouldReceive('get')->with('config', 'private_addons', false)->andReturn($privAdd)->atMost()->once();
|
||||
|
||||
$l10n = \Mockery::mock(L10n::class);
|
||||
$l10n = Mockery::mock(L10n::class);
|
||||
$l10n->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
|
||||
|
||||
$cache = \Mockery::mock(ICache::class);
|
||||
$cache = Mockery::mock(ICache::class);
|
||||
$cache->shouldReceive('get')->with('routerDispatchData')->andReturn('')->atMost()->once();
|
||||
$cache->shouldReceive('get')->with('lastRoutesFileModifiedTime')->andReturn('')->atMost()->once();
|
||||
$cache->shouldReceive('set')->withAnyArgs()->andReturn(false)->atMost()->twice();
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Module;
|
||||
use Friendica\Network\HTTPException\MethodNotAllowedException;
|
||||
use Friendica\Network\HTTPException\NotFoundException;
|
||||
use Mockery;
|
||||
use Mockery\MockInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
|
|
@ -43,10 +44,10 @@ class RouterTest extends TestCase
|
|||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->l10n = \Mockery::mock(L10n::class);
|
||||
$this->l10n = Mockery::mock(L10n::class);
|
||||
$this->l10n->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
|
||||
|
||||
$this->cache = \Mockery::mock(ICache::class);
|
||||
$this->cache = Mockery::mock(ICache::class);
|
||||
$this->cache->shouldReceive('get')->andReturn(null);
|
||||
$this->cache->shouldReceive('set')->andReturn(false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue