summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/TempFileRoundTripTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/TempFileRoundTripTest.php')
-rw-r--r--www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/TempFileRoundTripTest.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/TempFileRoundTripTest.php b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/TempFileRoundTripTest.php
new file mode 100644
index 00000000..02b62475
--- /dev/null
+++ b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/TempFileRoundTripTest.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace SMW\Tests\Integration;
+
+use SMW\Utils\TempFile;
+
+/**
+ * @group semantic-mediawiki
+ *
+ * @license GNU GPL v2+
+ * @since 3.0
+ *
+ * @author mwjames
+ */
+class TempFileRoundTripTest extends \PHPUnit_Framework_TestCase {
+
+ public function testRoundTrip() {
+
+ $expected = 'Test write file';
+ $tempFile = new TempFile();
+
+ $file = $tempFile->generate( 'Test' );
+
+ $tempFile->write( $file, $expected );
+
+ $this->assertTrue(
+ $tempFile->exists( $file )
+ );
+
+ $this->assertEquals(
+ $expected,
+ $tempFile->read( $file, $tempFile->getCheckSum( $file ) )
+ );
+
+ $tempFile->write( $file, '++plus++', FILE_APPEND );
+
+ $this->assertEquals(
+ $expected . '++plus++',
+ $tempFile->read( $file )
+ );
+
+ $tempFile->delete( $file );
+
+ $this->assertFalse(
+ $tempFile->exists( $file )
+ );
+ }
+
+}