Debian Codegraph @

skins/Vector/tests/phpunit/unit/components/VectorComponentPinnableContainerTest.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\Skins\Vector\Tests\Unit\Components;
23
24 use MediaWiki\Skins\Vector\Components\VectorComponentPinnableContainer;
25 use MediaWikiUnitTestCase;
26
27 /**
28 * @group Vector
29 * @group Components
30 * @coversDefaultClass \MediaWiki\Skins\Vector\Components\VectorComponentPinnableContainer
31 */
32 class VectorComponentPinnableContainerTest extends MediaWikiUnitTestCase {
33
34 /**
35 * @covers ::getTemplateData
36 */
37 public function testGetTemplateData() {
38 // Test initialization with ID and isPinned set to true
39 $mockIdTrue = 'pinned-container';
40 $pinnableContainerTrue = new VectorComponentPinnableContainer( $mockIdTrue, true );
41 $expectedTemplateDataTrue = [
42 'id' => $mockIdTrue,
43 'is-pinned' => true
44 ];
45 // Assert that the actual template data matches the expected array for pinned=true
46 $this->assertSame( $expectedTemplateDataTrue, $pinnableContainerTrue->getTemplateData(),
47 'Template data for a pinned container should correctly include the ID and is-pinned status.' );
48
49 // Test initialization with ID and isPinned set to false
50 $mockIdFalse = 'unpinned-container';
51 $pinnableContainerFalse = new VectorComponentPinnableContainer( $mockIdFalse, false );
52 $expectedTemplateDataFalse = [
53 'id' => $mockIdFalse,
54 'is-pinned' => false
55 ];
56 // Assert that the actual template data matches the expected array for pinned=false
57 $this->assertSame( $expectedTemplateDataFalse, $pinnableContainerFalse->getTemplateData(),
58 'Template data for an unpinned container should accurately reflect a different ID and is-pinned status.' );
59 }
60 }