File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed
tests/functional/org/nameapi/client/services Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace org \nameapi \client \services ;
4+
5+
6+ spl_autoload_register ();
7+
8+ require_once (__DIR__ .'/../../../../../../src/org/nameapi/client/services/ServiceFactory.php ' );
9+
10+ use org \nameapi \ontology \input \context \Context ;
11+ use org \nameapi \ontology \input \context \Priority ;
12+ use org \nameapi \ontology \input \context \TextCase ;
13+
14+
15+ abstract class BaseServiceTest extends \PHPUnit_Framework_TestCase {
16+
17+ private $ apiKey = null ;
18+
19+ /**
20+ * @return Context
21+ */
22+ protected function makeContext () {
23+ if (!$ this ->apiKey ) {
24+ die ("Put your api key in the \$apiKey variable to run these functional tests! " );
25+ }
26+ return Context::builder ()
27+ ->apiKey ($ this ->apiKey )
28+ ->priority (Priority::REALTIME )
29+ ->textCase (TextCase::TITLE_CASE )
30+ ->build ();
31+ }
32+
33+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace org \nameapi \client \services \system \ping ;
4+
5+ require_once (__DIR__ .'/../../BaseServiceTest.php ' );
6+
7+ use org \nameapi \client \services \BaseServiceTest ;
8+ use org \nameapi \client \services \ServiceFactory ;
9+
10+ class PingerServiceTest extends BaseServiceTest {
11+
12+ public function testPing () {
13+ $ serviceFactory = new ServiceFactory ($ this ->makeContext ());
14+ $ pinger = $ serviceFactory ->systemServices ()->pingerService ();
15+ $ pong = $ pinger ->ping ();
16+ $ this ->assertEquals ($ pong , 'pong ' );
17+ }
18+
19+ }
You can’t perform that action at this time.
0 commit comments