"Fossies" - the Fresh Open Source Software Archive

Member "ampache-5.0.0/tests/Module/User/Activity/TypeHandler/ActivityTypeHandlerMapperTest.php" (31 Aug 2021, 2214 Bytes) of package /linux/www/ampache-5.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 <?php
    2 /*
    3  * vim:set softtabstop=4 shiftwidth=4 expandtab:
    4  *
    5  * LICENSE: GNU Affero General Public License, version 3 (AGPL-3.0-or-later)
    6  * Copyright 2001 - 2020 Ampache.org
    7  *
    8  * This program is free software: you can redistribute it and/or modify
    9  * it under the terms of the GNU Affero General Public License as published by
   10  * the Free Software Foundation, either version 3 of the License, or
   11  * (at your option) any later version.
   12  *
   13  * This program is distributed in the hope that it will be useful,
   14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   16  * GNU Affero General Public License for more details.
   17  *
   18  * You should have received a copy of the GNU Affero General Public License
   19  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
   20  *
   21  */
   22 
   23 declare(strict_types=1);
   24 
   25 namespace Ampache\Module\User\Activity\TypeHandler;
   26 
   27 use Ampache\MockeryTestCase;
   28 use Ampache\Repository\Model\ModelFactoryInterface;
   29 use Ampache\Repository\UserActivityRepositoryInterface;
   30 use Mockery\MockInterface;
   31 
   32 class ActivityTypeHandlerMapperTest extends MockeryTestCase
   33 {
   34     /** @var UserActivityRepositoryInterface|MockInterface|null */
   35     private MockInterface $userActivityRepository;
   36 
   37     /** @var ModelFactoryInterface|MockInterface|null */
   38     private MockInterface $modelFactory;
   39 
   40     private ?ActivityTypeHandlerMapper $subject;
   41 
   42     public function setUp(): void
   43     {
   44         $this->userActivityRepository = $this->mock(UserActivityRepositoryInterface::class);
   45         $this->modelFactory           = $this->mock(ModelFactoryInterface::class);
   46 
   47         $this->subject = new ActivityTypeHandlerMapper(
   48             $this->userActivityRepository,
   49             $this->modelFactory
   50         );
   51     }
   52 
   53     public function testMapReturnsSpecificEntry(): void
   54     {
   55         $this->assertInstanceOf(
   56             SongActivityTypeHandler::class,
   57             $this->subject->map(ActivityTypeEnum::TYPE_SONG)
   58         );
   59     }
   60 
   61     public function testMapReturnsGenericEntry(): void
   62     {
   63         $this->assertInstanceOf(
   64             GenericActivityTypeHandler::class,
   65             $this->subject->map('foobar')
   66         );
   67     }
   68 }