Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
509532cd
Commit
509532cd
authored
Sep 05, 2015
by
MBoretto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some tests
parent
1ea289e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
Request.php
src/Request.php
+5
-6
ServerResponseTest.php
tests/Unit/Entities/ServerResponseTest.php
+1
-1
No files found.
src/Request.php
View file @
509532cd
...
@@ -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 i
n
not the best possible implementation
//Maybe this i
s
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
)
...
...
tests/Unit/Entities/ServerResponseTest.php
View file @
509532cd
...
@@ -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'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment