<commit_before><?php
/*
 * This file is part of the Onema {classyfile} Package.
 * For the full copyright and license information, 
 * please view the LICENSE file that was distributed 
 * with this source code.
 */
namespace Onema\Test;
use Onema\ClassyFile\Event\ClassyFileEvent;
use Onema\ClassyFile\Event\TraverseEvent;
use Onema\ClassyFile\Plugin\CreateNamespace;

/**
 * CreateNamespaceTest - Description. 
 *
 * @author <NAME> <<EMAIL>>
 * @copyright (c) 2015, Onema
 */
class CreateNamespaceTest extends \PHPUnit_Framework_TestCase
{
    public function testCreateNamespace()
    {
        $statement = new \stdClass();
        $event = new TraverseEvent($statement, '', '/foo/Vendor/Product/src/', 'file.php');
        $plugin = new CreateNamespace(2, 2);
        $plugin->onTraverseAddNamespace($event);
        $namespace = $event->getNamespace();

        $this->assertEquals('Vendor\Product', $namespace);

        $event->setDirectoryPath('/lala/foo/bar/poz/');
        $event->setFile('FooBar.php');
        $plugin->onTraverseAddNamespace($event);
        $namespace = $event->getNamespace();

        $this->assertEquals('foo\bar', $namespace);
    }

    public function testSubscribedEvents()
    {
        $subscribedEvents = CreateNamespace::getSubscribedEvents();
        $this->assertArrayHasKey(ClassyFileEvent::TRAVERSE, $subscribedEvents, 'The subscriber is not returning a valid event.');<commit_msg>update tests<commit_after><?php
/*
 * This file is part of the Onema {classyfile} Package.
 * For the full copyright and license information, 
 * please view the LICENSE file that was distributed 
 * with this source code.
 */
namespace Onema\Test;
use Onema\ClassyFile\Event\ClassyFileEvent;
use Onema\ClassyFile\Event\TraverseEvent;
use Onema\ClassyFile\Plugin\CreateNamespace;

/**
 * CreateNamespaceTest - Description. 
 *
 * @author <NAME> <<EMAIL>>
 * @copyright (c) 2015, Onema
 * @group namespace
 */
class CreateNamespaceTest extends \PHPUnit_Framework_TestCase
{
    public function testCreateNamespace()
    {
        $statement = new \stdClass();
        $event = new TraverseEvent($statement, '', '/foo/Vendor/Product/src/', 'file.php');
        $plugin = new CreateNamespace(2, 2);
        $plugin->onTraverseAddNamespace($event);
        $namespace = $event->getNamespace();

        $this->assertEquals('Vendor\Product', $namespace);

        $event->setDirectoryPath('/lala/foo/bar/poz/');
        $event->setFile('FooBar.php');
        $plugin->onTraverseAddNamespace($event);
        $namespace = $event->getNamespace();

        $this->assertEquals('foo\bar', $namespace);
    }

    public function testSubscribedEvents()
    {
        $subscribedEvents = CreateNamespace::getSubscribedEvents();
        $this->assertArrayHasKey(ClassyFileEvent::TRAVERSE, $subscribedEvents, 'The subscriber is not returning a valid event.');
{'fraction_non_alphanumeric': 0.1336581970066133, 'fraction_numerical': 0.004176818656456666, 'mean_word_length': 3.726973684210526, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 27, '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': '4486747', 'n_tokens_mistral': 831, 'n_tokens_neox': 808, 'n_words': 186}