Last active
November 11, 2015 16:39
-
-
Save acobster/2dad2528cb08f51cd697 to your computer and use it in GitHub Desktop.
Platform-specific PHPUnit/Selenium test case architecture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* /test/module/ModuleTest.php */ | |
class ModuleTest extends PlatformSpecificTestCase { | |
public function setUp() { | |
$this->login(); | |
} | |
// test stuff | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* /test/shared/PlatformSpecificAdminTrait.php */ | |
trait PlatformSpecificAdminTrait { | |
protected function login() { | |
// do stuff | |
} | |
protected function logout() { | |
// do more stuff | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* /test/shared/PlatformSpecificTestCase.php */ | |
class PlatformSpecificTestCase extends PHPUnit_Extensions_Selenium2TestCase { | |
use PlatformSpecificAdminTrait; | |
// ^ pull in any other useful traits like this... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment