diff --git a/.gitignore b/.gitignore index 9aa1cc65..ce76dbfb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *~ *.tmp .buildpath +.project .settings/ library/Zend/ tests/report/* diff --git a/.project b/.project index 8a213b0a..26b1f6d6 100644 --- a/.project +++ b/.project @@ -5,6 +5,21 @@ + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.dltk.core.scriptbuilder + + + net.sourceforge.phpeclipse.parserbuilder @@ -13,5 +28,7 @@ net.sourceforge.phpeclipse.phpnature + org.eclipse.php.core.PHPNature + org.eclipse.wst.jsdt.core.jsNature diff --git a/application/controllers/WblogbookController.php b/application/controllers/WblogbookController.php index a5a67c49..cf8a8fe2 100644 --- a/application/controllers/WblogbookController.php +++ b/application/controllers/WblogbookController.php @@ -298,7 +298,7 @@ function addAction() Zend_Loader::loadClass('Other_ValidateDatetime'); $validator_datetime = new Other_ValidateDatetime(); - $logDateCreate = trim($this->_request->getPost('logDateCreate')); + $logDateCreate = trim($this->_request->getPost('logDateCreate', date("Y-m-d H:i:s", time() ) ) ); if ( !$validator_datetime->isValid($logDateCreate) ) { $this->view->amessages = array_merge($this->view->amessages, $validator_datetime->getMessages()); @@ -515,10 +515,10 @@ function modifyAction() $this->view->aAllowedTags = $this->aAllowedTags; } - - function savetopdfAction() +/* + function saveToPdfAction() { - /* + http://www.zfforums.com/zend-framework-components-13/mail-formats-search-14/pdf-utf8-bug-not-362.html#post1041 ------------------------------ tim4dev @@ -575,7 +575,8 @@ function savetopdfAction() $page->drawText($text, 20, 20, "UTF-8"); // Save document as a new file or rewrite existing document - $pdf->save($fileName);*/ + $pdf->save($fileName); } - +*/ + } diff --git a/application/models/WbTmpTable.php b/application/models/WbTmpTable.php index b5950fc9..c93ca79a 100644 --- a/application/models/WbTmpTable.php +++ b/application/models/WbTmpTable.php @@ -807,9 +807,15 @@ public function getTotalSummaryMark() } + /* + * Возвращает имя файла, куда будут выгружены записи для восстановления + */ + public function getFilenameToExportMarkFiles() { + return "webacula_restore_" . $this->jobidhash . ".tmp"; + } + /** - * Экспорт помеченных записей в текстовый файл - * + * Экспорт помеченных записей в текстовый файл (для восстановления) */ function exportMarkFiles($dir) { diff --git a/tests/application/bootstrap.php b/tests/application/bootstrap.php index e34d0e1c..6eaba84d 100644 --- a/tests/application/bootstrap.php +++ b/tests/application/bootstrap.php @@ -1,6 +1,6 @@ addTestSuite('IndexControllerTest'); - //$suite->addTestSuite('DirectorControllerTest'); - //$suite->addTestSuite('JobControllerTest'); - //$suite->addTestSuite('ChartControllerTest'); + /*$suite->addTestSuite('DirectorControllerTest'); + $suite->addTestSuite('JobControllerTest'); + $suite->addTestSuite('ChartControllerTest');*/ return $suite; } } diff --git a/tests/application/models/AllTests.php b/tests/application/models/AllTests.php index b28fbf8e..eed2736e 100644 --- a/tests/application/models/AllTests.php +++ b/tests/application/models/AllTests.php @@ -1,5 +1,6 @@ addTestSuite('WbTmpTableTest'); + //$suite->addTestSuite('WbTmpTableTest'); + $suite->addTestSuite('WblogbookTest'); return $suite; } } diff --git a/tests/application/models/Copy_Of_WbTmpTableTest.php b/tests/application/models/Copy_Of_WbTmpTableTest.php deleted file mode 100644 index 0a9c0a3d..00000000 --- a/tests/application/models/Copy_Of_WbTmpTableTest.php +++ /dev/null @@ -1,39 +0,0 @@ -exportMarkFiles() - */ - public function testExportMarkFiles() { - // TODO Auto-generated WbTmpTableTest->testExportMarkFiles() - $this->markTestIncomplete ( "exportMarkFiles test not implemented" ); - - $this->WbTmpTable->exportMarkFiles(/* parameters */); - - } - - /** - * Tests WbTmpTable->cloneRecentBaculaToTmp() - */ - public function testCloneRecentBaculaToTmp() { - // TODO Auto-generated WbTmpTableTest->testCloneRecentBaculaToTmp() - $this->markTestIncomplete ( "cloneRecentBaculaToTmp test not implemented" ); - - $this->WbTmpTable->cloneRecentBaculaToTmp(/* parameters */); - - } - - /** - * Tests WbTmpTable->getListToRestore() - */ - public function testGetListToRestore() { - // TODO Auto-generated WbTmpTableTest->testGetListToRestore() - $this->markTestIncomplete ( "getListToRestore test not implemented" ); - - $this->WbTmpTable->getListToRestore(/* parameters */); - - } - - -} - diff --git a/tests/application/models/WbTmpTableTest.php b/tests/application/models/WbTmpTableTest.php index aeeac2fc..559f1ba8 100644 --- a/tests/application/models/WbTmpTableTest.php +++ b/tests/application/models/WbTmpTableTest.php @@ -97,6 +97,13 @@ public function testMarkDir() { $ares['total_files'] . " failed"); } + function testExportMarkFiles() { + print "\n".__CLASS__."\t".__FUNCTION__.' '; + $ares = $this->WbTmpTable->exportMarkFiles('/tmp'); + $this->assertTrue( ( $ares['result'] && ($ares['count'] == 3607) ), 'error export marked files'); + unlink( '/tmp/'.$this->WbTmpTable->getFilenameToExportMarkFiles() ); + } + public function testUnMarkDir() { print "\n".__CLASS__."\t".__FUNCTION__.' '; $this->WbTmpTable->markDir("/tmp/webacula/test/1/0 Каталог'tmp/", 0); diff --git a/tests/application/models/WblogbookTest.php b/tests/application/models/WblogbookTest.php new file mode 100644 index 00000000..de831b6b --- /dev/null +++ b/tests/application/models/WblogbookTest.php @@ -0,0 +1,65 @@ +logbook = new wbLogBook(); + } + + /** + * Cleans up the environment after running a test. + */ + protected function tearDown() { + $this->logbook = null; + parent::tearDown(); + } + + /** + * Constructs the test case. + */ + public function __construct() { + // empty + } + + public function testIndex() { + print "\n".__CLASS__."\t".__FUNCTION__.' '; + $ret = $this->logbook->IndexLogBook(null, null, null); + $result = $ret->fetchAll(); + $this->assertGreaterThan(3, sizeof($result), 'error select logbook'); + } + + public function testAddRecord() { + print "\n".__CLASS__."\t".__FUNCTION__.' '; + $data = array( + 'logDateCreate' => date("Y-m-d H:i:s", time() ), + 'logTxt' => 'PHPUnit test testAddRecord', + 'logTypeId' => 20 + ); + $id = $this->logbook->insert($data); // возвращает id вставленной записи + $this->assertGreaterThan(3, $id, 'error insert record to logbook'); + } + + public function testUpdateRecord() { + print "\n".__CLASS__."\t".__FUNCTION__.' '; + $data = array( + 'logDateCreate' => date('Y-m-d H:i:s', time()-300), + 'logDateLast' => date('Y-m-d H:i:s', time()), + 'logTypeId' => 30, + 'logTxt' => 'PHPUnit test testUpdateRecord', + 'logIsDel' => 0 + ); + $where = $this->logbook->getAdapter()->quoteInto('logId = ?', 6); + $res = $this->logbook->update($data, $where); // возвращает кол-во измененных записей + $this->assertEquals(1, $res, 'error update record to logbook'); + } + +} diff --git a/tests/phpunit.xml b/tests/phpunit.xml index e624b777..bf359f47 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -6,7 +6,7 @@ convertWarningsToExceptions="true" stopOnFailure="true" syntaxCheck="true"> - +--> diff --git a/regress/bacula_DBcopy_MySQL2PGSQL.php b/tests/prepare_tests/bacula_DBcopy_MySQL2PGSQL.php similarity index 100% rename from regress/bacula_DBcopy_MySQL2PGSQL.php rename to tests/prepare_tests/bacula_DBcopy_MySQL2PGSQL.php diff --git a/regress/bacula_DBcopy_MySQL2sqlite.php b/tests/prepare_tests/bacula_DBcopy_MySQL2sqlite.php similarity index 100% rename from regress/bacula_DBcopy_MySQL2sqlite.php rename to tests/prepare_tests/bacula_DBcopy_MySQL2sqlite.php diff --git a/regress/bacula_mysql_make_tables b/tests/prepare_tests/bacula_mysql_make_tables similarity index 100% rename from regress/bacula_mysql_make_tables rename to tests/prepare_tests/bacula_mysql_make_tables diff --git a/regress/bacula_postgresql_grant_privileges b/tests/prepare_tests/bacula_postgresql_grant_privileges similarity index 100% rename from regress/bacula_postgresql_grant_privileges rename to tests/prepare_tests/bacula_postgresql_grant_privileges diff --git a/regress/bacula_postgresql_make_tables b/tests/prepare_tests/bacula_postgresql_make_tables similarity index 100% rename from regress/bacula_postgresql_make_tables rename to tests/prepare_tests/bacula_postgresql_make_tables diff --git a/regress/bacula_sqlite_make_tables b/tests/prepare_tests/bacula_sqlite_make_tables similarity index 100% rename from regress/bacula_sqlite_make_tables rename to tests/prepare_tests/bacula_sqlite_make_tables diff --git a/regress/clean_all.sh b/tests/prepare_tests/clean_all.sh similarity index 100% rename from regress/clean_all.sh rename to tests/prepare_tests/clean_all.sh diff --git a/regress/create_dir_tree.php b/tests/prepare_tests/create_dir_tree.php similarity index 100% rename from regress/create_dir_tree.php rename to tests/prepare_tests/create_dir_tree.php diff --git a/regress/etc/bacula/bacula-dir.conf b/tests/prepare_tests/etc/bacula/bacula-dir.conf similarity index 100% rename from regress/etc/bacula/bacula-dir.conf rename to tests/prepare_tests/etc/bacula/bacula-dir.conf diff --git a/regress/etc/bacula/bacula-fd.conf b/tests/prepare_tests/etc/bacula/bacula-fd.conf similarity index 100% rename from regress/etc/bacula/bacula-fd.conf rename to tests/prepare_tests/etc/bacula/bacula-fd.conf diff --git a/regress/etc/bacula/bacula-sd.conf b/tests/prepare_tests/etc/bacula/bacula-sd.conf similarity index 100% rename from regress/etc/bacula/bacula-sd.conf rename to tests/prepare_tests/etc/bacula/bacula-sd.conf diff --git a/regress/etc/bacula/bconsole.conf b/tests/prepare_tests/etc/bacula/bconsole.conf similarity index 100% rename from regress/etc/bacula/bconsole.conf rename to tests/prepare_tests/etc/bacula/bconsole.conf diff --git a/regress/etc/bacula/scripts/after_test.sh b/tests/prepare_tests/etc/bacula/scripts/after_test.sh similarity index 100% rename from regress/etc/bacula/scripts/after_test.sh rename to tests/prepare_tests/etc/bacula/scripts/after_test.sh diff --git a/regress/etc/bacula/scripts/before_test.sh b/tests/prepare_tests/etc/bacula/scripts/before_test.sh similarity index 100% rename from regress/etc/bacula/scripts/before_test.sh rename to tests/prepare_tests/etc/bacula/scripts/before_test.sh diff --git a/regress/prepare.sh b/tests/prepare_tests/prepare.sh similarity index 99% rename from regress/prepare.sh rename to tests/prepare_tests/prepare.sh index ff04a876..78098c23 100755 --- a/regress/prepare.sh +++ b/tests/prepare_tests/prepare.sh @@ -12,6 +12,7 @@ fi BACULADIR="etc/bacula" TMPDIR="/tmp/webacula" BASEDIR=`pwd` +INSTALL_DIR="../../install/" ######################################################### # Function @@ -113,7 +114,7 @@ cd ${BASEDIR} sh ./bacula_mysql_make_tables sh ./bacula_sqlite_make_tables -cd ../install/ +cd ${INSTALL_DIR} sh ./webacula_mysql_create_database.sh sh ./webacula_mysql_make_tables.sh @@ -122,7 +123,7 @@ sh ./webacula_postgresql_make_tables.sh sh ./webacula_sqlite_create_database.sh "/tmp/webacula/sqlite/webacula.db" chmod a+rwx /tmp/webacula/sqlite -cd - +cd ${BASEDIR} my_log "Testing Configuration Files ..." diff --git a/regress/sync_bacula_db_from_mysql2others.sh b/tests/prepare_tests/sync_bacula_db_from_mysql2others.sh similarity index 100% rename from regress/sync_bacula_db_from_mysql2others.sh rename to tests/prepare_tests/sync_bacula_db_from_mysql2others.sh diff --git a/regress/test_plan_ru.dokuwiki b/tests/prepare_tests/test_plan_ru.dokuwiki similarity index 100% rename from regress/test_plan_ru.dokuwiki rename to tests/prepare_tests/test_plan_ru.dokuwiki diff --git a/regress/test_plan_ru_unittests.dokuwiki b/tests/prepare_tests/test_plan_ru_unittests.dokuwiki similarity index 100% rename from regress/test_plan_ru_unittests.dokuwiki rename to tests/prepare_tests/test_plan_ru_unittests.dokuwiki diff --git a/regress/webacula_mysql_fill_logbook b/tests/prepare_tests/webacula_mysql_fill_logbook similarity index 100% rename from regress/webacula_mysql_fill_logbook rename to tests/prepare_tests/webacula_mysql_fill_logbook diff --git a/regress/webacula_postgresql_fill_logbook b/tests/prepare_tests/webacula_postgresql_fill_logbook similarity index 100% rename from regress/webacula_postgresql_fill_logbook rename to tests/prepare_tests/webacula_postgresql_fill_logbook diff --git a/regress/webacula_sqlite_fill_logbook b/tests/prepare_tests/webacula_sqlite_fill_logbook similarity index 100% rename from regress/webacula_sqlite_fill_logbook rename to tests/prepare_tests/webacula_sqlite_fill_logbook diff --git a/todo b/todo index 0da15859..3d0b38df 100644 --- a/todo +++ b/todo @@ -1,3 +1,5 @@ префикс _PREFIX_RECENT не юзается в wbtmptable +test подключения языковых файлов + \ No newline at end of file