Debian Codegraph @

tests/phpunit/unit/includes/CommentFormatter/StringCommentIteratorTest.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\Unit\CommentFormatter;
23
24 use MediaWiki\CommentFormatter\CommentItem;
25 use MediaWiki\CommentFormatter\StringCommentIterator;
26 use MediaWikiUnitTestCase;
27
28 /**
29 * @group CommentFormatter
30 * @coversDefaultClass \MediaWiki\CommentFormatter\StringCommentIterator
31 */
32 class StringCommentIteratorTest extends MediaWikiUnitTestCase {
33
34 /**
35 * Test that the StringCommentIterator can be instantiated.
36 * @covers ::__construct
37 */
38 public function testConstruct() {
39 // Create an instance of StringCommentIterator with an array of strings
40 $iterator = new StringCommentIterator( [ 'Some comment', 'Another comment' ] );
41
42 // Verify that it is an instance of StringCommentIterator
43 $this->assertInstanceOf( StringCommentIterator::class, $iterator );
44 }
45
46 /**
47 * Test the current method to ensure it returns CommentItem objects.
48 * @covers ::current
49 */
50 public function testCurrent() {
51 // Create an instance of StringCommentIterator with an array of strings
52 $iterator = new StringCommentIterator( [ 'Some comment', 'Another comment' ] );
53
54 // Verify that the current method returns a CommentItem object
55 $this->assertInstanceOf( CommentItem::class, $iterator->current() );
56 }
57 }