Jarves\Tests\File\FileRESTTest::testCreateFile PHP Method

testCreateFile() public method

public testCreateFile ( )
    public function testCreateFile()
    {
        $id = dechex(time() / mt_rand(100, 500));
        $testPath = '/test_' . $id . '.txt';
        $response = $this->restCall('/jarves/admin/file', 'PUT', ['path' => $testPath]);
        $this->assertEquals(true, $response['data']);
        $response = $this->restCall('/jarves/admin/file/single?path=' . $testPath);
        $file = $response['data'];
        $this->assertNotNull($file);
        $this->assertGreaterThan(0, $file['id']);
        $this->assertEquals($testPath, $file['path']);
        $this->assertEquals(basename($testPath), $file['name']);
        $this->assertEquals(dirname($testPath), $file['dir']);
        $this->assertEquals(true, $file['writeAccess']);
        $this->assertEquals('file', $file['type']);
        $response = $this->restCall('/jarves/admin/file', 'DELETE', ['path' => $testPath]);
        $this->assertEquals(true, $response['data']);
    }