* BaseObjectTest class.
*/
-namespace Friendica\Test;
+namespace Friendica\Test\src;
-use Friendica\App;
use Friendica\BaseObject;
-use Friendica\Util\Logger;
+use Friendica\Test\Util\AppMockTrait;
+use Friendica\Test\Util\VFSTrait;
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();
- }
-
- /**
- * Test the getApp() function.
- * @return void
- */
- public function testGetApp()
- {
- $this->assertInstanceOf(App::class, $this->baseObject->getApp());
- }
+ private $baseObject;
/**
- * 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()
{
- $logger = $logger = Logger\LoggerFactory::create('test');
- $app = new App(__DIR__ . '/../../', $logger);
- $this->assertNull($this->baseObject->setApp($app));
- $this->assertEquals($app, $this->baseObject->getApp());
+ BaseObject::getApp();
}
}