Debian Codegraph @

tests/phpunit/unit/includes/parser/Parsoid/ParsoidParserFactoryTest.php

raw symbols SCIP
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 *
18 * @file
19 * @since 1.42
20 */
21
22 namespace MediaWiki\Tests\Parser\Parsoid;
23
24 use MediaWiki\Languages\LanguageConverterFactory;
25 use MediaWiki\Parser\ParserFactory;
26 use MediaWiki\Parser\Parsoid\Config\PageConfigFactory;
27 use MediaWiki\Parser\Parsoid\ParsoidParser;
28 use MediaWiki\Parser\Parsoid\ParsoidParserFactory;
29 use MediaWikiUnitTestCase;
30 use Wikimedia\Parsoid\Config\DataAccess;
31 use Wikimedia\Parsoid\Config\SiteConfig;
32 use Wikimedia\UUID\GlobalIdGenerator;
33
34 /**
35 * $group Parsoid
36 * @covers \MediaWiki\Parser\Parsoid\ParsoidParserFactory
37 */
38 class ParsoidParserFactoryTest extends MediaWikiUnitTestCase {
39
40 protected SiteConfig $siteConfig;
41 protected DataAccess $dataAccess;
42 protected PageConfigFactory $pageConfigFactory;
43 protected LanguageConverterFactory $languageConverterFactory;
44 protected ParserFactory $legacyParserFactory;
45 protected GlobalIdGenerator $globalIdGenerator;
46
47 protected function setUp(): void {
48 parent::setUp();
49 $this->siteConfig = $this->createMock( SiteConfig::class );
50 $this->dataAccess = $this->createMock( DataAccess::class );
51 $this->pageConfigFactory = $this->createMock( PageConfigFactory::class );
52 $this->languageConverterFactory = $this->createMock( LanguageConverterFactory::class );
53 $this->legacyParserFactory = $this->createMock( ParserFactory::class );
54 $this->globalIdGenerator = $this->createMock( GlobalIdGenerator::class );
55 }
56
57 public function testCreate() {
58 $factory = new ParsoidParserFactory(
59 $this->siteConfig,
60 $this->dataAccess,
61 $this->pageConfigFactory,
62 $this->languageConverterFactory,
63 $this->legacyParserFactory,
64 $this->globalIdGenerator
65 );
66 $this->assertInstanceOf( ParsoidParser::class, $factory->create() );
67 }
68 }