1
0
mirror of synced 2024-11-22 11:56:03 +03:00

Merge pull request #12 from open-source-contributions/test_enhancement

Test enhancement
This commit is contained in:
Alex Lushpai 2019-10-23 23:41:13 +03:00 committed by GitHub
commit ed2efc4d1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 28 deletions

View File

@ -33,11 +33,17 @@
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"RetailCrm\\Mg\\": ["src/", "tests/"], "RetailCrm\\Mg\\": "src/",
"RetailCrm\\Common\\": ["src/", "tests/"] "RetailCrm\\Common\\": "src/"
}, },
"files": ["extra/autoloader.php"] "files": ["extra/autoloader.php"]
}, },
"autoload-dev": {
"psr-4": {
"RetailCrm\\Mg\\": "tests/",
"RetailCrm\\Common\\": "tests/"
}
},
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.x-dev" "dev-master": "1.x-dev"

View File

@ -55,8 +55,8 @@ class ClientListTest extends TestCase
$response = $client->channels($request); $response = $client->channels($request);
static::assertEquals(4, count($response), "Incorrect channels count"); static::assertCount(4, $response, "Incorrect channels count");
static::assertTrue($response[0] instanceof Channel\Channel, "Incorrect channel instance"); static::assertInstanceOf(Channel\Channel::class, $response[0], "Incorrect channel instance");
} }
/** /**
@ -77,8 +77,8 @@ class ClientListTest extends TestCase
$response = $client->chats($request); $response = $client->chats($request);
static::assertEquals(2, count($response), "Incorrect chats count"); static::assertCount(2, $response, "Incorrect chats count");
static::assertTrue($response[0] instanceof Chat, "Incorrect chat instance"); static::assertInstanceOf(Chat::class, $response[0], "Incorrect chat instance");
} }
/** /**
@ -97,8 +97,8 @@ class ClientListTest extends TestCase
$request = new Request\MembersRequest(); $request = new Request\MembersRequest();
$response = $client->members($request); $response = $client->members($request);
static::assertEquals(4, count($response), "Incorrect members count"); static::assertCount(4, $response, "Incorrect members count");
static::assertTrue($response[0] instanceof ChatMember, "Incorrect member instance"); static::assertInstanceOf(ChatMember::class, $response[0], "Incorrect member instance");
} }
/** /**
@ -120,8 +120,8 @@ class ClientListTest extends TestCase
$response = $client->messages($request); $response = $client->messages($request);
static::assertEquals(2, count($response), "Incorrect message count"); static::assertCount(2, $response, "Incorrect message count");
static::assertTrue($response[0] instanceof Message, "Incorrect message instance"); static::assertInstanceOf(Message::class, $response[0], "Incorrect message instance");
} }
/** /**
@ -140,7 +140,7 @@ class ClientListTest extends TestCase
$request = new Request\CommandsRequest(); $request = new Request\CommandsRequest();
$response = $client->commands($request); $response = $client->commands($request);
self::assertEquals(0, count($response), "Invalid commands count"); self::assertCount(0, $response, "Invalid commands count");
} }
/** /**
@ -162,7 +162,7 @@ class ClientListTest extends TestCase
$data = $client->bots($request); $data = $client->bots($request);
static::assertEquals(3, count($data)); static::assertCount(3, $data);
} }
/** /**
@ -184,8 +184,8 @@ class ClientListTest extends TestCase
$response = $client->users($request); $response = $client->users($request);
self::assertEquals(2, count($response)); self::assertCount(2, $response);
self::assertTrue($response[0] instanceof User); self::assertInstanceOf(User::class, $response[0]);
} }
/** /**
@ -207,8 +207,8 @@ class ClientListTest extends TestCase
$response = $client->dialogs($request); $response = $client->dialogs($request);
self::assertEquals(2, count($response)); self::assertCount(2, $response);
self::assertTrue($response[0] instanceof Dialog); self::assertInstanceOf(Dialog::class, $response[0]);
} }
/** /**
@ -228,7 +228,7 @@ class ClientListTest extends TestCase
$response = $client->customers($request); $response = $client->customers($request);
self::assertEquals(2, count($response)); self::assertCount(2, $response);
self::assertTrue($response[0] instanceof Customer); self::assertInstanceOf(Customer::class, $response[0]);
} }
} }

View File

@ -86,7 +86,7 @@ class CommandsTest extends TestCase
$response = $client->commandEdit($request); $response = $client->commandEdit($request);
self::assertTrue($response instanceof ErrorOnlyResponse); self::assertInstanceOf(ErrorOnlyResponse::class, $response);
self::assertTrue($response->isSuccessful()); self::assertTrue($response->isSuccessful());
} }
@ -106,6 +106,6 @@ class CommandsTest extends TestCase
$response = $client->commandDelete("show_payment_types"); $response = $client->commandDelete("show_payment_types");
self::assertTrue($response->isSuccessful() == true); self::assertTrue($response->isSuccessful());
} }
} }

View File

@ -111,7 +111,7 @@ class DialogsTest extends TestCase
$response = $client->dialogClose('62'); $response = $client->dialogClose('62');
self::assertTrue($response instanceof ErrorOnlyResponse); self::assertInstanceOF(ErrorOnlyResponse::class, $response);
self::assertTrue($response->isSuccessful()); self::assertTrue($response->isSuccessful());
self::assertEmpty($response->getErrors()); self::assertEmpty($response->getErrors());
} }

View File

@ -83,7 +83,7 @@ class FileTest extends TestCase
$response = $client->uploadFile(__FILE__); $response = $client->uploadFile(__FILE__);
self::assertTrue($response instanceof UploadFileResponse); self::assertInstanceOf(UploadFileResponse::class, $response);
self::assertEquals('b2bdba90-166c-4e0a-829d-69f26a09fd2a', $response->getId()); self::assertEquals('b2bdba90-166c-4e0a-829d-69f26a09fd2a', $response->getId());
self::assertEquals('file', $response->getType()); self::assertEquals('file', $response->getType());
self::assertEquals(214, $response->getSize()); self::assertEquals(214, $response->getSize());
@ -105,7 +105,7 @@ class FileTest extends TestCase
$response = $client->getFileById($fileId); $response = $client->getFileById($fileId);
self::assertTrue($response instanceof FullFileResponse); self::assertInstanceOf(FullFileResponse::class, $response);
self::assertEquals($fileId, $response->getId()); self::assertEquals($fileId, $response->getId());
} }
} }

View File

@ -91,7 +91,7 @@ class MessagesTest extends TestCase
if ($response instanceof MessageSendResponse) { if ($response instanceof MessageSendResponse) {
self::assertTrue($response->isSuccessful()); self::assertTrue($response->isSuccessful());
self::assertEquals(0, count($response->getErrors())); self::assertCount(0, $response->getErrors());
self::assertEquals(3636, $response->getMessageId()); self::assertEquals(3636, $response->getMessageId());
} }
} }
@ -163,7 +163,7 @@ class MessagesTest extends TestCase
if ($response instanceof MessageSendResponse) { if ($response instanceof MessageSendResponse) {
self::assertTrue($response->isSuccessful()); self::assertTrue($response->isSuccessful());
self::assertEquals(0, count($response->getErrors())); self::assertCount(0, $response->getErrors());
self::assertEquals(3636, $response->getMessageId()); self::assertEquals(3636, $response->getMessageId());
} }
} }
@ -213,7 +213,7 @@ class MessagesTest extends TestCase
if ($response instanceof MessageSendResponse) { if ($response instanceof MessageSendResponse) {
self::assertTrue($response->isSuccessful()); self::assertTrue($response->isSuccessful());
self::assertEquals(0, count($response->getErrors())); self::assertCount(0, $response->getErrors());
self::assertEquals(3636, $response->getMessageId()); self::assertEquals(3636, $response->getMessageId());
} }
} }
@ -262,7 +262,7 @@ class MessagesTest extends TestCase
$response = $client->messageEdit($request); $response = $client->messageEdit($request);
self::assertTrue($response->isSuccessful()); self::assertTrue($response->isSuccessful());
self::assertEquals(0, count($response->getErrors())); self::assertCount(0, $response->getErrors());
} }
/** /**
@ -301,6 +301,6 @@ class MessagesTest extends TestCase
$response = $client->messageDelete('3636'); $response = $client->messageDelete('3636');
self::assertTrue($response->isSuccessful()); self::assertTrue($response->isSuccessful());
self::assertEquals(0, count($response->getErrors())); self::assertCount(0, $response->getErrors());
} }
} }