File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed
Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -144,16 +144,31 @@ public function url($url)
144144 public function toArray ()
145145 {
146146 $ payload = [
147- 'target ' => $ this ->target ->getTarget (),
148147 'type ' => $ this ->type ,
149148 'title ' => $ this ->title ,
150149 'body ' => $ this ->message ,
151150 ];
152151
153- if ($ this ->type === static ::TYPE_LINK ) {
154- $ payload ['url ' ] = $ this ->url ;
155- }
152+ return array_merge (
153+ $ payload ,
154+ $ this ->target ->getTarget (),
155+ $ this ->getUrlParameter ()
156+ );
157+ }
158+
159+ /**
160+ * @return bool
161+ */
162+ private function isLink ()
163+ {
164+ return $ this ->type === static ::TYPE_LINK ;
165+ }
156166
157- return $ payload ;
167+ /**
168+ * @return array
169+ */
170+ private function getUrlParameter ()
171+ {
172+ return $ this ->isLink () ? ['url ' => $ this ->url ] : [];
158173 }
159174}
Original file line number Diff line number Diff line change 33namespace NotificationChannels \Pushbullet \Test ;
44
55use NotificationChannels \Pushbullet \PushbulletMessage ;
6+ use PHPUnit \Framework \TestCase ;
67
7- class PushbulletMessageTest extends \PHPUnit_Framework_TestCase
8+ class PushbulletMessageTest extends TestCase
89{
910 /** @test */
1011 public function message_can_be_instantiated_with_text ()
You can’t perform that action at this time.
0 commit comments