assertStringContainsString( '~', $result ); $this->assertStringContainsString( 'mover', $result ); } public function testAccentArgPassing() { $node = new Fun1( '\\widetilde', ( new Literal( 'a' ) ) ); $result = BaseParsing::accent( $node, [ 'k' => 'v' ], null, 'widetilde', '007E' ); $this->assertStringContainsString( 'assertStringContainsString( 'a', $result ); } public function testBoldGreek() { $node = new Fun1( '\\boldsymbol', ( new Literal( '\\alpha' ) ) ); $result = BaseParsing::boldsymbol( $node, [], null, 'boldsymbol' ); $this->assertStringContainsString( 'mathvariant="bold-italic"', $result ); } public function testBoldSymbol() { $node = new Fun1( '\\boldsymbol', ( new Literal( 'a' ) ) ); $result = BaseParsing::boldsymbol( $node, [], null, 'boldsymbol' ); $this->assertStringContainsString( 'mathvariant="bold-italic"', $result ); } public function testCancel() { $node = new Fun1( '\\cancel', ( new Literal( 'a' ) ) ); $result = BaseParsing::cancel( $node, [], null, 'cancel', 'something' ); $this->assertStringContainsString( 'a', $result ); $this->assertStringContainsString( '', $result ); } public function testUnderOver() { $node = new Fun1( '\\overline', ( new Literal( 'a' ) ) ); $result = BaseParsing::underover( $node, [], null, 'oXXX', '00AF' ); $this->assertStringStartsWith( 'assertStringContainsString( 'mover', $result ); } public function testUnderOverUnder() { $node = new Fun1( '\\overline', ( new Literal( 'a' ) ) ); $result = BaseParsing::underover( $node, [], null, 'uXXX', '00AF' ); $this->assertStringContainsString( 'munder', $result ); } public function testUnderOverDqUnder() { $node = new DQ( ( new Literal( 'a' ) ), ( new Literal( 'b' ) ) ); $result = BaseParsing::underover( $node, [], null, 'uXXX', '00AF' ); $this->assertStringContainsString( 'munder', $result ); $this->assertStringContainsString( 'mrow', $result ); } public function testUnderArgPassing() { $node = new Fun1( '\\overline', ( new Literal( 'a' ) ) ); $result = BaseParsing::underover( $node, [ 'k' => 'v' ], null, 'oXXX', '00AF' ); $this->assertStringContainsString( ' '""' ], null, 'oXXX', '00AF' ); $this->assertStringContainsString( 'k=""<script>alert("problem")', $result ); } public function testAlignAt() { $matrix = new Matrix( 'alignat', new TexArray( new TexArray( new Literal( '\\sin' ) ) ) ); $result = BaseParsing::alignAt( $matrix, [], null, 'alignat', '002A' ); $this->assertStringContainsString( 'mtable', $result ); } public function testHLineTop() { $matrix = new Matrix( 'matrix', new TexArray( new TexArray( new TexArray( new Literal( '\\hline ' ), new Literal( 'a' ) ) ) ) ); $result = BaseParsing::matrix( $matrix, [], null, 'matrix', '002A' ); $this->assertStringContainsString( 'top', $result ); } public function testHLineBottom() { $matrix = new Matrix( 'matrix', new TexArray( new TexArray( new Literal( 'a' ) ), new TexArray( new TexArray( new Literal( '\\hline ' ) ) ) ) ); $result = BaseParsing::matrix( $matrix, [], null, 'matrix', '002A' ); $this->assertStringContainsString( 'bottom', $result ); $this->assertStringContainsString( 'a', $result ); } public function testHLineLastLine() { $matrix = new Matrix( 'matrix', new TexArray( new TexArray( new Literal( 'a' ) ), new TexArray( new TexArray( new Literal( '\\hline ' ), new Literal( 'a' ) ) ) ) ); $result = BaseParsing::matrix( $matrix, [], null, 'matrix', '002A' ); $this->assertStringContainsString( 'class="mwe-math-matrix-top"', $result ); $this->assertStringContainsString( 'a', $result ); } public function testComplicatedHline() { $matrix = ( new TexVC() )->parse( '\\begin{array}{c} \\hline a\\\\ \\hline 1\\\\ 2\\\\ \\hline \\end{array}' )[0]; $result = BaseParsing::matrix( $matrix, [], null, 'matrix', '002A' ); $this->assertStringContainsString( 'class="mwe-math-matrix-top"', $result ); $this->assertStringContainsString( 'class="mwe-math-matrix-top mwe-math-matrix-bottom"', $result ); } public function testHandleOperatorName() { $node = new Fun1( '\\operatorname', ( new Literal( 'sn' ) ) ); $result = BaseParsing::handleOperatorName( $node, [], [ "foundNamedFct" => [ true, true ] ], 'operatorname' ); $this->assertStringContainsString( 'sn', $result ); $this->assertStringContainsString( '', $result ); } public function testHandleOperatorLast() { $node = new Fun1( '\\operatorname', ( new Literal( 'sn' ) ) ); $result = BaseParsing::handleOperatorName( $node, [], [ "foundNamedFct" => [ true, false ] ], 'operatorname' ); $this->assertStringContainsString( 'sn', $result ); $this->assertStringNotContainsString( '', $result ); } public function testColumnSpecs() { $matrix = ( new TexVC() )->parse( '\\begin{array}{lcr} z & = & a \\\\ f(x,y,z) & = & x + y + z \\end{array}' )[0]; $result = BaseParsing::matrix( $matrix, [], null, 'matrix', '002A' ); $this->assertStringContainsString( 'left center right ', $result ); } public function testNamedOperator() { $node = new Literal( '\\gcd' ); $result = BaseParsing::namedOp( $node, [], [], '\\gcd' ); $this->assertStringContainsString( '>gcd', $result ); } }