@@ -45,17 +45,14 @@ protected function setUp()
45
45
46
46
public function testOnPullRequestLabeled ()
47
47
{
48
- $ event = new GitHubEvent ([
49
- 'action ' => 'labeled ' ,
50
- 'number ' => 1234 ,
51
- 'pull_request ' => [
52
- 'title ' => '[fwb][bar] Foo ' ,
53
- 'labels ' => [
54
- ['name ' => 'FrameworkBundle ' , 'color ' => 'dddddd ' ],
55
- ['name ' => 'Console ' , 'color ' => 'dddddd ' ],
56
- ],
48
+ $ event = new GitHubEvent (['action ' => 'labeled ' , 'number ' => 1234 , 'pull_request ' =>[]], $ this ->repository );
49
+ $ this ->pullRequestApi ->method ('show ' )->willReturn ([
50
+ 'title ' => '[fwb][bar] Foo ' ,
51
+ 'labels ' => [
52
+ ['name ' => 'FrameworkBundle ' , 'color ' => 'dddddd ' ],
53
+ ['name ' => 'Console ' , 'color ' => 'dddddd ' ],
57
54
],
58
- ], $ this -> repository );
55
+ ]);
59
56
60
57
$ this ->dispatcher ->dispatch ($ event , GitHubEvents::PULL_REQUEST );
61
58
$ responseData = $ event ->getResponseData ();
@@ -67,16 +64,13 @@ public function testOnPullRequestLabeled()
67
64
68
65
public function testOnPullRequestLabeledCaseInsensitive ()
69
66
{
70
- $ event = new GitHubEvent ([
71
- 'action ' => 'labeled ' ,
72
- 'number ' => 1234 ,
73
- 'pull_request ' => [
74
- 'title ' => '[PHPunitbridge] Foo ' ,
75
- 'labels ' => [
76
- ['name ' => 'PhpUnitBridge ' , 'color ' => 'dddddd ' ],
77
- ],
67
+ $ event = new GitHubEvent (['action ' => 'labeled ' , 'number ' => 1234 , 'pull_request ' =>[]], $ this ->repository );
68
+ $ this ->pullRequestApi ->method ('show ' )->willReturn ([
69
+ 'title ' => '[PHPunitbridge] Foo ' ,
70
+ 'labels ' => [
71
+ ['name ' => 'PhpUnitBridge ' , 'color ' => 'dddddd ' ],
78
72
],
79
- ], $ this -> repository );
73
+ ]);
80
74
81
75
$ this ->dispatcher ->dispatch ($ event , GitHubEvents::PULL_REQUEST );
82
76
$ responseData = $ event ->getResponseData ();
@@ -88,42 +82,14 @@ public function testOnPullRequestLabeledCaseInsensitive()
88
82
89
83
public function testOnPullRequestLabeledWithExisting ()
90
84
{
91
- $ event = new GitHubEvent ([
92
- 'action ' => 'labeled ' ,
93
- 'number ' => 1234 ,
94
- 'pull_request ' => [
85
+ $ event = new GitHubEvent (['action ' => 'labeled ' , 'number ' => 1234 , 'pull_request ' =>[]], $ this ->repository );
86
+ $ this ->pullRequestApi ->method ('show ' )->willReturn ([
95
87
'title ' => '[Messenger] Fix JSON ' ,
96
88
'labels ' => [
97
89
['name ' => 'Status: Needs Review ' , 'color ' => 'abcabc ' ],
98
90
['name ' => 'Messenger ' , 'color ' => 'dddddd ' ],
99
91
],
100
- ],
101
- ], $ this ->repository );
102
-
103
- $ this ->dispatcher ->dispatch ($ event , GitHubEvents::PULL_REQUEST );
104
- $ responseData = $ event ->getResponseData ();
105
- $ this ->assertEmpty ($ responseData );
106
- }
107
-
108
- /**
109
- * If a user add two labels at the same time. We will get two webhooks simultaneously.
110
- * We need to make sure that when we request the Github API it will return the changes
111
- * from the first webhook.
112
- */
113
- public function testOnPullRequestLabeledTwice ()
114
- {
115
- $ this ->pullRequestApi ->method ('show ' )->willReturn (['title ' => '[Console][FrameworkBundle] Foo normal title ' ]);
116
- $ event = new GitHubEvent ([
117
- 'action ' => 'labeled ' ,
118
- 'number ' => 1234 ,
119
- 'pull_request ' => [
120
- 'title ' => 'Foo normal title ' ,
121
- 'labels ' => [
122
- ['name ' => 'FrameworkBundle ' , 'color ' => 'dddddd ' ],
123
- ['name ' => 'Console ' , 'color ' => 'dddddd ' ],
124
- ],
125
- ],
126
- ], $ this ->repository );
92
+ ]);
127
93
128
94
$ this ->dispatcher ->dispatch ($ event , GitHubEvents::PULL_REQUEST );
129
95
$ responseData = $ event ->getResponseData ();
@@ -132,16 +98,13 @@ public function testOnPullRequestLabeledTwice()
132
98
133
99
public function testRemoveLabel ()
134
100
{
135
- $ event = new GitHubEvent ([
136
- 'action ' => 'labeled ' ,
137
- 'number ' => 1234 ,
138
- 'pull_request ' => [
101
+ $ event = new GitHubEvent (['action ' => 'labeled ' , 'number ' => 1234 , 'pull_request ' =>[]], $ this ->repository );
102
+ $ this ->pullRequestApi ->method ('show ' )->willReturn ([
139
103
'title ' => '[Console][FrameworkBundle] [Random] Foo normal title ' ,
140
104
'labels ' => [
141
105
['name ' => 'Console ' , 'color ' => 'dddddd ' ],
142
106
],
143
- ],
144
- ], $ this ->repository );
107
+ ]);
145
108
146
109
$ this ->dispatcher ->dispatch ($ event , GitHubEvents::PULL_REQUEST );
147
110
$ responseData = $ event ->getResponseData ();
0 commit comments