Debian Codegraph @

extensions/Math/tests/phpunit/unit/WikiTexVC/Nodes/Fun2sqTest.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Extension\Math\Tests\WikiTexVC\Nodes;
4
5 use ArgumentCountError;
6 use MediaWiki\Extension\Math\WikiTexVC\Nodes\Fun2sq;
7 use MediaWiki\Extension\Math\WikiTexVC\Nodes\Literal;
8 use MediaWikiUnitTestCase;
9 use TypeError;
10
11 /**
12 * @covers \MediaWiki\Extension\Math\WikiTexVC\Nodes\Fun2sq
13 */
14 class Fun2sqTest extends MediaWikiUnitTestCase {
15
16 public function testEmptyFun2sq() {
17 $this->expectException( ArgumentCountError::class );
18 new Fun2sq();
19 throw new ArgumentCountError( 'Should not create an empty fun2sq' );
20 }
21
22 public function testOneArgumentFun2sq() {
23 $this->expectException( ArgumentCountError::class );
24 new Fun2sq( '\\f' );
25 throw new ArgumentCountError( 'Should not create a fun2sq with one argument' );
26 }
27
28 public function testIncorrectTypeFun2sq() {
29 $this->expectException( TypeError::class );
30 new Fun2sq( '\\f', 'x', 'y' );
31 throw new TypeError( 'Should not create a fun2sq with incorrect type' );
32 }
33
34 public function testBasicFunctionFun2sq() {
35 $f = new Fun2sq( '\\f', new Literal( 'a' ), new Literal( 'b' ) );
36 $this->assertEquals( '{\\f[a]{b}}', $f->render(), 'Should create a basic function' );
37 }
38
39 public function testCurliesFun2sq() {
40 $f = new Fun2sq( '\\f', new Literal( 'a' ), new Literal( 'b' ) );
41 $this->assertEquals( '{\\f[a]{b}}', $f->inCurlies(),
42 'Should create exactly one set of curlies' );
43 }
44 }