<commit_before><?php

namespace NbSessions\Test;

use NbSessions\SessionInstance;

class DeleteTest extends TestCase
{
    public function testDeletedKeysDoNotExists()
    {
        $session = new SessionInstance('session');
        $session->set('foo', 'bar');

        $session->delete('foo');

        self::assertNull($session->get('foo'));
        self::assertArrayNotHasKey('foo', $_SESSION);
    }

    public function testDeletesWorksWithMultipleKeys()
    {
        $session = new SessionInstance('session');
        $session->set('foo', 'bar');
        $session->set('sense', 42);

        $session->delete('foo', 'sense');

        self::assertNull($session->get('foo'));
        self::assertNull($session->get('sense'));
    }

    public function testDeletesInSessionFile()
    {
        $session = new SessionInstance('session');
        $session->set('foo', 'bar');

        $this->sessionHandler->shouldReceive('write')
            ->with(session_id(), '')->once()->passthru();

        $session->delete('foo');
    }

    public function testReturnsSessionInstance()
    {
        $session = new SessionInstance('session');
        $session->set('foo', 'bar');

        $result = $session->delete('foo');

        self::assertSame($session, $result);
    }

    public function testDoesNotWriteWhenNothingDeleted()
    {
        $session = new SessionInstance('session');
        $session->set('foo', 'bar');
        $this->sessionHandler->shouldNotReceive('write')->passthru();

        $session->delete('sense');
    }
}
<commit_msg>rename tests from DeleteTest<commit_after><?php

namespace NbSessions\Test;

use NbSessions\SessionInstance;

class DeleteTest extends TestCase
{
    /** @test */
    public function deletedKeysDoNotExists()
    {
        $session = new SessionInstance('session');
        $session->set('foo', 'bar');

        $session->delete('foo');

        self::assertNull($session->get('foo'));
        self::assertArrayNotHasKey('foo', $_SESSION);
    }

    /** @test */
    public function deletesWorksWithMultipleKeys()
    {
        $session = new SessionInstance('session');
        $session->set('foo', 'bar');
        $session->set('sense', 42);

        $session->delete('foo', 'sense');

        self::assertNull($session->get('foo'));
        self::assertNull($session->get('sense'));
    }

    /** @test */
    public function deletesInSessionFile()
    {
        $session = new SessionInstance('session');
        $session->set('foo', 'bar');

        $this->sessionHandler->shouldReceive('write')
            ->with(session_id(), '')->once()->passthru();

        $session->delete('foo');
    }

    /** @test */
    public function returnsSessionInstance()
    {
        $session = new SessionInstance('session');
        $session->set('foo', 'bar');

        $result = $session->delete('foo');

        self::assertSame($session, $result);
    }

    /** @test */
    public function doesNotWriteWhenNothingDeleted()
    {
        $session = new SessionInstance('session');
        $session->set('foo', 'bar');
        $this->sessionHandler->shouldNotReceive('write')->passthru();

        $session->delete('sense');
    }
}

{'fraction_non_alphanumeric': 0.17839195979899497, 'fraction_numerical': 0.001256281407035176, 'mean_word_length': 2.9079754601226995, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, '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': '5750359', 'n_tokens_mistral': 916, 'n_tokens_neox': 877, 'n_words': 146}