<commit_before><?php

namespace DetailTest\Blitline\Response;

use Detail\Blitline\Exception;
use Detail\Blitline\Response\JobProcessed;

class JobProcessedTest extends ResponseTestCase
{
    public function testResponseCanBeCreatedFromHttpResponse()
    {
        $response = JobProcessed::fromHttpResponse($this->getHttpResponseForResult());
        $this->assertInstanceOf(JobProcessed::CLASS, $response);

        $this->setExpectedException(Exception\RuntimeException::CLASS);
        $response = JobProcessed::fromHttpResponse($this->getHttpResponse());
        $response->getResult();
    }

    public function testResponseCanBeCreatedFromData()
    {
        $key = 'key';
        $value = 'value';

        $response = JobProcessed::fromData(array('results' => array($key => $value)));
        $this->assertInstanceOf(JobProcessed::CLASS, $response);
        $this->assertEquals($value, $response->getResult($key));
    }

    public function testImagesCanBeGet()
    {
        $images = array(array('image_identifier' => 'some-image-identifier'));
        $result = array('images' => $images);

        $response = $this->getJobProcessedResponse($result);

        $this->assertEquals($images, $response->getImages());
    }

    public function testFailedImageIdentifiersCanBeGet()
    {
        $response = $this->getJobProcessedResponse(array('failed_image_identifiers' => array()));
        $this->assertFalse($response->hasFailedImageIdentifiers());

        $imageIdentifiers = array('200', '400');

        $response = $this->getJobProcessedResponse(
            array('failed_image_identifiers' => $imageIdentifiers)
        );

        $this->assertTrue($response->hasFailedImageIdentifiers());
        $this->assertEquals($imageIdentifiers, $response->getFailedImageIdentifiers());

        $this->setExpectedException(Exception\RuntimeException::CLASS);
        $response = $this->getJobProcessedResponse(array('failed_image_identifiers' => 'invalid'));
        $response->getFailedImageIdentifiers();

    }

    public function testOriginalMetaCanBeGet()<commit_msg>Fixed code coverage error (PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose)<commit_after><?php

namespace DetailTest\Blitline\Response;

use Detail\Blitline\Exception;
use Detail\Blitline\Response\JobProcessed;

class JobProcessedTest extends ResponseTestCase
{
    public function testResponseCanBeCreatedFromHttpResponse()
    {
        $response = JobProcessed::fromHttpResponse($this->getHttpResponseForResult());
        $this->assertInstanceOf(JobProcessed::CLASS, $response);

        $this->setExpectedException(Exception\RuntimeException::CLASS);
        $response = JobProcessed::fromHttpResponse($this->getHttpResponse());
        $response->getResult();
    }

    public function testResponseCanBeCreatedFromData()
    {
        $key = 'key';
        $value = 'value';

        $response = JobProcessed::fromData(array('results' => array($key => $value)));
        $this->assertInstanceOf(JobProcessed::CLASS, $response);
        $this->assertEquals($value, $response->getResult($key));
    }

    public function testImagesCanBeGet()
    {
        $images = array(array('image_identifier' => 'some-image-identifier'));
        $result = array('images' => $images);

        $response = $this->getJobProcessedResponse($result);

        $this->assertEquals($images, $response->getImages());
    }

    public function testFailedImageIdentifiersCanBeGet()
    {
        $response = $this->getJobProcessedResponse(array('failed_image_identifiers' => array()));
        $this->assertFalse($response->hasFailedImageIdentifiers());

        $imageIdentifiers = array('200', '400');

        $response = $this->getJobProcessedResponse(
            array('failed_image_identifiers' => $imageIdentifiers)
        );

        $this->assertTrue($response->hasFailedImageIdentifiers());
        $this->assertEquals($imageIdentifiers, $response->getFailedImageIdentifiers());

        $this->setExpectedException(Exception\RuntimeException::CLASS);
        $response = $this->getJobProcessedResponse(array('failed_image_identifiers' => 'invalid'));
        $response->getFailedImageIdentifiers();
    }

    public function testOriginalMetaCanBeGet()
{'fraction_non_alphanumeric': 0.13777673104097973, 'fraction_numerical': 0.0030617051342439945, 'mean_word_length': 4.160388821385176, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 61, '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': '6957209', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1114, 'n_words': 153}