X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=tests%2Fsrc%2FBaseObjectTest.php;h=749ae77c2a2554416600e24a485c3c7b73ef50ec;hb=07bd4cec652890a7d4637b7aed6cd804a9fe82ef;hp=f8542f7b38f6e94aa35c3d7e23efc12d464416ef;hpb=8821d33f73785884cfce83e7b23d3ef19cc1bc11;p=friendica.git diff --git a/tests/src/BaseObjectTest.php b/tests/src/BaseObjectTest.php index f8542f7b38..749ae77c2a 100644 --- a/tests/src/BaseObjectTest.php +++ b/tests/src/BaseObjectTest.php @@ -3,10 +3,11 @@ * BaseObjectTest class. */ -namespace Friendica\Test; +namespace Friendica\Test\src; -use Friendica\App; use Friendica\BaseObject; +use Friendica\Test\Util\AppMockTrait; +use Friendica\Test\Util\VFSTrait; use PHPUnit\Framework\TestCase; /** @@ -14,32 +15,37 @@ use PHPUnit\Framework\TestCase; */ class BaseObjectTest extends TestCase { + use VFSTrait; + use AppMockTrait; /** - * Create variables used in tests. + * @var BaseObject */ - protected function setUp() - { - $this->baseObject = new BaseObject(); - } + private $baseObject; /** - * Test the getApp() function. + * Test the setApp() and getApp() function. * @return void */ - public function testGetApp() + public function testGetSetApp() { - $this->assertInstanceOf(App::class, $this->baseObject->getApp()); + $baseObject = new BaseObject(); + $this->setUpVfsDir(); + $this->mockApp($this->root); + + $this->assertNull($baseObject->setApp($this->app)); + $this->assertEquals($this->app, $baseObject->getApp()); } /** - * Test the setApp() function. - * @return void + * Test the getApp() function without App + * @expectedException Friendica\Network\HTTPException\InternalServerErrorException + * @runInSeparateProcess + * @preserveGlobalState disabled */ - public function testSetApp() + public function testGetAppFailed() { - $app = new App(__DIR__ . '/../../'); - $this->assertNull($this->baseObject->setApp($app)); - $this->assertEquals($app, $this->baseObject->getApp()); + $baseObject = new BaseObject(); + $baseObject->getApp(); } }