Skip to content

Commit

Permalink
File to Dir test.
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmorris committed Dec 16, 2023
1 parent bcb225d commit 8da6708
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/php-wasm/node/src/test/php.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,17 @@ describe.each(SupportedPHPVersions)('PHP %s', (phpVersion) => {
expect(php.readFileAsText(testDirPath2 + '/2.txt')).toEqual('2');
});

it('cp() should copy a file into a directory', () => {
const testDirPath1 = testDirPath;
const testDirPath2 = '/__test987654322';
php.mkdir(testDirPath1);
php.mkdir(testDirPath2);
php.writeFile(testDirPath1 + '/1.txt', '1');
php.cp(testDirPath1 + '/1.txt', testDirPath2, { recursive: true });
expect(php.fileExists(testDirPath2 + '/1.txt')).toEqual(true);
expect(php.readFileAsText(testDirPath2 + '/1.txt')).toEqual('1');
});

it('cp() should replace target file if it exists', () => {
php.mkdir(testDirPath);
const file1 = testDirPath + '/1.txt';
Expand Down

0 comments on commit 8da6708

Please sign in to comment.