<commit_before><?php

namespace XhProf;

class ProfilerTest extends \PHPUnit_Framework_TestCase
{
    private $storage;
    private $profiler;

    protected function setUp()
    {
        if (!extension_loaded('xhprof')) {
            $this->markTestSkipped('The xhprof extension must be loaded first');
        }

        $this->storage = $this->getMock('XhProf\\Storage\\StorageInterface');
        $this->profiler = new Profiler($this->storage);
    }

    protected function tearDown()
    {
	if (!extension_loaded('xhprof')) {
            return;
	}

        if ($this->profiler->isRunning()) {
            $this->profiler->stop();
        }
    }

    /**
     * @expectedException \LogicException
     */
    public function testProfilerCannotStartTwice()
    {
        $this->profiler->start();
        $this->profiler->start();
    }

    /**
     * @expectedException \LogicException
     */
    public function testProfilerCannotBeStoppedBeforeBeingStarted()
    {
        $this->profiler->stop();
    }

    public function testProfiler()
    {
        $this->storage->expects($this->once())->method('store');<commit_msg>Fixed CS<commit_after><?php

namespace XhProf;

class ProfilerTest extends \PHPUnit_Framework_TestCase
{
    private $storage;
    private $profiler;

    protected function setUp()
    {
        if (!extension_loaded('xhprof')) {
            $this->markTestSkipped('The xhprof extension must be loaded first');
        }

        $this->storage = $this->getMock('XhProf\\Storage\\StorageInterface');
        $this->profiler = new Profiler($this->storage);
    }

    protected function tearDown()
    {
	    if (!extension_loaded('xhprof')) {
            return;
        }

        if ($this->profiler->isRunning()) {
            $this->profiler->stop();
        }
    }

    /**
     * @expectedException \LogicException
     */
    public function testProfilerCannotStartTwice()
    {
        $this->profiler->start();
        $this->profiler->start();
    }

    /**
     * @expectedException \LogicException
     */
    public function testProfilerCannotBeStoppedBeforeBeingStarted()
    {
        $this->profiler->stop();
    }

    public function testProfiler()
    {
        $this->storage->expects($this->once())->method('store');
{'fraction_non_alphanumeric': 0.1424802110817942, 'fraction_numerical': 0.0, 'mean_word_length': 2.4210526315789473, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, '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': '6693542', 'n_tokens_mistral': 669, 'n_tokens_neox': 675, 'n_words': 108}