| 1 | <?php |
||
| 32 | class TestCase extends PHPUnit_Framework_TestCase |
||
| 33 | { |
||
| 34 | /** |
||
| 35 | * Cached user config |
||
| 36 | * |
||
| 37 | * @var Config |
||
| 38 | */ |
||
| 39 | protected $config; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Set up the application |
||
| 43 | * |
||
| 44 | * @return Application |
||
| 45 | */ |
||
| 46 | public function getApplication() |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Get the user's config |
||
| 57 | * |
||
| 58 | * @return Config |
||
| 59 | */ |
||
| 60 | public function getConfig() |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Get Magento account id |
||
| 70 | * |
||
| 71 | * @return string |
||
| 72 | */ |
||
| 73 | public function getAccountId() |
||
| 82 | |||
| 83 | /** |
||
| 84 | * Get Magento access token |
||
| 85 | * |
||
| 86 | * @return string |
||
| 87 | */ |
||
| 88 | public function getAccessToken() |
||
| 97 | } |
||
| 98 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: