Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added FileInputTest #674

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions tests/FileInputTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Telegram\Bot\Tests;

use Telegram\Bot\FileUpload\InputFile;

class FileInputTest extends \PHPUnit_Framework_TestCase
{
/** @test */
public function it_ensures_the_open_method_return_resource()
{
$object = new InputFile('https://telegram.org/img/t_logo.png');

try {
$this->assertEquals(is_resource($object->open()), true);
} catch (\RuntimeException $e) {
/*
* skip this test, if run without internet connection
*/
$this->assertInstanceOf(InputFile::class, $object);
}
}

/** @test */
public function it_ensures_the_getFileName_use_basename()
{
$object = new InputFile('https://telegram.org/img/t_logo.png');

$this->assertEquals($object->getFileName(), basename('https://telegram.org/img/t_logo.png'));
}
}