ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilTermsOfServiceFileSystemDocumentTest Class Reference
+ Inheritance diagram for ilTermsOfServiceFileSystemDocumentTest:
+ Collaboration diagram for ilTermsOfServiceFileSystemDocumentTest:

Public Member Functions

 setUp ()
 
 testInstanceCanBeCreated ()
 
 testExceptionIsRaisedWhenNoSingableDocumentCouldBeFoundForCurrentLanguage ()
 ilTermsOfServiceNoSignableDocumentFoundException More...
 
 testClientDocumentCouldBeRetrievedByCurrentLanguage (ilTermsOfServiceFileSystemDocument $document)
 
 testClientDocumentCouldBeRetrievedByDefaultLanguage (ilTermsOfServiceFileSystemDocument $document)
 
 testClientDocumentCouldBeRetrievedByEnglishLanguage (ilTermsOfServiceFileSystemDocument $document)
 
 testGlobalDocumentCouldBeRetrievedByCurrentLanguage (ilTermsOfServiceFileSystemDocument $document)
 
 testGlobalDocumentCouldBeRetrievedByDefaultLanguage (ilTermsOfServiceFileSystemDocument $document)
 
 testGlobalDocumentCouldBeRetrievedByEnglishLanguage (ilTermsOfServiceFileSystemDocument $document)
 

Protected Attributes

 $backupGlobals = false
 
 $client_dir
 
 $global_dir
 
 $lng
 
 $source_files = array()
 

Additional Inherited Members

- Protected Member Functions inherited from ilTermsOfServiceBaseTest
 assertException ($exception_class)
 

Detailed Description

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 13 of file ilTermsOfServiceFileSystemDocumentTest.php.

Member Function Documentation

◆ setUp()

ilTermsOfServiceFileSystemDocumentTest::setUp ( )

Definition at line 43 of file ilTermsOfServiceFileSystemDocumentTest.php.

References array.

44  {
45  $this->lng = $this->getMockBuilder('ilLanguage')->setMethods(array('toJSON', 'getInstalledLanguages', 'getLangKey', 'getDefaultLanguage'))->disableOriginalConstructor()->getMock();
46  $this->lng->expects($this->any())
47  ->method('getLangKey')
48  ->will($this->returnValue('de'));
49  $this->lng->expects($this->any())
50  ->method('getDefaultLanguage')
51  ->will($this->returnValue('fr'));
52 
53  vfs\vfsStreamWrapper::register();
54  $root = vfs\vfsStreamWrapper::setRoot(new vfs\vfsStreamDirectory('root'));
55  $customizing_dir = vfs\vfsStream::newDirectory('Customizing')->at($root);
56  $this->client_dir = vfs\vfsStream::newDirectory('clients/default/agreement')->at($customizing_dir);
57  $this->global_dir = vfs\vfsStream::newDirectory('global/agreement')->at($customizing_dir);
58  $this->source_files = array(
59  vfs\vfsStream::url(implode('/', array('root', 'Customizing', 'clients', 'default', 'agreement', 'agreement_' . $this->lng->getLangKey() . '.html'))) => $this->lng->getLangKey(),
60  vfs\vfsStream::url(implode('/', array('root', 'Customizing', 'clients', 'default', 'agreement', 'agreement_' . $this->lng->getDefaultLanguage() . '.html'))) => $this->lng->getDefaultLanguage(),
61  vfs\vfsStream::url(implode('/', array('root', 'Customizing', 'clients', 'default', 'agreement', 'agreement_en.html'))) => 'en',
62  vfs\vfsStream::url(implode('/', array('root', 'Customizing', 'global', 'agreement', 'agreement_' . $this->lng->getLangKey() . '.html'))) => $this->lng->getLangKey(),
63  vfs\vfsStream::url(implode('/', array('root', 'Customizing', 'global', 'agreement', 'agreement_' . $this->lng->getDefaultLanguage() . '.html'))) => $this->lng->getDefaultLanguage(),
64  vfs\vfsStream::url(implode('/', array('root', 'Customizing', 'global', 'agreement', 'agreement_en.html'))) => 'en'
65  );
66  }
Create styles array
The data for the language used.

◆ testClientDocumentCouldBeRetrievedByCurrentLanguage()

ilTermsOfServiceFileSystemDocumentTest::testClientDocumentCouldBeRetrievedByCurrentLanguage ( ilTermsOfServiceFileSystemDocument  $document)
Parameters
ilTermsOfServiceFileSystemDocument$documenttestInstanceCanBeCreated

Definition at line 95 of file ilTermsOfServiceFileSystemDocumentTest.php.

References ilTermsOfServiceFileSystemDocument\determine(), ilTermsOfServiceFileSystemDocument\getContent(), ilTermsOfServiceFileSystemDocument\getIso2LanguageCode(), ilTermsOfServiceFileSystemDocument\getSource(), ilTermsOfServiceFileSystemDocument\getSourceType(), ilTermsOfServiceFileSystemDocument\hasContent(), and ilTermsOfServiceSignableDocument\SRC_TYPE_FILE_SYSTEM_PATH.

96  {
97  vfs\vfsStream::newFile('agreement_de.html', 0777)->withContent('phpunit')->at($this->client_dir);
98  file_put_contents(vfs\vfsStream::url('root/Customizing/clients/default/agreement/agreement_de.html'), 'phpunit');
99 
100  $document->determine();
101  $this->assertEquals('de', $document->getIso2LanguageCode());
102  $this->assertTrue($document->hasContent());
103  $this->assertEquals('phpunit', $document->getContent());
105  $this->assertEquals(vfs\vfsStream::url('root/Customizing/clients/default/agreement/agreement_de.html'), $document->getSource());
106  }
+ Here is the call graph for this function:

◆ testClientDocumentCouldBeRetrievedByDefaultLanguage()

ilTermsOfServiceFileSystemDocumentTest::testClientDocumentCouldBeRetrievedByDefaultLanguage ( ilTermsOfServiceFileSystemDocument  $document)
Parameters
ilTermsOfServiceFileSystemDocument$documenttestInstanceCanBeCreated

Definition at line 112 of file ilTermsOfServiceFileSystemDocumentTest.php.

References ilTermsOfServiceFileSystemDocument\determine(), ilTermsOfServiceFileSystemDocument\getContent(), ilTermsOfServiceFileSystemDocument\getIso2LanguageCode(), ilTermsOfServiceFileSystemDocument\getSource(), ilTermsOfServiceFileSystemDocument\getSourceType(), ilTermsOfServiceFileSystemDocument\hasContent(), and ilTermsOfServiceSignableDocument\SRC_TYPE_FILE_SYSTEM_PATH.

113  {
114  vfs\vfsStream::newFile('agreement_fr.html', 0777)->withContent('phpunit')->at($this->client_dir);
115  file_put_contents(vfs\vfsStream::url('root/Customizing/clients/default/agreement/agreement_fr.html'), 'phpunit');
116 
117  $document->determine();
118  $this->assertEquals('fr', $document->getIso2LanguageCode());
119  $this->assertTrue($document->hasContent());
120  $this->assertEquals('phpunit', $document->getContent());
122  $this->assertEquals(vfs\vfsStream::url('root/Customizing/clients/default/agreement/agreement_fr.html'), $document->getSource());
123  }
+ Here is the call graph for this function:

◆ testClientDocumentCouldBeRetrievedByEnglishLanguage()

ilTermsOfServiceFileSystemDocumentTest::testClientDocumentCouldBeRetrievedByEnglishLanguage ( ilTermsOfServiceFileSystemDocument  $document)
Parameters
ilTermsOfServiceFileSystemDocument$documenttestInstanceCanBeCreated

Definition at line 129 of file ilTermsOfServiceFileSystemDocumentTest.php.

References ilTermsOfServiceFileSystemDocument\determine(), ilTermsOfServiceFileSystemDocument\getContent(), ilTermsOfServiceFileSystemDocument\getIso2LanguageCode(), ilTermsOfServiceFileSystemDocument\getSource(), ilTermsOfServiceFileSystemDocument\getSourceType(), ilTermsOfServiceFileSystemDocument\hasContent(), and ilTermsOfServiceSignableDocument\SRC_TYPE_FILE_SYSTEM_PATH.

130  {
131  vfs\vfsStream::newFile('agreement_en.html', 0777)->withContent('phpunit')->at($this->client_dir);
132  file_put_contents(vfs\vfsStream::url('root/Customizing/clients/default/agreement/agreement_en.html'), 'phpunit');
133 
134  $document->determine();
135  $this->assertEquals('en', $document->getIso2LanguageCode());
136  $this->assertTrue($document->hasContent());
137  $this->assertEquals('phpunit', $document->getContent());
139  $this->assertEquals(vfs\vfsStream::url('root/Customizing/clients/default/agreement/agreement_en.html'), $document->getSource());
140  }
+ Here is the call graph for this function:

◆ testExceptionIsRaisedWhenNoSingableDocumentCouldBeFoundForCurrentLanguage()

ilTermsOfServiceFileSystemDocumentTest::testExceptionIsRaisedWhenNoSingableDocumentCouldBeFoundForCurrentLanguage ( )

ilTermsOfServiceNoSignableDocumentFoundException

Definition at line 83 of file ilTermsOfServiceFileSystemDocumentTest.php.

References array, and ilTermsOfServiceBaseTest\assertException().

84  {
85  $this->assertException(ilTermsOfServiceNoSignableDocumentFoundException::class);
86  $document = new ilTermsOfServiceFileSystemDocument($this->getMockBuilder('ilLanguage')->setMethods(array('getLangKey', 'getDefaultLanguage', 'toJSON', 'getInstalledLanguages'))->disableOriginalConstructor()->getMock());
87  $document->setSourceFiles(array());
88  $document->determine();
89  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ testGlobalDocumentCouldBeRetrievedByCurrentLanguage()

ilTermsOfServiceFileSystemDocumentTest::testGlobalDocumentCouldBeRetrievedByCurrentLanguage ( ilTermsOfServiceFileSystemDocument  $document)
Parameters
ilTermsOfServiceFileSystemDocument$documenttestInstanceCanBeCreated

Definition at line 146 of file ilTermsOfServiceFileSystemDocumentTest.php.

References ilTermsOfServiceFileSystemDocument\determine(), ilTermsOfServiceFileSystemDocument\getContent(), ilTermsOfServiceFileSystemDocument\getIso2LanguageCode(), ilTermsOfServiceFileSystemDocument\getSource(), ilTermsOfServiceFileSystemDocument\getSourceType(), ilTermsOfServiceFileSystemDocument\hasContent(), and ilTermsOfServiceSignableDocument\SRC_TYPE_FILE_SYSTEM_PATH.

147  {
148  vfs\vfsStream::newFile('agreement_de.html', 0777)->withContent('phpunit')->at($this->client_dir);
149  file_put_contents(vfs\vfsStream::url('root/Customizing/global/agreement/agreement_de.html'), 'phpunit');
150 
151  $document->determine();
152  $this->assertEquals('de', $document->getIso2LanguageCode());
153  $this->assertTrue($document->hasContent());
154  $this->assertEquals('phpunit', $document->getContent());
156  $this->assertEquals(vfs\vfsStream::url('root/Customizing/global/agreement/agreement_de.html'), $document->getSource());
157  }
+ Here is the call graph for this function:

◆ testGlobalDocumentCouldBeRetrievedByDefaultLanguage()

ilTermsOfServiceFileSystemDocumentTest::testGlobalDocumentCouldBeRetrievedByDefaultLanguage ( ilTermsOfServiceFileSystemDocument  $document)
Parameters
ilTermsOfServiceFileSystemDocument$documenttestInstanceCanBeCreated

Definition at line 163 of file ilTermsOfServiceFileSystemDocumentTest.php.

References ilTermsOfServiceFileSystemDocument\determine(), ilTermsOfServiceFileSystemDocument\getContent(), ilTermsOfServiceFileSystemDocument\getIso2LanguageCode(), ilTermsOfServiceFileSystemDocument\getSource(), ilTermsOfServiceFileSystemDocument\getSourceType(), ilTermsOfServiceFileSystemDocument\hasContent(), and ilTermsOfServiceSignableDocument\SRC_TYPE_FILE_SYSTEM_PATH.

164  {
165  vfs\vfsStream::newFile('agreement_fr.html', 0777)->withContent('phpunit')->at($this->client_dir);
166  file_put_contents(vfs\vfsStream::url('root/Customizing/global/agreement/agreement_fr.html'), 'phpunit');
167 
168  $document->determine();
169  $this->assertEquals('fr', $document->getIso2LanguageCode());
170  $this->assertTrue($document->hasContent());
171  $this->assertEquals('phpunit', $document->getContent());
173  $this->assertEquals(vfs\vfsStream::url('root/Customizing/global/agreement/agreement_fr.html'), $document->getSource());
174  }
+ Here is the call graph for this function:

◆ testGlobalDocumentCouldBeRetrievedByEnglishLanguage()

ilTermsOfServiceFileSystemDocumentTest::testGlobalDocumentCouldBeRetrievedByEnglishLanguage ( ilTermsOfServiceFileSystemDocument  $document)
Parameters
ilTermsOfServiceFileSystemDocument$documenttestInstanceCanBeCreated

Definition at line 180 of file ilTermsOfServiceFileSystemDocumentTest.php.

References ilTermsOfServiceFileSystemDocument\determine(), ilTermsOfServiceFileSystemDocument\getContent(), ilTermsOfServiceFileSystemDocument\getIso2LanguageCode(), ilTermsOfServiceFileSystemDocument\getSource(), ilTermsOfServiceFileSystemDocument\getSourceType(), ilTermsOfServiceFileSystemDocument\hasContent(), and ilTermsOfServiceSignableDocument\SRC_TYPE_FILE_SYSTEM_PATH.

181  {
182  vfs\vfsStream::newFile('agreement_en.html', 0777)->withContent('phpunit')->at($this->client_dir);
183  file_put_contents(vfs\vfsStream::url('root/Customizing/global/agreement/agreement_en.html'), 'phpunit');
184 
185  $document->determine();
186  $this->assertEquals('en', $document->getIso2LanguageCode());
187  $this->assertTrue($document->hasContent());
188  $this->assertEquals('phpunit', $document->getContent());
190  $this->assertEquals(vfs\vfsStream::url('root/Customizing/global/agreement/agreement_en.html'), $document->getSource());
191  }
+ Here is the call graph for this function:

◆ testInstanceCanBeCreated()

ilTermsOfServiceFileSystemDocumentTest::testInstanceCanBeCreated ( )

Definition at line 71 of file ilTermsOfServiceFileSystemDocumentTest.php.

72  {
73  $document = new ilTermsOfServiceFileSystemDocument($this->lng);
74  $this->assertInstanceOf('ilTermsOfServiceSignableDocument', $document);
75  $this->assertTrue($document->exists());
76  $document->setSourceFiles($this->source_files);
77  return $document;
78  }

Field Documentation

◆ $backupGlobals

ilTermsOfServiceFileSystemDocumentTest::$backupGlobals = false
protected

Definition at line 18 of file ilTermsOfServiceFileSystemDocumentTest.php.

◆ $client_dir

ilTermsOfServiceFileSystemDocumentTest::$client_dir
protected

Definition at line 23 of file ilTermsOfServiceFileSystemDocumentTest.php.

◆ $global_dir

ilTermsOfServiceFileSystemDocumentTest::$global_dir
protected

Definition at line 28 of file ilTermsOfServiceFileSystemDocumentTest.php.

◆ $lng

ilTermsOfServiceFileSystemDocumentTest::$lng
protected

Definition at line 33 of file ilTermsOfServiceFileSystemDocumentTest.php.

◆ $source_files

ilTermsOfServiceFileSystemDocumentTest::$source_files = array()
protected

Definition at line 38 of file ilTermsOfServiceFileSystemDocumentTest.php.


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