ILIAS  release_8 Revision v8.24
ilMathJaxBaseTest Class Reference

Base class for al tests. More...

+ Inheritance diagram for ilMathJaxBaseTest:
+ Collaboration diagram for ilMathJaxBaseTest:

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 ilMathJaxBaseTest.php.

Member Function Documentation

◆ getEmptyConfig()

ilMathJaxBaseTest::getEmptyConfig ( )
protected

Get a config without active settings.

Definition at line 31 of file ilMathJaxBaseTest.php.

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.

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

+ Here is the caller graph for this function:

◆ getFactoryMock()

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

Get a factory mockup that will deliver other mockups.

Definition at line 50 of file ilMathJaxBaseTest.php.

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.
getServerMock()
Get a mockup of the class for server calls.
Factory for objects used by ilMathJax.
$factory
Definition: metadata.php:75

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getImageMock()

ilMathJaxBaseTest::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 ilMathJaxBaseTest.php.

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...

Referenced by getFactoryMock().

+ Here is the caller graph for this function:

◆ getServerMock()

ilMathJaxBaseTest::getServerMock ( )
protected

Get a mockup of the class for server calls.

Definition at line 99 of file ilMathJaxBaseTest.php.

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

References $server.

Referenced by getFactoryMock().

+ Here is the caller graph for this function:

◆ getTemplateMock()

ilMathJaxBaseTest::getTemplateMock ( )
protected

Get a global template mockup.

Definition at line 68 of file ilMathJaxBaseTest.php.

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

Referenced by getFactoryMock().

+ Here is the caller graph for this function:

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