]> git.mxchange.org Git - friendica.git/blobdiff - tests/Util/AppMockTrait.php
Merge pull request #10813 from tobiasd/20211003-lengthcounter
[friendica.git] / tests / Util / AppMockTrait.php
index 6e929e5f218c1bc383081ef0808b12c445651a9d..4266a4a0238c9fafea32882a102bafa15443a148 100644 (file)
@@ -1,4 +1,23 @@
 <?php
+/**
+ * @copyright Copyright (C) 2010-2021, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 namespace Friendica\Test\Util;
 
@@ -6,6 +25,7 @@ use Dice\Dice;
 use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\DI;
+use Friendica\Network\HTTPException\InternalServerErrorException;
 use Friendica\Render\FriendicaSmartyEngine;
 use Friendica\Util\Profiler;
 use Mockery\MockInterface;
@@ -45,7 +65,9 @@ trait AppMockTrait
         * Mock the App
         *
         * @param vfsStreamDirectory $root The root directory
-        * @param bool $raw If true, no config mocking will be done
+        * @param bool               $raw  If true, no config mocking will be done
+        *
+        * @throws InternalServerErrorException
         */
        public function mockApp(vfsStreamDirectory $root, $raw = false)
        {
@@ -79,6 +101,8 @@ trait AppMockTrait
                        ->andReturn($root->url());
 
                $this->profilerMock = \Mockery::mock(Profiler::class);
+               $this->profilerMock->shouldReceive('startRecording');
+               $this->profilerMock->shouldReceive('stopRecording');
                $this->profilerMock->shouldReceive('saveTimestamp');
                $this->dice->shouldReceive('create')
                           ->with(Profiler::class)
@@ -89,11 +113,17 @@ trait AppMockTrait
                        ->andReturn($this->configMock);
                $this->app
                        ->shouldReceive('getTemplateEngine')
-                       ->andReturn(new FriendicaSmartyEngine());
+                       ->andReturn(new FriendicaSmartyEngine('frio', []));
                $this->app
                        ->shouldReceive('getCurrentTheme')
                        ->andReturn('Smarty3');
-
+               $this->app->shouldReceive('getThemeInfoValue')
+                       ->with('videowidth')
+                       ->andReturn(425);
+               $this->app->shouldReceive('getThemeInfoValue')
+                       ->with('videoheight')
+                       ->andReturn(350);
+       
                DI::init($this->dice);
 
                if ($raw) {