File tree Expand file tree Collapse file tree
enqueue-bundle/Tests/Functional Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ services:
2828 - MYSQL_DSN=mysql://root:rootpass@mysql/mqdev
2929 - PREDIS_DSN=redis+predis://redis
3030 - PHPREDIS_DSN=redis+phpredis://redis
31- - GPS_DSN=gps:?projectId=mqdev
31+ - GPS_DSN=gps:?projectId=mqdev&emulatorHost=http://google-pubsub:8085
3232 - SQS_DSN=sqs:?key=key&secret=secret®ion=us-east-1&endpoint=http://localstack:4576&version=latest
3333 - RABBITMQ_HOST=rabbitmq
3434 - RABBITMQ_USER=guest
Original file line number Diff line number Diff line change @@ -121,7 +121,6 @@ public function provideEnqueueConfigs()
121121// yield 'gps' => [[
122122// 'transport' => [
123123// 'dsn' => getenv('GPS_DSN'),
124- // 'emulatorHost' => 'http://google-pubsub:8085'
125124// ],
126125// ]];
127126 }
Original file line number Diff line number Diff line change 22
33namespace Enqueue \Gps \Tests \Spec ;
44
5- use Enqueue \Gps \GpsConnectionFactory ;
65use Enqueue \Gps \GpsContext ;
6+ use Enqueue \Test \GpsExtension ;
77use Interop \Queue \PsrContext ;
88use Interop \Queue \Spec \SendToTopicAndReceiveNoWaitFromQueueSpec ;
99
1212 */
1313class GpsSendToTopicAndReceiveFromQueueTest extends SendToTopicAndReceiveNoWaitFromQueueSpec
1414{
15+ use GpsExtension;
16+
1517 private $ topic ;
1618
1719 protected function createContext ()
1820 {
19- return ( new GpsConnectionFactory ())-> createContext ();
21+ return $ this -> buildGpsContext ();
2022 }
2123
2224 /**
Original file line number Diff line number Diff line change 22
33namespace Enqueue \Gps \Tests \Spec ;
44
5- use Enqueue \Gps \GpsConnectionFactory ;
65use Enqueue \Gps \GpsContext ;
6+ use Enqueue \Test \GpsExtension ;
77use Interop \Queue \PsrContext ;
88use Interop \Queue \Spec \SendToTopicAndReceiveNoWaitFromQueueSpec ;
99
1212 */
1313class GpsSendToTopicAndReceiveNoWaitFromQueueTest extends SendToTopicAndReceiveNoWaitFromQueueSpec
1414{
15+ use GpsExtension;
16+
1517 private $ topic ;
1618
1719 protected function createContext ()
1820 {
19- return ( new GpsConnectionFactory ())-> createContext ();
21+ return $ this -> buildGpsContext ();
2022 }
2123
2224 /**
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Enqueue \Test ;
4+
5+ use Enqueue \Gps \GpsConnectionFactory ;
6+ use Enqueue \Gps \GpsContext ;
7+
8+ trait GpsExtension
9+ {
10+ private function buildGpsContext (): GpsContext
11+ {
12+ if (false == getenv ('GPS_DSN ' )) {
13+ throw new \PHPUnit_Framework_SkippedTestError ('Functional tests are not allowed in this environment ' );
14+ }
15+
16+ $ config = getenv ('GPS_DSN ' );
17+
18+ return (new GpsConnectionFactory ($ config ))->createContext ();
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments