diff --git a/composer.json b/composer.json index 14e60fb..771d462 100644 --- a/composer.json +++ b/composer.json @@ -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" diff --git a/tests/Bot/Tests/ClientListTest.php b/tests/Bot/Tests/ClientListTest.php index 0d29d64..f600802 100644 --- a/tests/Bot/Tests/ClientListTest.php +++ b/tests/Bot/Tests/ClientListTest.php @@ -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]); } } diff --git a/tests/Bot/Tests/CommandsTest.php b/tests/Bot/Tests/CommandsTest.php index 91f059d..ee48bc9 100644 --- a/tests/Bot/Tests/CommandsTest.php +++ b/tests/Bot/Tests/CommandsTest.php @@ -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()); } } diff --git a/tests/Bot/Tests/DialogsTest.php b/tests/Bot/Tests/DialogsTest.php index 255169b..b21901a 100644 --- a/tests/Bot/Tests/DialogsTest.php +++ b/tests/Bot/Tests/DialogsTest.php @@ -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()); } diff --git a/tests/Bot/Tests/FileTest.php b/tests/Bot/Tests/FileTest.php index 1d1586a..fef0d16 100644 --- a/tests/Bot/Tests/FileTest.php +++ b/tests/Bot/Tests/FileTest.php @@ -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()); } } diff --git a/tests/Bot/Tests/MessagesTest.php b/tests/Bot/Tests/MessagesTest.php index 114ddbc..28bb46d 100644 --- a/tests/Bot/Tests/MessagesTest.php +++ b/tests/Bot/Tests/MessagesTest.php @@ -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()); } }