Author: dr
Date: Wed Oct 10 18:50:18 2007
New Revision: 6417
Log:
- Added missing files.
Added:
trunk/Tree/src/exceptions/unknown_id.php (with props)
trunk/TreeDatabaseTiein/tests/db_materialized_path_tree_diff_separator.php
(with props)
Added: trunk/Tree/src/exceptions/unknown_id.php
==============================================================================
--- trunk/Tree/src/exceptions/unknown_id.php (added)
+++ trunk/Tree/src/exceptions/unknown_id.php [iso-8859-1] Wed Oct 10 18:50:18
2007
@@ -1,0 +1,31 @@
+<?php
+/**
+ * File containing the ezcTreeUnknownIdException class.
+ *
+ * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ * @version //autogentag//
+ * @filesource
+ * @package Tree
+ */
+
+/**
+ * Exception that is thrown when a node is request through an unknown
+ * (non-existing) ID.
+ *
+ * @package Tree
+ * @version //autogentag//
+ */
+class ezcTreeUnknownIdException extends ezcTreeException
+{
+ /**
+ * Constructs a new ezcTreeUnknownIdException for the ID $nodeId.
+ *
+ * @param string $nodeId
+ */
+ public function __construct( $nodeId )
+ {
+ parent::__construct( "The node with ID '{$nodeId}' could not be
found." );
+ }
+}
+?>
Propchange: trunk/Tree/src/exceptions/unknown_id.php
------------------------------------------------------------------------------
svn:eol-style = native
Added:
trunk/TreeDatabaseTiein/tests/db_materialized_path_tree_diff_separator.php
==============================================================================
--- trunk/TreeDatabaseTiein/tests/db_materialized_path_tree_diff_separator.php
(added)
+++ trunk/TreeDatabaseTiein/tests/db_materialized_path_tree_diff_separator.php
[iso-8859-1] Wed Oct 10 18:50:18 2007
@@ -1,0 +1,96 @@
+<?php
+/**
+ * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ * @version //autogentag//
+ * @filesource
+ * @package TreeDatabaseTiein
+ * @subpackage Tests
+ */
+
+require_once 'Tree/tests/tree.php';
+require_once 'db_tree.php';
+require_once 'db_materialized_path_tree.php';
+
+/**
+ * @package TreeDatabaseTiein
+ * @subpackage Tests
+ */
+class ezcTreeDbMaterializedPathTestWithDifferentSeparator extends
ezcTreeDbMaterializedPathTest
+{
+ private $tempDir;
+
+ public function insertData()
+ {
+ // insert test data
+ $data = array(
+ // child -> parent
+ 1 => array( 'null', '@1' ),
+ 2 => array( 1, '@[EMAIL PROTECTED]' ),
+ 3 => array( 1, '@[EMAIL PROTECTED]' ),
+ 4 => array( 1, '@[EMAIL PROTECTED]' ),
+ 6 => array( 4, '@[EMAIL PROTECTED]@6' ),
+ 7 => array( 6, '@[EMAIL PROTECTED]@[EMAIL PROTECTED]' ),
+ 8 => array( 6, '@[EMAIL PROTECTED]@[EMAIL PROTECTED]' ),
+ 5 => array( 1, '@[EMAIL PROTECTED]' ),
+ 9 => array( 5, '@[EMAIL PROTECTED]@9' ),
+ );
+ foreach( $data as $childId => $details )
+ {
+ list( $parentId, $path ) = $details;
+ $this->dbh->exec( "INSERT INTO materialized_path(id, parent_id,
path) VALUES( $childId, $parentId, '$path' )" );
+ }
+
+ // add data
+ for ( $i = 1; $i <= 8; $i++ )
+ {
+ $this->dbh->exec( "INSERT INTO data(id, data) values ( $i, 'Node
$i' )" );
+ }
+ }
+
+ protected function setUpEmptyTestTree( $dataTable = 'data', $dataField =
'data' )
+ {
+ $store = new ezcTreeDbExternalTableDataStore( $this->dbh, $dataTable,
'id', $dataField );
+ $tree = ezcTreeDbMaterializedPath::create(
+ $this->dbh,
+ 'materialized_path',
+ $store,
+ '@'
+ );
+ $this->emptyTables();
+ return $tree;
+ }
+
+ protected function setUpTestTree( $dataTable = 'data', $dataField = 'data'
)
+ {
+ $store = new ezcTreeDbExternalTableDataStore( $this->dbh, $dataTable,
'id', $dataField );
+ $tree = new ezcTreeDbMaterializedPath(
+ $this->dbh,
+ 'materialized_path',
+ $store,
+ '@'
+ );
+ return $tree;
+ }
+
+ public function testWithWrongSeparationChar()
+ {
+ $store = new ezcTreeDbExternalTableDataStore( $this->dbh, 'data',
'id', 'data' );
+ $tree = new ezcTreeDbMaterializedPath(
+ $this->dbh,
+ 'materialized_path',
+ $store,
+ '$'
+ );
+
+ $nodeList = $tree->fetchNodeById( 4 )->fetchSubtree();
+ self::assertSame( 1, $nodeList->size );
+ }
+
+ public static function suite()
+ {
+ return new PHPUnit_Framework_TestSuite(
"ezcTreeDbMaterializedPathTestWithDifferentSeparator" );
+ }
+}
+
+?>
Propchange:
trunk/TreeDatabaseTiein/tests/db_materialized_path_tree_diff_separator.php
------------------------------------------------------------------------------
svn:eol-style = native
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components