Commits

Ruslan Osmanov  committed 1eea3dc

Change: renamed Ev to ev
Add: test for timer various calls

  • Participants
  • Parent commits 85d8a5b

Comments (0)

Files changed (4)

 [  --enable-ev-libevent-api       Enable libevent compatibility API support], yes, no)
 
 PHP_ARG_ENABLE(ev-sockets, for sockets support,
-[  --enable-ev-sockets     Enable sockets support in Ev], yes, no)
+[  --enable-ev-sockets     Enable sockets support in ev], yes, no)
 
 if test "$PHP_EV" != "no"; then
   export OLD_CPPFLAGS="$CPPFLAGS"
 #elif ZEND_MODULE_API_NO >= 20010901
 	STANDARD_MODULE_HEADER,
 #endif
-    "Ev",
+    "ev",
     ev_functions,
     PHP_MINIT(ev),
     PHP_MSHUTDOWN(ev),
 	intern->ptr          = NULL;
 	intern->prop_handler = NULL;
 
-#if 0
-	while (ce_parent) {
-	    if (ce_parent == ev_watcher_class_entry_ptr
-	    		|| ce_parent == ev_loop_class_entry_ptr) {
-	    	break;
-	    }
-	    ce_parent = ce_parent->parent;
-	}
-#endif
 	while (ce_parent->type != ZEND_INTERNAL_CLASS && ce_parent->parent != NULL) {
 		ce_parent = ce_parent->parent;
 	}
 <?xml version="1.0"?>
 <package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
-  <name>Ev</name>
+  <name>ev</name>
   <channel>pecl.php.net</channel>
   <summary>Provides interface to libev library</summary>
   <description>
-  Ev is a PECL extension providing inteface to libev library - high performance
+  ev is a PECL extension providing inteface to libev library - high performance
   full-featured event loop written in C.
   </description>
   <lead>
     <email>osmanov@php.net</email>
     <active>yes</active>
   </lead>
-  <date>2012-12-20</date>
+  <date>2012-12-21</date>
   <!--{{{ Current version -->
   <version>
     <release>0.1.0</release>
         <file role="src" name="01_load.phpt"/>
         <file role="src" name="02_ev_construct_variation.phpt"/>
         <file role="src" name="03_ev_loop_props.phpt"/>
+        <file role="src" name="04_timer_variation.phpt"/>
         <file role="src" name="05_timer.phpt"/>
         <file role="src" name="06_keepalive.phpt"/>
         <file role="src" name="07_stat.phpt"/>
       </os>
     </required>
   </dependencies>
-  <providesextension>Ev</providesextension>
+  <providesextension>ev</providesextension>
   <extsrcrelease>
-    <configureoption default="no" name="enable-ev-debug" prompt="Enable internal debugging in Ev"/>
-    <configureoption default="yes" name="enable-ev-libevent-api" prompt="Enable libevent compatibility API support in Ev"/>
-    <configureoption default="yes" name="enable-ev-sockets" prompt="Enable sockets support in Ev"/>
+    <configureoption default="no" name="enable-ev-debug" prompt="Enable internal debugging in ev"/>
+    <configureoption default="yes" name="enable-ev-libevent-api" prompt="Enable libevent compatibility API support in ev"/>
+    <configureoption default="yes" name="enable-ev-sockets" prompt="Enable sockets support in ev"/>
   </extsrcrelease>
   <changelog>
     <version>

File tests/04_timer_variation.phpt

+--TEST--
+Check for EvTimer various calls
+--FILE--
+<?php
+# The code is a translated version of Perl EV module's 09_brandon.t file
+
+error_reporting(0);
+
+$a = new EvTimer(1.6, 0, function() { echo "not ok 2\n"; ev_break(); });
+$b = new EvTimer(0.3, 0, function() { echo "ok 2\n"; ev_break(); });
+
+echo "ok 1\n";
+ev_run();
+echo "ok 3\n";
+
+$b = new EvTimer(0.3, 0, function() { echo "ok 5\n"; ev_break(); });
+$a = new EvTimer(1.6, 0, function() { echo "not ok 5\n"; ev_break(); });
+
+echo "ok 4\n";
+ev_run();
+echo "ok 6\n";
+
+$a = new EvTimer(1.9, 0, function() { echo "not ok 8\n"; ev_break(); });
+$b = new EvTimer(1.6, 0, function() { echo "not ok 8\n"; ev_break(); });
+$c = new EvTimer(0.3, 0, function() { echo "ok 8\n"; ev_break(); });
+
+echo "ok 7\n";
+ev_run();
+echo "ok 9\n";
+
+$a = new EvTimer(1.6, 0, function() { echo "not ok 11\n"; ev_break(); });
+$b = new EvTimer(0.3, 0, function() { echo "ok 11\n"; ev_break(); });
+$c = new EvTimer(1.9, 0, function() { echo "not ok 11\n"; ev_break(); });
+
+echo "ok 10\n";
+ev_run();
+echo "ok 12\n";
+?>
+--EXPECT--
+ok 1
+ok 2
+ok 3
+ok 4
+ok 5
+ok 6
+ok 7
+ok 8
+ok 9
+ok 10
+ok 11
+ok 12