ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups 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

ilTermsOfServiceFileSystemDocumentTest::setUp ( )

Definition at line 41 of file ilTermsOfServiceFileSystemDocumentTest.php.

{
vfsStreamWrapper::register();
$root = vfsStreamWrapper::setRoot(new vfsStreamDirectory('root'));
$customizing_dir = vfsStream::newDirectory('Customizing')->at($root);
$this->client_dir = vfsStream::newDirectory('clients/default/agreement')->at($customizing_dir);
$this->global_dir = vfsStream::newDirectory('global/agreement')->at($customizing_dir);
$this->lng = $this->getMockBuilder('ilLanguage')->disableOriginalConstructor()->getMock();
$this->lng->expects($this->any())
->method('getLangKey')
->will($this->returnValue('de'));
$this->lng->expects($this->any())
->method('getDefaultLanguage')
->will($this->returnValue('fr'));
$this->source_files = array(
vfsStream::url(implode('/', array('root', 'Customizing', 'clients', 'default', 'agreement', 'agreement_' . $this->lng->getLangKey() . '.html'))) => $this->lng->getLangKey(),
vfsStream::url(implode('/', array('root', 'Customizing', 'clients', 'default', 'agreement', 'agreement_' . $this->lng->getDefaultLanguage() . '.html'))) => $this->lng->getDefaultLanguage(),
vfsStream::url(implode('/', array('root', 'Customizing', 'clients', 'default', 'agreement', 'agreement_en.html'))) => 'en',
vfsStream::url(implode('/', array('root', 'Customizing', 'global', 'agreement', 'agreement_' . $this->lng->getLangKey() . '.html'))) => $this->lng->getLangKey(),
vfsStream::url(implode('/', array('root', 'Customizing', 'global', 'agreement', 'agreement_' . $this->lng->getDefaultLanguage() . '.html'))) => $this->lng->getDefaultLanguage(),
vfsStream::url(implode('/', array('root', 'Customizing', 'global', 'agreement', 'agreement_en.html'))) => 'en'
);
}
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.

{
vfsStream::newFile('agreement_de.html', 0777)->withContent('phpunit')->at($this->client_dir);
file_put_contents(vfsStream::url('root/Customizing/clients/default/agreement/agreement_de.html'), 'phpunit');
$document->determine();
$this->assertEquals('de', $document->getIso2LanguageCode());
$this->assertTrue($document->hasContent());
$this->assertEquals('phpunit', $document->getContent());
$this->assertEquals(vfsStream::url('root/Customizing/clients/default/agreement/agreement_de.html'), $document->getSource());
}

+ Here is the call graph for this function:

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.

{
vfsStream::newFile('agreement_fr.html', 0777)->withContent('phpunit')->at($this->client_dir);
file_put_contents(vfsStream::url('root/Customizing/clients/default/agreement/agreement_fr.html'), 'phpunit');
$document->determine();
$this->assertEquals('fr', $document->getIso2LanguageCode());
$this->assertTrue($document->hasContent());
$this->assertEquals('phpunit', $document->getContent());
$this->assertEquals(vfsStream::url('root/Customizing/clients/default/agreement/agreement_fr.html'), $document->getSource());
}

+ Here is the call graph for this function:

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.

{
vfsStream::newFile('agreement_en.html', 0777)->withContent('phpunit')->at($this->client_dir);
file_put_contents(vfsStream::url('root/Customizing/clients/default/agreement/agreement_en.html'), 'phpunit');
$document->determine();
$this->assertEquals('en', $document->getIso2LanguageCode());
$this->assertTrue($document->hasContent());
$this->assertEquals('phpunit', $document->getContent());
$this->assertEquals(vfsStream::url('root/Customizing/clients/default/agreement/agreement_en.html'), $document->getSource());
}

+ Here is the call graph for this function:

ilTermsOfServiceFileSystemDocumentTest::testExceptionIsRaisedWhenNoSingableDocumentCouldBeFoundForCurrentLanguage ( )
Parameters
ilTermsOfServiceFileSystemDocument$documentilTermsOfServiceNoSignableDocumentFoundException

Definition at line 82 of file ilTermsOfServiceFileSystemDocumentTest.php.

{
$document = new ilTermsOfServiceFileSystemDocument($this->getMockBuilder('ilLanguage')->disableOriginalConstructor()->getMock());
$document->determine();
}
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.

{
vfsStream::newFile('agreement_de.html', 0777)->withContent('phpunit')->at($this->client_dir);
file_put_contents(vfsStream::url('root/Customizing/global/agreement/agreement_de.html'), 'phpunit');
$document->determine();
$this->assertEquals('de', $document->getIso2LanguageCode());
$this->assertTrue($document->hasContent());
$this->assertEquals('phpunit', $document->getContent());
$this->assertEquals(vfsStream::url('root/Customizing/global/agreement/agreement_de.html'), $document->getSource());
}

+ Here is the call graph for this function:

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.

{
vfsStream::newFile('agreement_fr.html', 0777)->withContent('phpunit')->at($this->client_dir);
file_put_contents(vfsStream::url('root/Customizing/global/agreement/agreement_fr.html'), 'phpunit');
$document->determine();
$this->assertEquals('fr', $document->getIso2LanguageCode());
$this->assertTrue($document->hasContent());
$this->assertEquals('phpunit', $document->getContent());
$this->assertEquals(vfsStream::url('root/Customizing/global/agreement/agreement_fr.html'), $document->getSource());
}

+ Here is the call graph for this function:

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.

{
vfsStream::newFile('agreement_en.html', 0777)->withContent('phpunit')->at($this->client_dir);
file_put_contents(vfsStream::url('root/Customizing/global/agreement/agreement_en.html'), 'phpunit');
$document->determine();
$this->assertEquals('en', $document->getIso2LanguageCode());
$this->assertTrue($document->hasContent());
$this->assertEquals('phpunit', $document->getContent());
$this->assertEquals(vfsStream::url('root/Customizing/global/agreement/agreement_en.html'), $document->getSource());
}

+ Here is the call graph for this function:

ilTermsOfServiceFileSystemDocumentTest::testInstanceCanBeCreated ( )

Definition at line 70 of file ilTermsOfServiceFileSystemDocumentTest.php.

{
$document = new ilTermsOfServiceFileSystemDocument($this->lng);
$this->assertInstanceOf('ilTermsOfServiceSignableDocument', $document);
$document->setSourceFiles($this->source_files);
return $document;
}

Field Documentation

ilTermsOfServiceFileSystemDocumentTest::$backupGlobals = false
protected

Definition at line 16 of file ilTermsOfServiceFileSystemDocumentTest.php.

ilTermsOfServiceFileSystemDocumentTest::$client_dir
protected

Definition at line 21 of file ilTermsOfServiceFileSystemDocumentTest.php.

ilTermsOfServiceFileSystemDocumentTest::$global_dir
protected

Definition at line 26 of file ilTermsOfServiceFileSystemDocumentTest.php.

ilTermsOfServiceFileSystemDocumentTest::$lng
protected

Definition at line 31 of file ilTermsOfServiceFileSystemDocumentTest.php.

ilTermsOfServiceFileSystemDocumentTest::$source_files = array()
protected

Definition at line 36 of file ilTermsOfServiceFileSystemDocumentTest.php.


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