<commit_before><?php
/**
 * Created by PhpStorm.
 * User: alexander
 * Date: 12/18/14
 * Time: 5:08 PM
 */
namespace MediaTest\Service;

use Zend\Http\Response;
use Zend\Stdlib;
use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;

/**
 * Class BlueimpTest
 * @package MediaTest\Service
 */
class BlueimpTest extends AbstractHttpControllerTestCase
{
    /**
     * @var bool
     */
    protected $traceError=true;

    /**
     * @var \Media\Service\Blueimp
     */
    private $blueimpService;

    /**
     *  Migration up
     */
    public static function setUpBeforeClass()
    {
        exec('vendor/bin/doctrine-module orm:schema-tool:update --force');
    }

    /**
     * Migration down
     */
    public static function tearDownAfterClass()
    {
        exec('vendor/bin/doctrine-module orm:schema-tool:drop --force');
    }

    /**
     * Set up
     */
    public function setUp()
    {
        $this->setApplicationConfig(include 'config/application.config.php');
        $this->setTraceError(true);
        parent::setUp();
        $this->blueimpService = $this->getApplicationServiceLocator()->get('Media\Service\Blueimp');
    }

    public function testDeleteFileJson()
    {
        $this->assertJson(json_encode($this->blueimpService->deleteFileJson(1)));
    }

    public function testDisplayUploadedFiles()
    {
        $entityManager = $this->getApplicationServiceLocator()->get('Doctrine\ORM\EntityManager');
        $files = $entityManager->getRepository('Media\Entity\File')->findByType('image');
        $deleteUrls = [];
        foreach ($files as $file) {
            array_push($deleteUrls, ['id' => 0, 'deleteUrl' => 0]);
        }
        $this->assertJson(json_encode($this->blueimpService->displayUploadedFiles($files, $deleteUrls)));<commit_msg>Fixed test<commit_after><?php
/**
 * Created by PhpStorm.
 * User: alexander
 * Date: 12/18/14
 * Time: 5:08 PM
 */
namespace MediaTest\Service;

use Zend\Http\Response;
use Zend\Stdlib;
use Zend\Test\PHPUnit\Controller\AbstractHttpControllerTestCase;

/**
 * Class BlueimpTest
 * @package MediaTest\Service
 */
class BlueimpTest extends AbstractHttpControllerTestCase
{
    /**
     * @var bool
     */
    protected $traceError=true;

    /**
     * @var \Media\Service\Blueimp
     */
    private $blueimpService;

    /**
     *  Migration up
     */
    public static function setUpBeforeClass()
    {
        exec('vendor/bin/doctrine-module orm:schema-tool:update --force');
    }

    /**
     * Migration down
     */
    public static function tearDownAfterClass()
    {
        exec('vendor/bin/doctrine-module orm:schema-tool:drop --force');
    }

    /**
     * Set up
     */
    public function setUp()
    {
        $this->setApplicationConfig(include 'config/application.config.php');
        $this->setTraceError(true);
        parent::setUp();
        $this->blueimpService = $this->getApplicationServiceLocator()->get('Media\Service\Blueimp');
    }

    public function testDeleteFileJson()
    {
        $this->assertJson(json_encode($this->blueimpService->deleteFileJson()));
    }

    public function testDisplayUploadedFiles()
    {
        $entityManager = $this->getApplicationServiceLocator()->get('Doctrine\ORM\EntityManager');
        $files = $entityManager->getRepository('Media\Entity\File')->findByType('image');
        $mask = '/mask/mask/';
        $this->assertJson(json_encode($this->blueimpService->displayUploadedFiles($files, $mask)));
{'fraction_non_alphanumeric': 0.1452401495542134, 'fraction_numerical': 0.0060396893874029335, 'mean_word_length': 2.9166666666666665, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '3949535', 'n_tokens_mistral': 1055, 'n_tokens_neox': 1022, 'n_words': 166}