Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions tests/PhpcrUtils/NodeHelperTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

/*
* This file is part of the PHPCR API Tests package
*
* Copyright (c) 2015 Liip and others
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace PHPCR\Tests\PhpcrUtils;

use PHPCR\PropertyType;
use PHPCR\Util\NodeHelper;
use PHPCR\Test\BaseCase;

/**
* Functional test for the node helper.
*/
class NodeHelperTest extends BaseCase
{
protected function setUp()
{
if (!class_exists('PHPCR\Util\NodeHelper')) {
$this->markTestSkipped('This testbed does not have phpcr-utils available');
}
parent::setUp();
}

public function testCreatePartialPath()
{
$node = NodeHelper::createPath($this->session, '/tests_general_base/index.txt/jcr:content/test/node');
$this->assertInstanceOf('PHPCR\NodeInterface', $node);
$this->session->save();
}

public function testCreateNewPath()
{
$node = NodeHelper::createPath($this->session, '/tests_nodehelper/test/node');
$this->assertInstanceOf('PHPCR\NodeInterface', $node);
$this->session->save();
}

public function testCreateExistingPath()
{
$node = NodeHelper::createPath($this->session, '/tests_general_base/index.txt');
$this->assertInstanceOf('PHPCR\NodeInterface', $node);
$this->assertFalse($this->session->hasPendingChanges());
}
}