Skip to content

Instantly share code, notes, and snippets.

@acobster
Last active November 11, 2015 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acobster/2dad2528cb08f51cd697 to your computer and use it in GitHub Desktop.
Save acobster/2dad2528cb08f51cd697 to your computer and use it in GitHub Desktop.
Platform-specific PHPUnit/Selenium test case architecture
<?php
/* /test/module/ModuleTest.php */
class ModuleTest extends PlatformSpecificTestCase {
public function setUp() {
$this->login();
}
// test stuff
}
<?php
/* /test/shared/PlatformSpecificAdminTrait.php */
trait PlatformSpecificAdminTrait {
protected function login() {
// do stuff
}
protected function logout() {
// do more stuff
}
}
<?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