1
+ <?php
2
+
3
+ require_once ("../bin/Codebase.class.php " );
4
+ require_once ("../bin/config.php " );
5
+
6
+ class Authentication_test extends \Enhance \TestFixture {
7
+
8
+ public static $ instance = NULL ;
9
+
10
+ private function debug ($ obj ) {
11
+ if ($ this ->config ->debugMode ) {
12
+ echo '<pre> ' ;
13
+ print_r ($ obj );
14
+ echo '</pre> ' ;
15
+ }
16
+ }
17
+
18
+ // Singleton pattern to avoid creating a new
19
+ private function getInstance () {
20
+ $ this ->config = (object )$ GLOBALS ['config ' ];
21
+ if (!isset (self ::$ instance )) {
22
+ self ::$ instance = new Codebase ($ this ->config ->apiuser , $ this ->config ->apikey , $ this ->config ->hostname , $ this ->config ->secure );
23
+ self ::debug (self ::$ instance );
24
+ }
25
+ return self ::$ instance ;
26
+ }
27
+
28
+ public function setUp () {
29
+ $ this ->cb = $ this ->getInstance ();
30
+ }
31
+
32
+ public function Is_Instance_Of_Codebase () {
33
+ \Enhance \Assert::isInstanceOfType ('Codebase ' , $ this ->cb );
34
+ }
35
+
36
+ public function Authentication_Matches () {
37
+ \Enhance \Assert::areIdentical ($ this ->config ->apiuser , $ this ->cb ->username );
38
+ \Enhance \Assert::areIdentical ($ this ->config ->apikey , $ this ->cb ->password );
39
+ \Enhance \Assert::areIdentical ($ this ->config ->hostname , $ this ->cb ->hostname );
40
+ }
41
+
42
+ public function has_projects () {
43
+ \Enhance \Assert::isNotNull ($ this ->cb ->projects ());
44
+ }
45
+
46
+ public function has_tickets () {
47
+ $ this ->tickets = $ this ->cb ->tickets ($ this ->config ->project );
48
+ \Enhance \Assert::isNotNull ($ this ->tickets );
49
+ }
50
+
51
+ public function has_notes () {
52
+ $ this ->tickets = $ this ->cb ->tickets ($ this ->config ->project );
53
+ \Enhance \Assert::isNotNull ($ this ->cb ->notes ($ this ->tickets [0 ]['ticket-id ' ], $ this ->config ->project ));
54
+ }
55
+
56
+ public function project_has_data () {
57
+ \Enhance \Assert::isNotNull ($ this ->cb ->project ($ this ->config ->project ));
58
+ }
59
+
60
+ public function has_categories () {
61
+ \Enhance \Assert::isNotNull ($ this ->cb ->categories ($ this ->config ->project ));
62
+ }
63
+
64
+ public function has_statuses () {
65
+ \Enhance \Assert::isNotNull ($ this ->cb ->statuses ($ this ->config ->project ));
66
+ }
67
+
68
+ public function has_priorities () {
69
+ \Enhance \Assert::isNotNull ($ this ->cb ->priorities ($ this ->config ->project ));
70
+ }
71
+ }
0 commit comments