Debian Codegraph @

skins/Vector/tests/phpunit/unit/components/VectorComponentPinnableElementTest.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\VectorComponentPinnableElement;
25 use MediaWikiUnitTestCase;
26
27 /**
28 * @group Vector
29 * @group Components
30 * @coversDefaultClass \MediaWiki\Skins\Vector\Components\VectorComponentPinnableElement
31 */
32 class VectorComponentPinnableElementTest extends MediaWikiUnitTestCase {
33
34 /**
35 * @covers ::getTemplateData
36 */
37 public function testGetTemplateData() {
38 // Test with a mock ID
39 $mockId = 'mock-element';
40 $pinnableElement = new VectorComponentPinnableElement( $mockId );
41
42 // Expected template data
43 $expectedTemplateData = [
44 'id' => $mockId,
45 ];
46
47 // Fetching template data for the element
48 $actualTemplateData = $pinnableElement->getTemplateData();
49
50 // Assert that the actual template data matches the expected array
51 $this->assertSame( $expectedTemplateData, $actualTemplateData,
52 'Template data should correctly include the ID.' );
53
54 // Additional test case to verify behavior with different ID
55 $anotherMockId = 'another-mock-element';
56 $anotherPinnableElement = new VectorComponentPinnableElement( $anotherMockId );
57
58 // Fetching template data for the new element
59 $anotherActualTemplateData = $anotherPinnableElement->getTemplateData();
60
61 // Ensuring the new element's template data is as expected
62 $this->assertSame( [ 'id' => $anotherMockId ], $anotherActualTemplateData,
63 'Template data should accurately reflect a different ID.' );
64 }
65 }