<commit_before><?php

namespace Jackalope;

class NodeTest extends TestCase
{
    protected $JSON = '{":jcr:primaryType":"Name","jcr:primaryType":"rep:root","jcr:system":{},"tests_level1_access_base":{}}';

    protected function createNode()
    {
        $factory = new \Jackalope\Factory;
        $session = $this->getSessionMock();
        $objectManager = $this->getMock('Jackalope\ObjectManager', array(), array($factory), '', false);
        $objectManager->expects($this->any())
            ->method('getNodesByPath')
            ->will($this->returnValue(new \ArrayIterator(array())));
        $node = new Node($factory, json_decode($this->JSON), '/jcr:node', $session, $objectManager);
        return $node;
    }

    public function testConstructor()
    {
        $node = $this->createNode();
        $this->assertInstanceOf('Jackalope\Session', $node->getSession());
        $this->assertInstanceOf('Jackalope\Node', $node);
        $children = $node->getNodes();
        $this->assertInstanceOf('Iterator', $children);
        $this->assertSame(2, count($children));
    }

    public function testNodeType()
    {
        $node = $this->createNode();
        $this->assertTrue($node->isNodeType('rep:root'), "Should return true on is 'rep:root' node type.");
        //TODO: Activate this…
        // $this->assertTrue($node->getPrimaryNodeType()->isNodeType('rep:root'));
    }

    public function testFilterNames()<commit_msg>getNodesByPath Mock should return 2 childs<commit_after><?php

namespace Jackalope;

class NodeTest extends TestCase
{
    protected $JSON = '{":jcr:primaryType":"Name","jcr:primaryType":"rep:root","jcr:system":{},"tests_level1_access_base":{}}';

    protected function createNode()
    {
        $factory = new \Jackalope\Factory;
        $session = $this->getSessionMock();
        $objectManager = $this->getMock('Jackalope\ObjectManager', array(), array($factory), '', false);
        $objectManager->expects($this->any())
            ->method('getNodesByPath')
            ->will($this->returnValue(new \ArrayIterator(array("/jcr:root/tests_level1_access_base" => array(), "/jcr:root/jcr:system" => array()))));
        $node = new Node($factory, json_decode($this->JSON), '/jcr:root', $session, $objectManager);
        return $node;
    }

    public function testConstructor()
    {
        $node = $this->createNode();
        $this->assertInstanceOf('Jackalope\Session', $node->getSession());
        $this->assertInstanceOf('Jackalope\Node', $node);
        $children = $node->getNodes();
        $this->assertInstanceOf('Iterator', $children);
        $this->assertSame(2, count($children));
    }

    public function testNodeType()
    {
        $node = $this->createNode();
        $this->assertTrue($node->isNodeType('rep:root'), "Should return true on is 'rep:root' node type.");
        //TODO: Activate this…
        // $this->assertTrue($node->getPrimaryNodeType()->isNodeType('rep:root'));
    }

    public function testFilterNames()
{'fraction_non_alphanumeric': 0.17994001999333556, 'fraction_numerical': 0.001999333555481506, 'mean_word_length': 3.5416036308623298, 'pattern_counts': {'":': 10, '<': 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': '7561893', 'n_tokens_mistral': 878, 'n_tokens_neox': 872, 'n_words': 151}