<commit_before><?php
namespace Lead\Env\Spec\Suite;

use Lead\Env\Env;

describe("Env", function() {

    beforeEach(function() {
        $this->env = new Env([], false);
    });

    describe("->__construct()", function() {

        it("sets default environment variables", function() {

            $env = new Env();
            expect($env->data())->toBe(['PHP_SAPI' => 'cli']);

        });

        it("don't normalize variables", function() {

            $env = new Env([], false);
            expect($env->data())->toBe([]);

        });

    });

    describe("->offsetSet()/->offsetGet()", function() {

        it("sets a variable", function() {

            $this->env['CUSTOM_VARIABLE'] = 'myvalue';
            expect($this->env['CUSTOM_VARIABLE'])->toBe('myvalue');
            expect($this->env->data())->toBe([
                'CUSTOM_VARIABLE' => 'myvalue'
            ]);

        });

        it("sets an array of variables", function() {

            expect($this->env->set([
                'CUSTOM_VARIABLE1' =>'myvalue1',
                'CUSTOM_VARIABLE2' =>'myvalue2'
            ]))->toBe($this->env);

            expect($this->env->data())->toBe([
                'CUSTOM_VARIABLE1' =>'myvalue1',
                'CUSTOM_VARIABLE2' =>'myvalue2'
            ]);

        });

        it("returns `false` for unexisting value", function() {

            expect($this->env['CUSTOM_VARIABLE'])->toBe(false);

        });

    });

    describe("->offsetExists()", function() {

        it("checks if a variable exists", function() {

            expect(isset($this->env['CUSTOM_VARIABLE']))->toBe(false);
            $this->env['CUSTOM_VARIABLE'] = 'myvalue';
            expect(isset($this->env['CUSTOM_VARIABLE']))->toBe(true);

        });

    });

    describe("->offsetUnset()", function() {

        it("removes an environment variable", function() {

            $this->env['CUSTOM_VARIABLE'] = 'myvalue';<commit_msg>Enhances code coverage.<commit_after><?php
namespace Lead\Env\Spec\Suite;

use Lead\Env\Env;

describe("Env", function() {

    beforeEach(function() {
        $this->env = new Env([], false);
    });

    describe("->__construct()", function() {

        it("sets default environment variables", function() {

            $env = new Env();
            expect($env->data())->toBe(['PHP_SAPI' => 'cli']);

        });

        it("don't normalize variables", function() {

            $env = new Env([], false);
            expect($env->data())->toBe([]);

        });

    });

    describe("->offsetSet()/->offsetGet()", function() {

        it("sets a variable", function() {

            $this->env['CUSTOM_VARIABLE'] = 'myvalue';
            expect($this->env['CUSTOM_VARIABLE'])->toBe('myvalue');
            expect($this->env->data())->toBe([
                'CUSTOM_VARIABLE' => 'myvalue'
            ]);

        });

        it("returns `false` for unexisting value", function() {

            expect($this->env['CUSTOM_VARIABLE'])->toBe(false);

        });

    });

    describe("->set()", function() {

        it("sets a variable", function() {

            $this->env->set('CUSTOM_VARIABLE', 'myvalue');
            expect($this->env['CUSTOM_VARIABLE'])->toBe('myvalue');
            expect($this->env->data())->toBe([
                'CUSTOM_VARIABLE' => 'myvalue'
            ]);

        });

        it("sets an array of variables", function() {

            expect($this->env->set([
                'CUSTOM_VARIABLE1' =>'myvalue1',
                'CUSTOM_VARIABLE2' =>'myvalue2'
            ]))->toBe($this->env);

            expect($this->env->data())->toBe([
                'CUSTOM_VARIABLE1' =>'myvalue1',
                'CUSTOM_VARIABLE2' =>'myvalue2'
            ]);

        });

    });

    describe("->offsetExists()", function() {

        it("checks if a variable exists", function() {

            expect(isset($this->env['CUSTOM_VARIABLE']))->toBe(false);
            $this->env['CUSTOM_VARIABLE'] = 'myvalue';
            expect(isset($this->env['CUSTOM_VARIABLE']))->toBe(true);

        });

    });

    describe("->offsetUnset()", function() {

        it("removes an environment variable", function() {

            $this->env['CUSTOM_VARIABLE'] = 'myvalue';
{'fraction_non_alphanumeric': 0.20084666039510818, 'fraction_numerical': 0.0037629350893697085, 'mean_word_length': 2.111192392099488, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 86, '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': '5794672', 'n_tokens_mistral': 1338, 'n_tokens_neox': 1253, 'n_words': 193}