ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilMathJaxBaseTestCase Class Reference

Base class for al tests. More...

+ Inheritance diagram for ilMathJaxBaseTestCase:
+ Collaboration diagram for ilMathJaxBaseTestCase:

Protected Member Functions

 getEmptyConfig ()
 Get a config without active settings. More...
 
 getFactoryMock (?string $imagefile=null)
 Get a factory mockup that will deliver other mockups. More...
 
 getTemplateMock ()
 Get a global template mockup. More...
 
 getImageMock (string $imagefile)
 Get a cached image mockup from an example file. More...
 
 getServerMock ()
 Get a mockup of the class for server calls. More...
 

Detailed Description

Base class for al tests.

Definition at line 26 of file ilMathJaxBaseTestCase.php.

Member Function Documentation

◆ getEmptyConfig()

ilMathJaxBaseTestCase::getEmptyConfig ( )
protected

Get a config without active settings.

Definition at line 31 of file ilMathJaxBaseTestCase.php.

Referenced by ilMathJaxTest\testClientSideRendering(), ilMathJaxTest\testInstanceCanBeCreated(), and ilMathJaxTest\testServerSideRendering().

32  {
33  return new ilMathJaxConfig(
34  false,
35  '',
36  '',
37  0,
38  false,
39  '',
40  0,
41  false,
42  false,
43  false
44  );
45  }
Global Mathjax configuration.
+ Here is the caller graph for this function:

◆ getFactoryMock()

ilMathJaxBaseTestCase::getFactoryMock ( ?string  $imagefile = null)
protected

Get a factory mockup that will deliver other mockups.

Definition at line 50 of file ilMathJaxBaseTestCase.php.

References getImageMock(), getServerMock(), and getTemplateMock().

Referenced by ilMathJaxTest\testClientSideRendering(), ilMathJaxTest\testInstanceCanBeCreated(), and ilMathJaxTest\testServerSideRendering().

51  {
52  $factory = $this
53  ->getMockBuilder(ilMathJaxFactory::class)
54  ->disableOriginalConstructor()
55  ->onlyMethods(['template', 'image', 'server'])
56  ->getMock();
57  $factory->method('template')->willReturn($this->getTemplateMock());
58  $factory->method('server')->willReturn($this->getServerMock());
59  if (isset($imagefile)) {
60  $factory->method('image')->willReturn($this->getImageMock($imagefile));
61  }
62  return $factory;
63  }
getTemplateMock()
Get a global template mockup.
getImageMock(string $imagefile)
Get a cached image mockup from an example file.
Factory for objects used by ilMathJax.
getServerMock()
Get a mockup of the class for server calls.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImageMock()

ilMathJaxBaseTestCase::getImageMock ( string  $imagefile)
protected

Get a cached image mockup from an example file.

Parameters
string$imagefilename of the example file in the test directory

Definition at line 82 of file ilMathJaxBaseTestCase.php.

Referenced by getFactoryMock().

83  {
84  $image = $this
85  ->getMockBuilder(ilMathJaxImage::class)
86  ->disableOriginalConstructor()
87  ->onlyMethods(['exists', 'read', 'write', 'absolutePath', 'getCacheSize'])
88  ->getMock();
89  $image->method('exists')->willReturn(false);
90  $image->method('read')->willReturn(file_get_contents(__DIR__ . '/' . $imagefile));
91  $image->method('absolutePath')->willReturn(__DIR__ . '/' . $imagefile);
92  $image->method('getCacheSize')->willReturn('10 KB');
93  return $image;
94  }
Rendered MathJax image Supports image types SVG or PNG Files are stored in the web file system of ili...
+ Here is the caller graph for this function:

◆ getServerMock()

ilMathJaxBaseTestCase::getServerMock ( )
protected

Get a mockup of the class for server calls.

Definition at line 99 of file ilMathJaxBaseTestCase.php.

References $server.

Referenced by getFactoryMock().

100  {
101  $server = $this
102  ->getMockBuilder(ilMathJaxServer::class)
103  ->disableOriginalConstructor()
104  ->onlyMethods(['call'])
105  ->getMock();
106  $server->method('call')->willReturn('server call result');
107  return $server;
108  }
Class for calling theMathJax server The server calls use cURL, if the extension is loaded...
$server
Definition: shib_login.php:24
+ Here is the caller graph for this function:

◆ getTemplateMock()

ilMathJaxBaseTestCase::getTemplateMock ( )
protected

Get a global template mockup.

Definition at line 68 of file ilMathJaxBaseTestCase.php.

Referenced by getFactoryMock().

69  {
70  $template = $this
71  ->getMockBuilder(ilGlobalTemplate::class)
72  ->disableOriginalConstructor()
73  ->onlyMethods(['addJavaScript'])
74  ->getMock();
75  return $template;
76  }
special template class to simplify handling of ITX/PEAR
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: