19 declare(strict_types=1);
    30         $this->assertInstanceOf(
'ilMathJax', $mathjax);
    37     public function testClientSideRendering(
int $limiter, 
string $input, ?
string $start, ?
string $end, 
string $expected): void
    39         $config = $this->
getEmptyConfig()->withClientEnabled(
true)->withClientLimiter($limiter);
    41         $result = $mathjax->insertLatexImages($input, $start, $end);
    42         $this->assertEquals($expected, $result, 
'input: ' . $input);
    48             [0, 
'[tex]e=m*c^2[/tex]', null, null, 
'\(e=m*c^2\)'],
    49             [1, 
'[tex]e=m*c^2[/tex]', null, null, 
'[tex]e=m*c^2[/tex]'],
    50             [2, 
'[tex]e=m*c^2[/tex]', null, null, 
'<span class="math">e=m*c^2</span>'],
    51             [1, 
'<span class="math">e=m*c^2</span>', 
'<span class="math">', 
'</span>', 
'[tex]e=m*c^2[/tex]'],
    52             [0, 
'[tex]e=m*c^2[/tex][tex]e=m*c^2[/tex]', null, null, 
'\(e=m*c^2\)\(e=m*c^2\)'],
    54             [0, 
'[tex]e=m*c^2[/tex]#[tex]e=m*c^2[/tex]', null, null, 
'\(e=m*c^2\)#\(e=m*c^2\)'],
    55             [0, 
'#[tex]e=m*c^2[/tex]#[tex]e=m*c^2[/tex]', null, null, 
'#\(e=m*c^2\)#\(e=m*c^2\)'],
    56             [0, 
'#[tex]e=m*c^2[/tex]#[tex]e=m*c^2[/tex]#', null, null, 
'#\(e=m*c^2\)#\(e=m*c^2\)#'],
    58             [0, 
'[tex]e=m*c^2[/tex]♥[tex]e=m*c^2[/tex]', null, null, 
'\(e=m*c^2\)♥\(e=m*c^2\)'],
    59             [0, 
'♥[tex]e=m*c^2[/tex]♥[tex]e=m*c^2[/tex]', null, null, 
'♥\(e=m*c^2\)♥\(e=m*c^2\)'],
    60             [0, 
'♥[tex]e=m*c^2[/tex]♥[tex]e=m*c^2[/tex]♥', null, null, 
'♥\(e=m*c^2\)♥\(e=m*c^2\)♥'],
    62             [0, 
'[tex]e=m*c^2[tex]e=m*c^2[/tex]', null, null, 
'\(e=m*c^2[tex]e=m*c^2\)'],
    64             [0, 
'[tex]e=m*c^2[/tex][tex]e=m*c^2', null, null, 
'\(e=m*c^2\)[tex]e=m*c^2'],
    74         $input = 
'[tex]f(x)=\int_{-\infty}^x e^{-t^2}dt[/tex]';
    77                        ->withServerEnabled(
true)
    78                        ->withServerForBrowser($purpose == 
'browser')
    79                        ->withServerForExport($purpose == 
'export')
    80                        ->withServerForPdf($purpose == 
'pdf');
    83         $result = $mathjax->insertLatexImages($input);
    84         $head = substr($result, 0, 60);
    85         $this->assertEquals($expected, $head, 
'purpose: ' . $purpose);
    91             [
'browser', 
'example.svg', 
'<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="17.47'],
    92             [
'export', 
'example.svg', 
'<img src="data:image/svg+xml;base64,PHN2ZyB4bWxuczp4bGluaz0i'],
    93             [
'pdf', 
'example.png', 
'<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYA'],
    94             [
'deferred_pdf', null, 
'[tex]f(x)=\int_{-\infty}^x e^{-t^2}dt[/tex]']
 
getFactoryMock(?string $imagefile=null)
Get a factory mockup that will deliver other mockups. 
 
testClientSideRendering(int $limiter, string $input, ?string $start, ?string $end, string $expected)
testInstanceCanBeCreated  clientSideData 
 
testServerSideRendering(string $purpose, ?string $imagefile, string $expected)
testInstanceCanBeCreated  serverSideData 
 
testInstanceCanBeCreated()
 
getEmptyConfig()
Get a config without active settings. 
 
Testing the MathJax class. 
 
static getIndependent(ilMathJaxConfig $config, ilMathJaxFactory $factory)
Get an independent instance with a specific config for use in unit tests or on the mathjax settings p...