Beispiel #1
0
 public function execute()
 {
     $presenter = new PingPresenter();
     $result = $this->resultFactory->create(ResultFactory::TYPE_JSON);
     $result->setData($presenter->toArray());
     return $result;
 }
 public function pingAction()
 {
     $presenter = new PingPresenter();
     $this->getResponse()->setHeader('Content-type', 'application/json');
     $this->getResponse()->setBody(json_encode($presenter->toArray()));
 }
Beispiel #3
0
 private function ping()
 {
     $presenter = new PingPresenter();
     wp_send_json($presenter->toArray());
 }
 public function testToArray()
 {
     $presenter = new PingPresenter();
     $this->assertEquals(array('expressly' => 'Stuff is happening!'), $presenter->toArray());
     $this->assertJson(json_encode($presenter->toArray()));
 }