-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The previous commit introduced some changes that caused codeception unit tests to break. This commit fixes this by introducing a new service class Transifex_Live_Integration_WP_Services to wrap WP API functionality. This refactoring enables mocking the WP API in the tests. Also a new test class, BaseTestCase, is introduced to cater for different PHPUnit versions between production and development environment.
- Loading branch information
Showing
9 changed files
with
88 additions
and
16 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
/* | ||
* @package TransifexLiveIntegration | ||
*/ | ||
|
||
/** | ||
* Provides WP services to other classes. | ||
*/ | ||
class Transifex_Live_Integration_WP_Services { | ||
|
||
/* | ||
* Wraps WP site_url(). | ||
*/ | ||
function get_site_url() { | ||
return site_url(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
/* | ||
* This class caters for the different PHPUnit versions between production (CI) | ||
* and development. | ||
* To execute unit tests use : | ||
* | ||
* php codecept.phar run unit --debug | ||
*/ | ||
if (class_exists('\PHPUnit_Framework_TestCase')) { | ||
// php 5.6, production - CI environment | ||
class BaseTestCase extends \PHPUnit_Framework_TestCase {} | ||
} else { | ||
// php 7+, dev environment | ||
class BaseTestCase extends PHPunit\Framework\TestCase {} | ||
} |
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
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
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
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
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
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