Permalink
Browse files

Added unit tests for Routines, Triggers and Events

  • Loading branch information...
1 parent 60fdffb commit 8489f415c944a41524bfec1c8e388b0572958882 @roccivic roccivic committed Jul 22, 2011
View
@@ -35,6 +35,7 @@
<file>test/Environment_test.php</file>
<directory suffix="_test.php">test/libraries/core</directory>
<directory suffix="_test.php">test/libraries/common</directory>
+ <directory suffix="_test.php">test/libraries/rte</directory>
<directory suffix="_test.php">test/libraries</directory>
</testsuite>
<!--<testsuite name="Selenium">-->
@@ -0,0 +1,104 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Test for fetching event data from HTTP request
+ *
+ * @package phpMyAdmin-test
+ */
+
+/*
+ * Include to test.
+ */
+require_once 'libraries/rte/rte_events.lib.php';
+
+class PMA_EVN_getDataFromRequest_test extends PHPUnit_Framework_TestCase
+{
+ /**
+ * @dataProvider provider
+ */
+ public function testgetDataFromRequest_empty($in, $out)
+ {
+ global $_REQUEST;
+
+ unset($_REQUEST);
+ foreach ($in as $key => $value) {
+ if ($value !== '') {
+ $_REQUEST[$key] = $value;
+ }
+ }
+ $this->assertEquals($out, PMA_EVN_getDataFromRequest());
+ }
+
+ public function provider()
+ {
+ return array(
+ array(
+ array(
+ 'item_name' => '',
+ 'item_type' => '',
+ 'item_original_name' => '',
+ 'item_status' => '',
+ 'item_execute_at' => '',
+ 'item_interval_value' => '',
+ 'item_interval_field' => '',
+ 'item_starts' => '',
+ 'item_ends' => '',
+ 'item_definition' => '',
+ 'item_preserve' => '',
+ 'item_comment' => '',
+ 'item_definer' => ''
+ ),
+ array(
+ 'item_name' => '',
+ 'item_type' => 'ONE TIME',
+ 'item_type_toggle' => 'RECURRING',
+ 'item_original_name' => '',
+ 'item_status' => '',
+ 'item_execute_at' => '',
+ 'item_interval_value' => '',
+ 'item_interval_field' => '',
+ 'item_starts' => '',
+ 'item_ends' => '',
+ 'item_definition' => '',
+ 'item_preserve' => '',
+ 'item_comment' => '',
+ 'item_definer' => ''
+ )
+ ),
+ array(
+ array(
+ 'item_name' => 'foo',
+ 'item_type' => 'RECURRING',
+ 'item_original_name' => 'foo',
+ 'item_status' => 'foo',
+ 'item_execute_at' => 'foo',
+ 'item_interval_value' => 'foo',
+ 'item_interval_field' => 'foo',
+ 'item_starts' => 'foo',
+ 'item_ends' => 'foo',
+ 'item_definition' => 'foo',
+ 'item_preserve' => 'foo',
+ 'item_comment' => 'foo',
+ 'item_definer' => 'foo'
+ ),
+ array(
+ 'item_name' => 'foo',
+ 'item_type' => 'RECURRING',
+ 'item_type_toggle' => 'ONE TIME',
+ 'item_original_name' => 'foo',
+ 'item_status' => 'foo',
+ 'item_execute_at' => 'foo',
+ 'item_interval_value' => 'foo',
+ 'item_interval_field' => 'foo',
+ 'item_starts' => 'foo',
+ 'item_ends' => 'foo',
+ 'item_definition' => 'foo',
+ 'item_preserve' => 'foo',
+ 'item_comment' => 'foo',
+ 'item_definer' => 'foo'
+ )
+ ),
+ );
+ }
+}
+?>
Oops, something went wrong.

0 comments on commit 8489f41

Please sign in to comment.