Hi...

Originally Posted by
phpcod3x
As for a specific example I will use the one that I'm starting on this weekend as a pet project, an automated rollout script.
You really are throwing yourself in at the deep end
. Ok, here goes...
PHP Code:
class TestOfRollout extends ShellTestCase {
function setUp() {
$sandbox = new VersionControl('path/to/sample/sandbox');
$sandbox->createProject('Test');
}
function tearDown() {
$sandbox = new VersionControl('path/to/sample/sandbox');
$sandbox->removeProject('Test');
}
function testCanRollOutOneFile() {
file_put_contents('path/to/sample/sandbox/script', 'Hello');
$sandbox = new VersionControl('path/to/sample/sandbox');
$sandbox->checkOut('Test');
$sandbox->add('script');
$this->execute("php rollout.php 'path/to/target'");
$this->assertFileExists('path/to/target/script');
$this->assertFilePattern('path/to/target/script', '/Hello/');
}
}
That's just a top level acceptance test. You know when you are making progress when this runs. The next step is simplyto have your rollout.php script just write out the file 'Hello'. Work backwards from there.
I am assuming that as you advance you will have to flesh out the class VersionControl. You will probably need separate tests for this. I often find that the first few acceptance tests force some utilty clases onto me, or utility scripts such as installers.
Just a suggestion.
yours, Marcus
Bookmarks