ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTermsOfServiceFileSystemDocumentTest Class Reference
+ Inheritance diagram for ilTermsOfServiceFileSystemDocumentTest:
+ Collaboration diagram for ilTermsOfServiceFileSystemDocumentTest:

Public Member Functions

 setUp ()
 
 testInstanceCanBeCreated ()
 
 testExceptionIsRaisedWhenNoSingableDocumentCouldBeFoundForCurrentLanguage ()
 
 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()
 

Detailed Description

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

Definition at line 11 of file ilTermsOfServiceFileSystemDocumentTest.php.

Member Function Documentation

◆ setUp()

ilTermsOfServiceFileSystemDocumentTest::setUp ( )

Definition at line 41 of file ilTermsOfServiceFileSystemDocumentTest.php.

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

◆ testClientDocumentCouldBeRetrievedByCurrentLanguage()

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

Definition at line 92 of file ilTermsOfServiceFileSystemDocumentTest.php.

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

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

◆ testClientDocumentCouldBeRetrievedByDefaultLanguage()

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

Definition at line 109 of file ilTermsOfServiceFileSystemDocumentTest.php.

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

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

◆ testClientDocumentCouldBeRetrievedByEnglishLanguage()

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

Definition at line 126 of file ilTermsOfServiceFileSystemDocumentTest.php.

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

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

◆ testExceptionIsRaisedWhenNoSingableDocumentCouldBeFoundForCurrentLanguage()

ilTermsOfServiceFileSystemDocumentTest::testExceptionIsRaisedWhenNoSingableDocumentCouldBeFoundForCurrentLanguage ( )
Parameters
ilTermsOfServiceFileSystemDocument$documentilTermsOfServiceNoSignableDocumentFoundException

Definition at line 82 of file ilTermsOfServiceFileSystemDocumentTest.php.

83  {
84  $document = new ilTermsOfServiceFileSystemDocument($this->getMockBuilder('ilLanguage')->disableOriginalConstructor()->getMock());
85  $document->determine();
86  }

◆ testGlobalDocumentCouldBeRetrievedByCurrentLanguage()

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

Definition at line 143 of file ilTermsOfServiceFileSystemDocumentTest.php.

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

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

◆ testGlobalDocumentCouldBeRetrievedByDefaultLanguage()

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

Definition at line 160 of file ilTermsOfServiceFileSystemDocumentTest.php.

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

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

◆ testGlobalDocumentCouldBeRetrievedByEnglishLanguage()

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

Definition at line 177 of file ilTermsOfServiceFileSystemDocumentTest.php.

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

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

◆ testInstanceCanBeCreated()

ilTermsOfServiceFileSystemDocumentTest::testInstanceCanBeCreated ( )

Definition at line 70 of file ilTermsOfServiceFileSystemDocumentTest.php.

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

Field Documentation

◆ $backupGlobals

ilTermsOfServiceFileSystemDocumentTest::$backupGlobals = false
protected

Definition at line 16 of file ilTermsOfServiceFileSystemDocumentTest.php.

◆ $client_dir

ilTermsOfServiceFileSystemDocumentTest::$client_dir
protected

Definition at line 21 of file ilTermsOfServiceFileSystemDocumentTest.php.

◆ $global_dir

ilTermsOfServiceFileSystemDocumentTest::$global_dir
protected

Definition at line 26 of file ilTermsOfServiceFileSystemDocumentTest.php.

◆ $lng

ilTermsOfServiceFileSystemDocumentTest::$lng
protected

Definition at line 31 of file ilTermsOfServiceFileSystemDocumentTest.php.

◆ $source_files

ilTermsOfServiceFileSystemDocumentTest::$source_files = array()
protected

Definition at line 36 of file ilTermsOfServiceFileSystemDocumentTest.php.


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