Testing on Windows for the first time!
Posted: Fri May 02, 2008 11:16 am
Hi all.
Today I've been working on a few things to check that my test suite is portable, as I'm hoping to work with a larger team of developers (i.e., more than 1) in the future. For that reason, I have installed WAMP on a copy of Windows, and run my test suite on that platform for the first time. Most tests pass, but I'm stuck on a very simple issue which I have no prior experience of.
I have a very simple class which writes a file to a specified directory. I have a few tests to check that an error is thrown if the directory has no write permissions, or if the file exists and has no write permissions. I did this using touch(($path)) and chmod($path, 0) at the beginning of each test.
In Windows, the tests pass, but I get an error thrown in my tearDown() method that PHP can't unlink the file at $path - "Permission denied". How do I get round this? I have read things to the effect of "Windows doesn't use chmod()", which I appreciate. However, does that mean these tests are irrelevant on Windows (PHP will always be able to write to every directory), or that I need to modify the tests in some way?
Thanks!
Today I've been working on a few things to check that my test suite is portable, as I'm hoping to work with a larger team of developers (i.e., more than 1) in the future. For that reason, I have installed WAMP on a copy of Windows, and run my test suite on that platform for the first time. Most tests pass, but I'm stuck on a very simple issue which I have no prior experience of.
I have a very simple class which writes a file to a specified directory. I have a few tests to check that an error is thrown if the directory has no write permissions, or if the file exists and has no write permissions. I did this using touch(($path)) and chmod($path, 0) at the beginning of each test.
In Windows, the tests pass, but I get an error thrown in my tearDown() method that PHP can't unlink the file at $path - "Permission denied". How do I get round this? I have read things to the effect of "Windows doesn't use chmod()", which I appreciate. However, does that mean these tests are irrelevant on Windows (PHP will always be able to write to every directory), or that I need to modify the tests in some way?
Thanks!