File tree 5 files changed +180
-6
lines changed 5 files changed +180
-6
lines changed Original file line number Diff line number Diff line change 11
11
12
12
class Action
13
13
{
14
+ private $ name = '' ;
15
+ private $ type = '' ;
16
+ private $ target ;
14
17
18
+ /**
19
+ * Action constructor.
20
+ * @param string $name
21
+ * @param string $type
22
+ */
23
+ public function __construct (string $ type )
24
+ {
25
+ $ this ->type = $ type ;
26
+ }
27
+
28
+ /**
29
+ * @return string
30
+ */
31
+ public function getName (): string
32
+ {
33
+ return $ this ->name ;
34
+ }
35
+
36
+ /**
37
+ * @param string $name
38
+ */
39
+ public function setName (string $ name ): void
40
+ {
41
+ $ this ->name = $ name ;
42
+ }
43
+
44
+ /**
45
+ * @return string
46
+ */
47
+ public function getType (): string
48
+ {
49
+ return $ this ->type ;
50
+ }
51
+
52
+ /**
53
+ * @param string $type
54
+ */
55
+ public function setType (string $ type ): void
56
+ {
57
+ $ this ->type = $ type ;
58
+ }
59
+
60
+ /**
61
+ * @return mixed
62
+ */
63
+ public function getTarget ()
64
+ {
65
+ return $ this ->target ;
66
+ }
67
+
68
+ /**
69
+ * @param mixed $target
70
+ */
71
+ public function setTarget (Model $ target ): void
72
+ {
73
+ $ this ->target = $ target ;
74
+ }
15
75
}
Original file line number Diff line number Diff line change @@ -101,4 +101,8 @@ public function getLists(Model $board)
101
101
return $ lists ;
102
102
}
103
103
104
+ public function registerWebhook (Webhook )
105
+ {
106
+ }
107
+
104
108
}
Original file line number Diff line number Diff line change 11
11
12
12
class Webhook
13
13
{
14
+ private $ action ;
15
+ private $ id ;
16
+ private $ model ;
17
+ private $ handle ;
18
+
19
+ /**
20
+ * @return mixed
21
+ */
22
+ public function getAction ()
23
+ {
24
+ return $ this ->action ;
25
+ }
26
+
27
+ /**
28
+ * @param mixed $action
29
+ * @return Webhook
30
+ */
31
+ public function setAction ($ action )
32
+ {
33
+ $ this ->action = $ action ;
34
+ return $ this ;
35
+ }
36
+
37
+ /**
38
+ * @return mixed
39
+ */
40
+ public function getId ()
41
+ {
42
+ return $ this ->id ;
43
+ }
44
+
45
+ /**
46
+ * @param mixed $id
47
+ * @return Webhook
48
+ */
49
+ public function setId ($ id )
50
+ {
51
+ $ this ->id = $ id ;
52
+ return $ this ;
53
+ }
54
+
55
+ /**
56
+ * @return mixed
57
+ */
58
+ public function getModel ()
59
+ {
60
+ return $ this ->model ;
61
+ }
62
+
63
+ /**
64
+ * @param mixed $model
65
+ * @return Webhook
66
+ */
67
+ public function setModel ($ model )
68
+ {
69
+ $ this ->model = $ model ;
70
+ return $ this ;
71
+ }
72
+
73
+ /**
74
+ * @return mixed
75
+ */
76
+ public function getHandle ()
77
+ {
78
+ return $ this ->handle ;
79
+ }
80
+
81
+ /**
82
+ * @param mixed $handle
83
+ * @return Webhook
84
+ */
85
+ public function setHandle ($ handle )
86
+ {
87
+ $ this ->handle = $ handle ;
88
+ return $ this ;
89
+ }
14
90
15
91
}
Original file line number Diff line number Diff line change 12
12
13
13
class ActionTest extends \PHPUnit \Framework \TestCase
14
14
{
15
- public function testObject ()
15
+ protected $ action ;
16
+
17
+ public function setUp (): void
18
+ {
19
+ }
20
+
21
+ public function testCreateAction ()
22
+ {
23
+ $ action = new Action ("return " );
24
+ $ action ->setName ('Returns the string \'Executed \'' );
25
+ $ this ->assertTrue (true );
26
+ return $ action ;
27
+ }
28
+
29
+ /**
30
+ * @depends testCreateAction
31
+ */
32
+ public function testGetName ($ action )
33
+ {
34
+ $ this ->assertEquals ("Returns the string 'Executed' " , $ action ->getName ());
35
+ }
36
+
37
+ /**
38
+ * @depends testCreateAction
39
+ */
40
+ public function testSetName ($ action )
16
41
{
17
- $ object = new Action ( );
18
- $ this ->assertIsObject ( $ object , " Has to be an object. " );
42
+ $ action -> setName ( " New name " );
43
+ $ this ->assertEquals ( " New name " , $ action -> getName () );
19
44
}
20
45
21
46
}
Original file line number Diff line number Diff line change @@ -17,18 +17,26 @@ public function init($msg = "")
17
17
}
18
18
}
19
19
20
+ public function testInit ()
21
+ {
22
+ require ".config " ;
23
+ $ trello = new \Webhooks \Wrapper \Trello ($ key , $ token );
24
+ $ this ->assertTrue (true );
25
+ return $ trello ;
26
+ }
27
+
20
28
public function teamIdProvider ()
21
29
{
22
30
return [['5c004b2157cb628ef3fd9362 ' ]];
23
31
}
24
32
25
33
/**
34
+ * @depends testInit
26
35
* @dataProvider teamIdProvider
27
36
*/
28
- public function testGetTeam ($ id )
37
+ public function testGetTeam ()
29
38
{
30
- $ this ->init ();
31
- $ trello = $ this ->trello ;
39
+ list ($ id , $ trello ) = func_get_args ();
32
40
$ team = $ trello ->getTeam ($ id );
33
41
$ this ->assertInstanceOf ("Webhooks\Wrapper\Model " , $ team , "Only Model object required " );
34
42
$ this ->assertEquals ("team " , $ team ->getType (), "Model should be of type team " );
@@ -62,6 +70,7 @@ public function selectTestTeamProvider()
62
70
}
63
71
64
72
/**
73
+ * @depends testInit
65
74
* @dataProvider teamsProvider
66
75
*/
67
76
public function testGetTeamsReturnedModels ($ model )
You can’t perform that action at this time.
0 commit comments