|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Base Test Class |
|
4
|
|
|
*/ |
|
5
|
|
|
namespace Twigger\UnionCloud\Tests; |
|
6
|
|
|
|
|
7
|
|
|
use Dotenv\Dotenv; |
|
8
|
|
|
use Twigger\UnionCloud\API\UnionCloud; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Class TestCase |
|
12
|
|
|
* |
|
13
|
|
|
* @package Twigger\UnionCloud\Tests |
|
14
|
|
|
*/ |
|
15
|
|
|
class TestCase extends \PHPUnit\Framework\TestCase |
|
16
|
|
|
{ |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Example UnionCloud instance. |
|
20
|
|
|
* |
|
21
|
|
|
* This should be cloned for each new test, to prevent |
|
22
|
|
|
* any previous tests affecting the results of new tests |
|
23
|
|
|
* |
|
24
|
|
|
* @var UnionCloud |
|
25
|
|
|
*/ |
|
26
|
|
|
protected $unionCloud; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* TestCase constructor. |
|
30
|
|
|
* |
|
31
|
|
|
* Extract the environment variables from testing.env |
|
32
|
|
|
* |
|
33
|
|
|
* Set up an example UnionCloud singleton, |
|
34
|
|
|
* |
|
35
|
|
|
* @param null|string $name |
|
36
|
|
|
* @param array $data |
|
37
|
|
|
* @param string $dataName |
|
38
|
|
|
* |
|
39
|
|
|
* @throws \Twigger\UnionCloud\API\Exception\Authentication\AuthenticationParameterMissing |
|
40
|
|
|
* @throws \Twigger\UnionCloud\API\Exception\Authentication\AuthenticatorNotFound |
|
41
|
|
|
*/ |
|
42
|
|
|
public function __construct($name = null, array $data = [], $dataName = '') |
|
43
|
|
|
{ |
|
44
|
|
|
$dotEnv = new Dotenv(__DIR__.'/../', 'testing.env'); |
|
45
|
|
|
$dotEnv->load(); |
|
46
|
|
|
|
|
47
|
|
|
$unionCloud = new UnionCloud([ |
|
48
|
|
|
'email' => $_ENV['EMAIL'], |
|
49
|
|
|
'password' => $_ENV['PASSWORD'], |
|
50
|
|
|
'appID' => $_ENV['APPID'], |
|
51
|
|
|
'appPassword' => $_ENV['EMAIL'], |
|
52
|
|
|
]); |
|
53
|
|
|
$unionCloud->setBaseURL($_ENV['BASE_URL']); |
|
54
|
|
|
|
|
55
|
|
|
$this->unionCloud = $unionCloud; |
|
56
|
|
|
|
|
57
|
|
|
parent::__construct($name, $data, $dataName); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
} |