FileStreamTest.php 819 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * @CreateTime: 2019/9/14 下午10:24
  4. * @Author: huizhang <tuzisir@163.com>
  5. * @Copyright: copyright(2019) Easyswoole all rights reserved
  6. * @Description: SplFileStream 单元测试
  7. */
  8. namespace EasySwoole\Spl\Test;
  9. use EasySwoole\Spl\SplFileStream;
  10. use PHPUnit\Framework\TestCase;
  11. class FileStreamTest extends TestCase {
  12. public function testConstruct() {
  13. $fileStream = new SplFileStream('./test.txt');
  14. $this->assertEquals('STDIO', $fileStream->getMetadata('stream_type'));
  15. }
  16. public function testLock() {
  17. $fileStream = new SplFileStream('./test.txt');
  18. $this->assertTrue($fileStream->lock());
  19. }
  20. public function testUnlock() {
  21. $fileStream = new SplFileStream('./test.txt');
  22. $this->assertTrue($fileStream->unlock());
  23. }
  24. }