Skip to content

Commit f6d8a6a

Browse files
committed
Add tests for download helper
1 parent aa99427 commit f6d8a6a

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace Tooly\Tests\Script\Helper;
4+
5+
use phpmock\phpunit\PHPMock;
6+
use Tooly\Script\Helper\Downloader;
7+
8+
/**
9+
* @package Tooly\Tests\Script\Helper
10+
*/
11+
class DownloaderTest extends \PHPUnit_Framework_TestCase
12+
{
13+
use PHPMock;
14+
15+
public function testAccessibleTestWorksCorrect()
16+
{
17+
$downloader = new Downloader;
18+
19+
$this->assertFalse($downloader->isAccessible('foo'));
20+
$this->assertTrue($downloader->isAccessible('https://github.com/tommy-muehle/tooly-composer-script/blob/master/README.md'));
21+
}
22+
23+
public function testCanDownloadContentFromUrl()
24+
{
25+
$downloader = new Downloader;
26+
27+
$this->assertRegExp(
28+
'/tooly-composer-script/',
29+
$downloader->download('https://github.com/tommy-muehle/tooly-composer-script/blob/master/README.md')
30+
);
31+
}
32+
}

0 commit comments

Comments
 (0)