1
0
mirror of synced 2024-11-21 19:36:02 +03:00

Test enhancement

This commit is contained in:
peter279k 2019-10-24 02:35:21 +08:00
parent 0534f31c34
commit 316836aca7
6 changed files with 34 additions and 28 deletions

View File

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

View File

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

View File

@ -86,7 +86,7 @@ class CommandsTest extends TestCase
$response = $client->commandEdit($request);
self::assertTrue($response instanceof ErrorOnlyResponse);
self::assertInstanceOf(ErrorOnlyResponse::class, $response);
self::assertTrue($response->isSuccessful());
}
@ -106,6 +106,6 @@ class CommandsTest extends TestCase
$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');
self::assertTrue($response instanceof ErrorOnlyResponse);
self::assertInstanceOF(ErrorOnlyResponse::class, $response);
self::assertTrue($response->isSuccessful());
self::assertEmpty($response->getErrors());
}

View File

@ -83,7 +83,7 @@ class FileTest extends TestCase
$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('file', $response->getType());
self::assertEquals(214, $response->getSize());
@ -105,7 +105,7 @@ class FileTest extends TestCase
$response = $client->getFileById($fileId);
self::assertTrue($response instanceof FullFileResponse);
self::assertInstanceOf(FullFileResponse::class, $response);
self::assertEquals($fileId, $response->getId());
}
}

View File

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