Update of /cvsroot/phpwiki/phpwiki/tests
In directory usw-pr-cvs1:/tmp/cvs-serv23113/tests
Modified Files:
unit_test_backend_cvs.php
Log Message:
extended the functionality of the cvs backend, extended the unit test
for the backend. have yet to start on th
Index: unit_test_backend_cvs.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/tests/unit_test_backend_cvs.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** unit_test_backend_cvs.php 2001/10/01 21:58:32 1.1
--- unit_test_backend_cvs.php 2001/11/08 11:01:16 1.2
***************
*** 1,13 ****
<?php
-
/**
* Unit tests the 'lib/WikiDB/backend/cvs.php' file and with it
! * the class WikiDB_backend_cvs
*
* Author: Gerrit Riessen, ger...@op...
*/
! // need to set this to be something sensible ....
! ini_set('include_path', '/www/development/phpwiki' );
function rcs_id()
--- 1,13 ----
<?php
/**
* Unit tests the 'lib/WikiDB/backend/cvs.php' file and with it
! * the class WikiDB_backend_cvs. This isn't based on the PhpUnit, and
! * is designed to be run directly using the php4 command.
*
* Author: Gerrit Riessen, ger...@op...
*/
! // assume that the we've cd'ed to the tests directory
! ini_set('include_path', '..' );
function rcs_id()
***************
*** 18,22 ****
// root user can't check in to a CVS repository
print( "can not be run as root\n" );
! exit(1);
}
--- 18,22 ----
// root user can't check in to a CVS repository
print( "can not be run as root\n" );
! exit();
}
***************
*** 30,34 ****
* These are the parameters required by the backend.
*/
! $db_params[CVS_PAGE_SOURCE] = "/www/development/phpwiki/pgsrc";
$db_params[CVS_CHECK_FOR_REPOSITORY] = true;
// the following three are removed if the test succeeds.
--- 30,34 ----
* These are the parameters required by the backend.
*/
! $db_params[CVS_PAGE_SOURCE] = "../pgsrc";
$db_params[CVS_CHECK_FOR_REPOSITORY] = true;
// the following three are removed if the test succeeds.
***************
*** 64,78 ****
// Check that the meta data files were created
//
! function get_pagedata( $item, $key, $cvsdb )
{
global $REMOVE_DEBUG;
! $pageHash = $cvsdb->get_pagedata( $item );
if ( $pageHash[CMD_VERSION] != "2" ) {
! print "*** Error: [$item] version wrong (". $pageHash[CMD_VERSION]
! .")\n";
$REMOVE_DEBUG = false;
}
}
array_walk( $allPageNames, 'get_pagedata', $cvsdb );
//
--- 64,109 ----
// Check that the meta data files were created
//
! function get_pagedata( $page_name, $key, &$cvsdb )
{
global $REMOVE_DEBUG;
! $pageHash = $cvsdb->get_pagedata( $page_name );
! if ( $pageHash[CMD_VERSION] != "1" ) {
! print ( "*** Error: [$page_name] version wrong 1 != "
! . $pageHash[CMD_VERSION] ."\n" );
! $REMOVE_DEBUG = false;
! }
!
! $new_data = array();
! $new_data[CMD_CONTENT] = "";
! $cvsdb->update_pagedata( $page_name, $new_data );
!
! $pageHash = $cvsdb->get_pagedata( $page_name );
if ( $pageHash[CMD_VERSION] != "2" ) {
! print ( "*** Error: [$page_name] version wrong 2 != "
! . $pageHash[CMD_VERSION] ."\n" );
$REMOVE_DEBUG = false;
}
}
array_walk( $allPageNames, 'get_pagedata', $cvsdb );
+
+ //
+ // test the add and delete pages
+ //
+ $new_page_data = array();
+ $pname = "Hello_World_Fubar";
+
+ $new_page_data[CMD_CONTENT] = "hello world\nPlease to meet you\n\n";
+ $cvsdb->update_pagedata( $pname, $new_page_data );
+ if ( $cvsdb->get_latest_version( $pname ) != "1" ) {
+ print( "***Error Line " . __LINE__ . ": expecting version number 1\n");
+ $REMOVE_DEBUG=false;
+ }
+
+ $new_page_data[CMD_CONTENT] = "goodbye cruel world\nbye bye....\n";
+ $cvsdb->update_pagedata( $pname, $new_page_data );
+ if ( $cvsdb->get_latest_version( $pname ) != "2" ) {
+ print( "***Error Line " . __LINE__ . ": expecting version number 2\n");
+ $REMOVE_DEBUG=false;
+ }
//
|