<commit_before><?php

/*
 * This file is part of the Spira framework.
 *
 * @link https://github.com/spira/spira
 *
 * For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
 */

/**
 * Class CloudinaryTest.
 * @group testing
 */
class CloudinaryTest extends TestCase
{
    public function testRequestSigning()
    {
        $cloudinary = Mockery::mock('\Cloudinary')->makePartial();
        $api = Mockery::mock('\Cloudinary\Api')->makePartial();
        $cloudinaryService = new \App\Services\Cloudinary($cloudinary, $api);

        $signature = $cloudinaryService->signRequestParams([
            'foo1' => 'bar1',
            'foo2' => 'bar2',
        ]);

        $this->assertInternalType('string', $signature);
        $this->assertEquals(sha1('foo1=bar1&foo2=bar2'.env('CLOUDINARY_API_SECRET')), $signature);
    }
}<commit_msg>Added tests for cloudinary image retrieval<commit_after><?php

/*
 * This file is part of the Spira framework.
 *
 * @link https://github.com/spira/spira
 *
 * For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
 */

/**
 * Class CloudinaryTest.
 * @group testing
 */
class CloudinaryTest extends TestCase
{
    public function testRequestSigning()
    {
        $cloudinary = Mockery::mock('\Cloudinary')->makePartial();
        $api = Mockery::mock('\Cloudinary\Api')->makePartial();
        $cloudinaryService = new \App\Services\Cloudinary($cloudinary, $api);

        $signature = $cloudinaryService->signRequestParams([
            'foo1' => 'bar1',
            'foo2' => 'bar2',
        ]);

        $this->assertInternalType('string', $signature);
        $this->assertEquals(sha1('foo1=bar1&foo2=bar2'.env('CLOUDINARY_API_SECRET')), $signature);
    }

    public function testRequestAllImages()
    {

        $cloudinary = Mockery::mock(\Cloudinary::class)->makePartial();
        $api = Mockery::mock(\Cloudinary\Api::class)->makePartial();
        $response = Mockery::mock(\Cloudinary\Api\Response::class);

        $api->shouldReceive('resources')
            ->once()
            ->andReturn($response);

        $cloudinaryService = new \App\Services\Cloudinary($cloudinary, $api);

        $cloudinaryService->getRemoteImages();
    }

}
{'fraction_non_alphanumeric': 0.148323301805675, 'fraction_numerical': 0.007738607050730868, 'mean_word_length': 3.2155797101449277, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 2, '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': '3295470', 'n_tokens_mistral': 670, 'n_tokens_neox': 665, 'n_words': 140}