<commit_before><?php

/**
 * Created by PhpStorm.
 * User: gpl
 * Date: 15/10/28
 * Time: 下午9:24
 */
namespace Dy\Ring\Test;

use Dy\Ring\Backend\LocalBackend;
use Dy\Ring\Source\LocalFile;
use Dy\Ring\Uploader;

class UploaderTest extends \PHPUnit_Framework_TestCase
{
    public function testUploader()
    {
        $local = new LocalBackend("example/data");
        $source = new LocalFile("tests/images/normal.jpg");
        $uploader = new Uploader($local, $source);
        $uploader->check();
    }
}<commit_msg>Add test for uploader<commit_after><?php

/**
 * Created by PhpStorm.
 * User: gpl
 * Date: 15/10/28
 * Time: 下午9:24
 */
namespace Dy\Ring\Test;

use Dy\Ring\Backend\LocalBackend;
use Dy\Ring\Rule\MimeTypeRule;
use Dy\Ring\Rule\SizeRule;
use Dy\Ring\Source\LocalFile;
use Dy\Ring\Uploader;

class UploaderTest extends \PHPUnit_Framework_TestCase
{
    public function testUploader()
    {
        $local = new LocalBackend("example/data");
        $source = new LocalFile("tests/images/normal.jpg");
        $uploader = new Uploader($local, $source);
        $uploader->addRule(new SizeRule(100000));
        $uploader->check();
    }

    public function testUploaderRuleFail()
    {
        $this->setExpectedException('Dy\Ring\Exception\InvalidArgumentException');
        $local = new LocalBackend("example/data");
        $source = new LocalFile("tests/images/normal.jpg");
        $uploader = new Uploader($local, $source);
        $uploader->addRule(new MimeTypeRule(array('mie/sheep')));
        $uploader->check();
    }
}
{'fraction_non_alphanumeric': 0.14442295293359123, 'fraction_numerical': 0.015473887814313346, 'mean_word_length': 3.299168975069252, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, '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': '2322499', 'n_tokens_mistral': 535, 'n_tokens_neox': 515, 'n_words': 98}