mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 13:12:41 +00:00
Tests for bootstrapper
This commit is contained in:
parent
7ac4fb4715
commit
bad86cedb3
2 changed files with 48 additions and 0 deletions
47
tests/cases/TestArsse.php
Normal file
47
tests/cases/TestArsse.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/** @license MIT
|
||||
* Copyright 2017 J. King, Dustin Wilson et al.
|
||||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace JKingWeb\Arsse\TestCase;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
use JKingWeb\Arsse\Conf;
|
||||
use JKingWeb\Arsse\Lang;
|
||||
use JKingWeb\Arsse\User;
|
||||
use JKingWeb\Arsse\Database;
|
||||
use JKingWeb\Arsse\Service;
|
||||
|
||||
/** @covers \JKingWeb\Arsse\Arsse */
|
||||
class TestArsse extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||
public function setUp() {
|
||||
self::clearData(false);
|
||||
}
|
||||
public function tearDown() {
|
||||
self::clearData();
|
||||
}
|
||||
|
||||
public function testLoadExistingData() {
|
||||
$lang = Arsse::$lang = \Phake::mock(Lang::class);
|
||||
$db = Arsse::$db = \Phake::mock(Database::class);
|
||||
$user = Arsse::$user = \Phake::mock(User::class);
|
||||
$conf1 = Arsse::$conf = \Phake::mock(Conf::class);
|
||||
$conf2 = (new Conf)->import(['lang' => "test"]);
|
||||
Arsse::load($conf2);
|
||||
$this->assertSame($conf2, Arsse::$conf);
|
||||
$this->assertSame($lang, Arsse::$lang);
|
||||
$this->assertSame($db, Arsse::$db);
|
||||
$this->assertSame($user, Arsse::$user);
|
||||
\Phake::verify($lang)->set("test");
|
||||
}
|
||||
|
||||
public function testLoadNewData() {
|
||||
$conf = (new Conf)->import(['dbSQLite3File' => ":memory:"]);
|
||||
Arsse::load($conf);
|
||||
$this->assertInstanceOf(Conf::class, Arsse::$conf);
|
||||
$this->assertInstanceOf(Lang::class, Arsse::$lang);
|
||||
$this->assertInstanceOf(Database::class, Arsse::$db);
|
||||
$this->assertInstanceOf(User::class, Arsse::$user);
|
||||
}
|
||||
}
|
|
@ -129,6 +129,7 @@
|
|||
<testsuite name="Admin tools">
|
||||
<file>cases/Service/TestService.php</file>
|
||||
<file>cases/CLI/TestCLI.php</file>
|
||||
<file>cases/TestArsse.php</file>
|
||||
</testsuite>
|
||||
<testsuite name="Import/Export">
|
||||
<file>cases/ImportExport/TestFile.php</file>
|
||||
|
|
Loading…
Reference in a new issue