From 15d4121aeed450f421c06a5a0e29044ac329c8a8 Mon Sep 17 00:00:00 2001 From: Jerry Jalava Date: Fri, 18 Apr 2008 14:07:11 +0300 Subject: [PATCH] Added new test and example --- plugins/ajatus/examples/tags.php | 31 ++++++++++++++++++++++++ plugins/ajatus/tests/helpersTest.php | 47 ++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 plugins/ajatus/examples/tags.php create mode 100644 plugins/ajatus/tests/helpersTest.php diff --git a/plugins/ajatus/examples/tags.php b/plugins/ajatus/examples/tags.php new file mode 100644 index 0000000..e957a2a --- /dev/null +++ b/plugins/ajatus/examples/tags.php @@ -0,0 +1,31 @@ + 'couchdb_server', + 'db' => $db + )); +} +catch (ajatus_exception $e) +{ + die( "Error initializing Ajatus! Reason:\n{$e}\n" ); +} + +//$view = $ajatus->types->tag->generate_view('list_with_docs'); + +//echo "Generated view:\n{$view}\n"; + +//$results = $ajatus->connection->$content_db->view->temp($view); //, array( 'count' => 20) +// print_r($results); +//echo "Total rows: {$results->total_rows}\n"; + +print_r($ajatus->types->note->get_by_tags(array('nemein'))); + +print_r($ajatus->helpers->tag->get_tag('nemein')); + +?> \ No newline at end of file diff --git a/plugins/ajatus/tests/helpersTest.php b/plugins/ajatus/tests/helpersTest.php new file mode 100644 index 0000000..e1896cb --- /dev/null +++ b/plugins/ajatus/tests/helpersTest.php @@ -0,0 +1,47 @@ + + * Copyright (c) 2008 Nemein Oy + * Website: http://ajatus.info + * Licensed under the GPL license + * http://www.gnu.org/licenses/gpl.html + * + */ + +require_once('testcase.php'); + +/** + * Test to see if ajatus helpers work + */ +class ajatus_tests_helpersTest extends ajatus_tests_testcase +{ + public function setUp() + { + if (AJATUS_TESTS_ENABLE_OUTPUT) + { + echo __CLASS__ . "\n"; + } + parent::setUp(); + } + + public function testHelpersExists() + { + if (AJATUS_TESTS_ENABLE_OUTPUT) + { + echo __FUNCTION__ . "\n"; + } + + try + { + $this->assertTrue(isset($this->ajatus->helpers)); + } + catch (ajatus_exception $e) + { + $this->fail('An unexpected exception has been raised. ' . $e); + } + } +} +?> \ No newline at end of file -- 2.11.4.GIT