<commit_before><?php

/**
 * This file is part of the TelegramBot package.
 *
 * (c) <NAME> aka LONGMAN <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Longman\TelegramBot\Tests\Unit\Entities;

use Longman\TelegramBot\Entities\Games\CallbackGame;
use Longman\TelegramBot\Entities\InlineKeyboardButton;
use Longman\TelegramBot\Exception\TelegramException;
use Longman\TelegramBot\Tests\Unit\TestCase;

/**
 * @link            https://github.com/php-telegram-bot/core
 * @author          <NAME> <<EMAIL>>
 * @copyright       <NAME> <<EMAIL>>
 * @license         http://opensource.org/licenses/mit-license.php  The MIT License (MIT)
 * @package         TelegramTest
 */
class InlineKeyboardButtonTest extends TestCase
{
    public function testInlineKeyboardButtonNoTextFail(): void
    {
        $this->expectException(TelegramException::class);
        $this->expectExceptionMessage('You must add some text to the button!');
        new InlineKeyboardButton([]);
    }

    public function testInlineKeyboardButtonNoParameterFail(): void
    {
        $this->expectException(TelegramException::class);
        $this->expectExceptionMessage('You must use only one of these fields: url, login_url, callback_data, switch_inline_query, switch_inline_query_current_chat, callback_game, pay!');
        new InlineKeyboardButton(['text' => 'message']);
    }

    public function testInlineKeyboardButtonTooManyParametersFail(): void
    {
        $this->expectException(TelegramException::class);
        $this->expectExceptionMessage('You must use only one of these fields: url, login_url, callback_data, switch_inline_query, switch_inline_query_current_chat, callback_game, pay!');
        $test_funcs = [
            function () {
                new InlineKeyboardButton([
                    'text'          => 'message',
                    'url'           => 'url_value',
                    'callback_data' => 'callback_data_value',
                ]);
            },
            function () {
                new InlineKeyboardButton([
                    'text'                => 'message',
                    'url'                 => 'url_value',
                    'switch_inline_query' => 'switch_inline_query_value',
                ]);
            },
            function () {
                new InlineKeyboardButton([
                    'text'                => 'message',
                    'callback_data'       => 'callback_data_value',
                    'switch_inline_query' => 'switch_inline_query_value',<commit_msg>Fixed Tests for InlineKeyboardButton since we changed the exception message<commit_after><?php

/**
 * This file is part of the TelegramBot package.
 *
 * (c) <NAME> aka LONGMAN <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Longman\TelegramBot\Tests\Unit\Entities;

use Longman\TelegramBot\Entities\Games\CallbackGame;
use Longman\TelegramBot\Entities\InlineKeyboardButton;
use Longman\TelegramBot\Exception\TelegramException;
use Longman\TelegramBot\Tests\Unit\TestCase;

/**
 * @link            https://github.com/php-telegram-bot/core
 * @author          <NAME> <<EMAIL>>
 * @copyright       <NAME> <<EMAIL>>
 * @license         http://opensource.org/licenses/mit-license.php  The MIT License (MIT)
 * @package         TelegramTest
 */
class InlineKeyboardButtonTest extends TestCase
{
    public function testInlineKeyboardButtonNoTextFail(): void
    {
        $this->expectException(TelegramException::class);
        $this->expectExceptionMessage('You must add some text to the button!');
        new InlineKeyboardButton([]);
    }

    public function testInlineKeyboardButtonNoParameterFail(): void
    {
        $this->expectException(TelegramException::class);
        $this->expectExceptionMessage('You must use only one of these fields: url, login_url, callback_data, web_app, switch_inline_query, switch_inline_query_current_chat, callback_game, pay!');
        new InlineKeyboardButton(['text' => 'message']);
    }

    public function testInlineKeyboardButtonTooManyParametersFail(): void
    {
        $this->expectException(TelegramException::class);
        $this->expectExceptionMessage('You must use only one of these fields: url, login_url, callback_data, web_app, switch_inline_query, switch_inline_query_current_chat, callback_game, pay!');
        $test_funcs = [
            function () {
                new InlineKeyboardButton([
                    'text'          => 'message',
                    'url'           => 'url_value',
                    'callback_data' => 'callback_data_value',
                ]);
            },
            function () {
                new InlineKeyboardButton([
                    'text'                => 'message',
                    'url'                 => 'url_value',
                    'switch_inline_query' => 'switch_inline_query_value',
                ]);
            },
            function () {
                new InlineKeyboardButton([
                    'text'                => 'message',
                    'callback_data'       => 'callback_data_value',
                    'switch_inline_query' => 'switch_inline_query_value',
{'fraction_non_alphanumeric': 0.10536113179448994, 'fraction_numerical': 0.0, 'mean_word_length': 2.3665413533834587, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 53, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1783244', 'n_tokens_mistral': 1393, 'n_tokens_neox': 1401, 'n_words': 308}