]> git.mxchange.org Git - friendica.git/blob - tests/src/BaseObjectTest.php
Config FollowUp
[friendica.git] / tests / src / BaseObjectTest.php
1 <?php
2 /**
3  * BaseObjectTest class.
4  */
5
6 namespace Friendica\Test;
7
8 use Friendica\BaseObject;
9 use Friendica\Test\Util\AppMockTrait;
10 use Friendica\Test\Util\VFSTrait;
11 use PHPUnit\Framework\TestCase;
12
13 /**
14  * Tests for the BaseObject class.
15  */
16 class BaseObjectTest extends TestCase
17 {
18         use VFSTrait;
19         use AppMockTrait;
20
21         /**
22          * @var BaseObject
23          */
24         private $baseObject;
25
26         /**
27          * Test the setApp() and getApp() function.
28          * @return void
29          */
30         public function testGetSetApp()
31         {
32                 $baseObject = new BaseObject();
33                 $this->setUpVfsDir();
34                 $configMock = \Mockery::mock('Friendica\Core\Config\Configuration');
35                 $this->mockApp($this->root, $configMock);
36
37                 $this->assertNull($baseObject->setApp($this->app));
38                 $this->assertEquals($this->app, $baseObject->getApp());
39         }
40
41         /**
42          * Test the getApp() function without App
43          * @expectedException Friendica\Network\HTTPException\InternalServerErrorException
44          * @runInSeparateProcess
45          * @preserveGlobalState disabled
46          */
47         public function testGetAppFailed()
48         {
49                 $baseObject = new BaseObject();
50                 $baseObject->getApp();
51         }
52 }