<commit_before><?php

namespace Tests\PHP\Manipulator;

use PHP\Manipulator\FileContainer;
use PHP\Manipulator\Token;

/**
 * @group TokenContainer
 * @group FileContainer
 */
class FileContainerTest extends \Tests\TestCase
{

    public function setUp()
    {
        file_put_contents(TESTS_PATH . 'tmp/test.php', '<?php echo $foo; ?>');
    }

    public function tearDown()
    {
        @unlink(TESTS_PATH . 'tmp/test.php');
        @unlink(TESTS_PATH . 'tmp/test2.php');
    }


    /**
     * @covers \PHP\Manipulator\FileContainer
     */
    public function testContainer()
    {
        $reflection = new \ReflectionClass('PHP\Manipulator\FileContainer');
        $this->assertEquals('PHP\Manipulator\TokenContainer', $reflection->getParentClass()->getName());
    }

    /**
     * @covers \PHP\Manipulator\FileContainer::__construct
     */
    public function testConstruct()
    {
        $this->markTestIncomplete('not implemented yet');
    }

    /**
     * @covers \PHP\Manipulator\FileContainer::__construct
     */
    public function testConstructThrowsExceptionIfFileNotExists()
    {
        try {
            $container = new FileContainer('/path/to/not/existingFile');
            $this->fail('Expected exception not thrown');
        } catch (\Exception $e) {
            $this->assertEquals('Unable to open file for reading: /path/to/not/existingFile', $e->getMessage(), 'Wrong exception message');
        }
    }

    /**
     * @covers \PHP\Manipulator\FileContainer::__construct<commit_msg>Test for FileContainer::getFile<commit_after><?php

namespace Tests\PHP\Manipulator;

use PHP\Manipulator\FileContainer;
use PHP\Manipulator\Token;

/**
 * @group TokenContainer
 * @group FileContainer
 */
class FileContainerTest extends \Tests\TestCase
{

    public function setUp()
    {
        file_put_contents(TESTS_PATH . 'tmp/test.php', '<?php echo $foo; ?>');
    }

    public function tearDown()
    {
        @unlink(TESTS_PATH . 'tmp/test.php');
        @unlink(TESTS_PATH . 'tmp/test2.php');
    }


    /**
     * @covers \PHP\Manipulator\FileContainer
     */
    public function testContainer()
    {
        $reflection = new \ReflectionClass('PHP\Manipulator\FileContainer');
        $this->assertEquals('PHP\Manipulator\TokenContainer', $reflection->getParentClass()->getName());
    }

    /**
     * @covers \PHP\Manipulator\FileContainer::__construct
     */
    public function testConstruct()
    {
        $this->markTestIncomplete('not implemented yet');
    }

    /**
     * @covers \PHP\Manipulator\FileContainer::getFile
     */
    public function testGetFile()
    {
        $container = new FileContainer(TESTS_PATH . 'tmp/test.php');
        $this->assertEquals(TESTS_PATH . 'tmp/test.php', $container->getFile());
    }

    /**
     * @covers \PHP\Manipulator\FileContainer::__construct
     */
    public function testConstructThrowsExceptionIfFileNotExists()
    {
        try {
            $container = new FileContainer('/path/to/not/existingFile');
            $this->fail('Expected exception not thrown');
        } catch (\Exception $e) {
            $this->assertEquals('Unable to open file for reading: /path/to/not/existingFile', $e->getMessage(), 'Wrong exception message');
        }
    }

    /**
     * @covers \PHP\Manipulator\FileContainer::__construct
{'fraction_non_alphanumeric': 0.14092548076923078, 'fraction_numerical': 0.0006009615384615385, 'mean_word_length': 2.761581920903955, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, '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': '365480', 'n_tokens_mistral': 988, 'n_tokens_neox': 976, 'n_words': 167}