Commit 509532cd authored by MBoretto's avatar MBoretto

fix some tests

parent 1ea289e2
...@@ -68,10 +68,10 @@ class Request ...@@ -68,10 +68,10 @@ class Request
public static function generateGeneralFakeServerSesponse($data = null) public static function generateGeneralFakeServerSesponse($data = null)
{ {
//PARAM BINDED IN PHPUNIT TEST FOR TestServerResponse.php //PARAM BINDED IN PHPUNIT TEST FOR TestServerResponse.php
//Maybe this in not the best possible implementation //Maybe this is not the best possible implementation
//No value set in $data ie testing setWekhook //No value set in $data ie testing setWekhook
//Provided $data['chat_id'] testing sendMessage //Provided $data['chat_id'] ie testing sendMessage
$fake_response['ok'] = true; // :) $fake_response['ok'] = true; // :)
...@@ -83,7 +83,6 @@ class Request ...@@ -83,7 +83,6 @@ class Request
if (isset($data['chat_id'])) { if (isset($data['chat_id'])) {
$data['message_id'] = '1234'; $data['message_id'] = '1234';
$data['date'] = '1441378360'; $data['date'] = '1441378360';
$data['text'] = 'hello';
$data['from'] = array( 'id' => 123456789 ,'first_name' => 'botname', 'username'=> 'namebot'); $data['from'] = array( 'id' => 123456789 ,'first_name' => 'botname', 'username'=> 'namebot');
$data['chat'] = array('id'=> $data['chat_id'] ); $data['chat'] = array('id'=> $data['chat_id'] );
...@@ -127,12 +126,12 @@ class Request ...@@ -127,12 +126,12 @@ class Request
$response['ok'] = 1; $response['ok'] = 1;
$response['error_code'] = 1; $response['error_code'] = 1;
$response['description'] = 'Empty server response'; $response['description'] = 'Empty server response';
$result =$response;
} }
// return json_decode($result, true);
return $result; //return $result;
//return new ServerResponse(json_decode($result, true), self::$telegram->getBotName()); return new ServerResponse(json_decode($result, true), self::$telegram->getBotName());
} }
public static function sendMessage(array $data) public static function sendMessage(array $data)
......
...@@ -164,7 +164,7 @@ class ServerResponseTest extends TestCase ...@@ -164,7 +164,7 @@ class ServerResponseTest extends TestCase
//sendMessage ok //sendMessage ok
$fake_response = Request::generateGeneralFakeServerSesponse(['chat_id' => 123456789]); $fake_response = Request::generateGeneralFakeServerSesponse(['chat_id' => 123456789, 'text' => 'hello']);
$this->server = new ServerResponse($fake_response, 'testbot'); $this->server = new ServerResponse($fake_response, 'testbot');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment