public function testGetPath_PreserveExtension() { $file = new File(); $file->setName('example.txt'); $pathStrategy = new ChunkPathStrategy(['baseDir' => '/var', 'preserveExtension' => true]); $this->setPrivateProperty($file, 'id', 1); // 000001 $this->assertEquals('/var/001/000/1.txt', $pathStrategy->getPath($file)); $this->setPrivateProperty($file, 'id', 12); // 000012 $this->assertEquals('/var/012/000/12.txt', $pathStrategy->getPath($file)); $this->setPrivateProperty($file, 'id', 123); // 000123 $this->assertEquals('/var/123/000/123.txt', $pathStrategy->getPath($file)); $this->setPrivateProperty($file, 'id', 1234); // 001234 $this->assertEquals('/var/234/001/1234.txt', $pathStrategy->getPath($file)); $this->setPrivateProperty($file, 'id', 12345); // 012345 $this->assertEquals('/var/345/012/12345.txt', $pathStrategy->getPath($file)); $this->setPrivateProperty($file, 'id', 123456); // 123456 $this->assertEquals('/var/456/123/123456.txt', $pathStrategy->getPath($file)); $this->setPrivateProperty($file, 'id', 1234567); // 1234567 $this->assertEquals('/var/567/234/1234567.txt', $pathStrategy->getPath($file)); }
public function testGetExtension() { $file = new File(); $file->setName('example.TXT'); $this->assertEquals('txt', $file->getExtension()); }