]> git.mxchange.org Git - friendica.git/blobdiff - tests/src/BaseObjectTest.php
Merge pull request #7398 from annando/fetch-posts
[friendica.git] / tests / src / BaseObjectTest.php
index 2b10556af67d79885342b3f05e88f698b4294ff1..cb980b47e90698639f71a1381ba7c19b046e2db5 100644 (file)
@@ -3,9 +3,8 @@
  * 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;
@@ -13,8 +12,6 @@ use PHPUnit\Framework\TestCase;
 
 /**
  * Tests for the BaseObject class.
- * @runTestsInSeparateProcesses
- * @preserveGlobalState disabled
  */
 class BaseObjectTest extends TestCase
 {
@@ -27,32 +24,27 @@ class BaseObjectTest extends TestCase
        private $baseObject;
 
        /**
-        * Create variables used in tests.
+        * Test the setApp() and getApp() function.
+        * @return void
         */
-       protected function setUp()
+       public function testGetSetApp()
        {
+               $baseObject = new BaseObject();
                $this->setUpVfsDir();
                $this->mockApp($this->root);
 
-               $this->baseObject = new BaseObject();
-       }
-
-       /**
-        * Test the getApp() function.
-        * @return void
-        */
-       public function testGetApp()
-       {
-               $this->assertInstanceOf(App::class, $this->baseObject->getApp());
+               $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()
        {
-               $this->assertNull($this->baseObject->setApp($this->app));
-               $this->assertEquals($this->app, $this->baseObject->getApp());
+               BaseObject::getApp();
        }
 }