php-telegram-bot / core

PHP Telegram Bot based on the official Telegram Bot API
MIT License
3.9k stars 955 forks source link

Error: Class 'Longman\TelegramBot\Tests\Unit\TestHelpers' not found #556

Closed rikhtehgaran closed 7 years ago

rikhtehgaran commented 7 years ago

Required Information

Expected behaviour

Works without any error

Actual behaviour

get error: [Wed Jul 05 14:03:38.607093 2017] [php7:error] [pid 7319] [client 127.0.0.1:41634] PHP Fatal error: Uncaught Error: Class 'Longman\TelegramBot\Tests\Unit\TestHelpers' not found in /home/mrg/www/Project/telegram_bots/seller_bot/index.php:5\nStack trace:\n#0 {main}\n thrown in /home/mrg/www/Project/telegram_bots/seller_bot/index.php on line 5

Steps to reproduce

i put this code in index.php:

<?php
require __DIR__ . "/../vendor/autoload.php";
var_dump(\Longman\TelegramBot\Tests\Unit\TestHelpers::getFakeRecordedAudio());

selection_001

Extra details

the file TestHelpers.php in /home/mrg/www/Project/telegram_bots/seller_bot/vendor/longman/telegram-bot/tests/unit is exists

jacklul commented 7 years ago

Why are you trying to run unit tests just like that?

If you're sure what you're doing then you have to add php unit into your project and do composer update. (php unit is a development dependency, it won't be installed if you just require this project with composer)

noplanman commented 7 years ago

@mintux What are you trying to do?

Please please please don't rely on anything in the tests part of this project, as there will be big changes happening soon that I've been working on. If there's anything you really need, copy it into a separate class of yours and include that into your project 👍

And as @jacklul says, to run the tests you need to get PHPUnit.