|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * This file is part of the PHPCR API Tests package |
| 5 | + * |
| 6 | + * Copyright (c) 2015 Liip and others |
| 7 | + * |
| 8 | + * For the full copyright and license information, please view the LICENSE |
| 9 | + * file that was distributed with this source code. |
| 10 | + */ |
| 11 | + |
| 12 | +namespace PHPCR\Tests\PhpcrUtils; |
| 13 | + |
| 14 | +use PHPCR\PropertyType; |
| 15 | +use PHPCR\Util\NodeHelper; |
| 16 | +use PHPCR\Test\BaseCase; |
| 17 | + |
| 18 | +/** |
| 19 | + * Functional test for the node helper. |
| 20 | + */ |
| 21 | +class NodeHelperTest extends BaseCase |
| 22 | +{ |
| 23 | + protected function setUp() |
| 24 | + { |
| 25 | + if (!class_exists('PHPCR\Util\NodeHelper')) { |
| 26 | + $this->markTestSkipped('This testbed does not have phpcr-utils available'); |
| 27 | + } |
| 28 | + parent::setUp(); |
| 29 | + } |
| 30 | + |
| 31 | + public function testCreatePartialPath() |
| 32 | + { |
| 33 | + $node = NodeHelper::createPath($this->session, '/tests_general_base/index.txt/jcr:content/test/node'); |
| 34 | + $this->assertInstanceOf('PHPCR\NodeInterface', $node); |
| 35 | + $this->session->save(); |
| 36 | + } |
| 37 | + |
| 38 | + public function testCreateNewPath() |
| 39 | + { |
| 40 | + $node = NodeHelper::createPath($this->session, '/tests_nodehelper/test/node'); |
| 41 | + $this->assertInstanceOf('PHPCR\NodeInterface', $node); |
| 42 | + $this->session->save(); |
| 43 | + } |
| 44 | + |
| 45 | + public function testCreateExistingPath() |
| 46 | + { |
| 47 | + $node = NodeHelper::createPath($this->session, '/tests_general_base/index.txt'); |
| 48 | + $this->assertInstanceOf('PHPCR\NodeInterface', $node); |
| 49 | + $this->assertFalse($this->session->hasPendingChanges()); |
| 50 | + } |
| 51 | +} |
0 commit comments