diff --git a/.idea/php.xml b/.idea/php.xml
index 3cf5373..c63a823 100644
--- a/.idea/php.xml
+++ b/.idea/php.xml
@@ -19,6 +19,11 @@
+
+
+
+
+
diff --git a/bootstrap.php b/bootstrap.php
new file mode 100644
index 0000000..3e8e4ab
--- /dev/null
+++ b/bootstrap.php
@@ -0,0 +1,3 @@
+
+
+
+ tests
+
+
+
+
+
+
+
diff --git a/tests/TempFile/TempFileTest.php b/tests/TempFile/TempFileTest.php
new file mode 100644
index 0000000..b5b5d38
--- /dev/null
+++ b/tests/TempFile/TempFileTest.php
@@ -0,0 +1,62 @@
+assertTrue(is_file($tempFile->getFilepath()));
+ $this->assertStringEndsWith('.tmp', $tempFile->getFilename());
+
+ // Test with custom options.
+ $customOptions = [
+ Options::Extension => 'txt',
+ Options::Filename => 'testfile',
+ Options::Prefix => 'prefix_',
+ Options::Suffix => '_suffix',
+ Options::RandomLength => 5,
+ Options::Directory => sys_get_temp_dir(),
+ ];
+ $tempFile = new TempFile($customOptions);
+ $this->assertStringEndsWith('.txt', $tempFile->getFilename());
+ $this->assertStringStartsWith('prefix_', $tempFile->getFilename());
+ $this->assertStringEndsWith('_suffix.txt', $tempFile->getFilename());
+ $this->assertSame($customOptions[Options::Directory], dirname($tempFile->getFilepath()));
+
+ // Test when a non-string and non-integer value is given to any options.
+ $customOptions[Options::Prefix] = [];
+ $this->expectException(\InvalidArgumentException::class);
+ new TempFile($customOptions);
+
+ // Test when an invalid option is given.
+ $customOptions = ['invalid_option' => 'value'];
+ $this->expectException(\InvalidArgumentException::class);
+ new TempFile($customOptions);
+
+ // Test when a directory that does not exist is given.
+ $customOptions = [Options::Directory => '/nonexistent/directory'];
+ $this->expectException(\InvalidArgumentException::class);
+ new TempFile($customOptions);
+
+ // Test when a directory that is not writable is given.
+ $customOptions = [Options::Directory => '/'];
+ $this->expectException(\InvalidArgumentException::class);
+ new TempFile($customOptions);
+
+ // Test if is writeable
+ $customOptions = [Options::Directory => sys_get_temp_dir()];
+ $tempFile = new TempFile($customOptions);
+ $this->assertTrue(is_writable($tempFile->getFilepath()));
+ }
+}
\ No newline at end of file
diff --git a/tests/file_test.php b/tests/file_test.php
deleted file mode 100644
index 4f24699..0000000
--- a/tests/file_test.php
+++ /dev/null
@@ -1,17 +0,0 @@
- 'txt',
- \TempFile\Options::Filename => 'test',
- ]);
- print(sprintf('Tempfile: %s', $temp->getFilepath()) . PHP_EOL);
-
- file_put_contents($temp, 'Hello, world!');
- print(sprintf('Filesize: %s', filesize($temp->getFilepath())) . PHP_EOL);
-
- sleep(10);
- print('Exiting...' . PHP_EOL);
- exit(0);
\ No newline at end of file