[187] r375@phpspec (orig r187): padraic.brady | 2008-01-11 03:28:50 -0700

1 view
Skip to first unread message

nor...@domain51.com

unread,
Jan 11, 2008, 5:29:37 AM1/11/08
to phpspec...@googlegroups.com
Revision
187
Author
phpspec
Date
2008-01-11 03:29:37 -0700 (Fri, 11 Jan 2008)

Log Message

 r375@phpspec (orig r187):  padraic.brady | 2008-01-11 03:28:50 -0700
 * Takagi and Kubo's patch for predicates
 * miscellaneous 0.2.2 updates for build/CREDITS

Modified Paths

Property Changed

Diff

Property changes:


Name: svk:merge
   - d6e91ea2-e33a-0410-98df-1d493bd67c58:/:186
   + d6e91ea2-e33a-0410-98df-1d493bd67c58:/:187

Modified: branches/0.2.0/CREDITS (186 => 187)


--- branches/0.2.0/CREDITS	2008-01-11 10:17:35 UTC (rev 186)
+++ branches/0.2.0/CREDITS	2008-01-11 10:29:37 UTC (rev 187)
@@ -12,13 +12,14 @@
 =============
 
 Pádraic Brady (English)
-TAKAGI Masahiro (Japanese)
+Takagi Masahiro (Japanese)
 
 Bug Fixes/Patches
 =================
 
-KUBO Atsuhiro (3 bugs with resolving patches on 08 January 2008)
-TAKAGI Masahiro (manual inaccuracy patched on 08 January 2008)
+Harley Bussell (HTML Runner and Reporter submission)
+Kubo Atsuhiro (3 bugs with resolving patches on 08 January 2008)
+Takagi Masahiro (manual inaccuracy patched on 08 January 2008)
 
 Others
 ======

Modified: branches/0.2.0/build/build.xml (186 => 187)


--- branches/0.2.0/build/build.xml	2008-01-11 10:17:35 UTC (rev 186)
+++ branches/0.2.0/build/build.xml	2008-01-11 10:29:37 UTC (rev 187)
@@ -44,7 +44,7 @@
     <property name="spec.src.default" value="${project.basedir}/.." />
     <property name="spec.src.classpath" value="/src" />
     <property name="spec.name" value="PHPSpec" />
-    <property name="spec.version" value="0.2.1" /> <!-- VERSION FOR EDITING -->
+    <property name="spec.version" value="0.2.2" /> <!-- VERSION FOR EDITING -->
     <property name="spec.stability" value="stable" />
     <property name="spec.svn.baseurl" value="http://phpspec.googlecode.com/svn/" />
     <property name="spec.svn.url" value="${svn.url}/trunk" />
@@ -216,6 +216,12 @@
                 <install as="phpspec.bat" name="scripts/phpspec.bat" />
             </release>
 
+			<changelog version="0.2.2" date="2008-01-11" license="LGPL">
+                * Patched a Predicate issue courtesy of Takagi Masahiro
+				  and Kubo
+				* Added new PCRE regular expression matcher "matches()"
+            </changelog>
+
 			<changelog version="0.2.1" date="2008-01-09" license="LGPL">
                 * Fixes a minor output bug missed in QA for HTML and TEXT
 				  reporters

Modified: branches/0.2.0/src/PHPSpec/Specification.php (186 => 187)


--- branches/0.2.0/src/PHPSpec/Specification.php	2008-01-11 10:17:35 UTC (rev 186)
+++ branches/0.2.0/src/PHPSpec/Specification.php	2008-01-11 10:29:37 UTC (rev 187)
@@ -122,7 +122,7 @@
 
         // check for Matcher references
         $matchers = array(
-            'equal', 'be', 'beEqualTo', 'beAnInstanceOf', 'beGreaterThan', 'beTrue', 'beFalse', 'beEmpty', 'beLessThan', 'beGreaterThanOrEqualTo', 'beLessThanOrEqualTo', 'beSet', 'beNull', 'beOfType', 'beIdenticalTo', 'match'
+            'equal', 'be', 'beEqualTo', 'beAnInstanceOf', 'beGreaterThan', 'beTrue', 'beFalse', 'beEmpty', 'beLessThan', 'beGreaterThanOrEqualTo', 'beLessThanOrEqualTo', 'beSet', 'beNull', 'beOfType', 'beIdenticalTo', 'match', 'throw'
         );
         if (in_array($method, $matchers)) {
             $this->setExpectedValue(array_shift($args));
@@ -132,13 +132,10 @@
         }
 
         // check for any predicate style matching
-        $result = preg_match("/^((be)|(have)|(beA)|(haveA)|(haveAn)|(beAn))*/", $method, $matches);
+        $result = preg_match("/^((?:be|have)A?n?)(.*)/", $method, $matches);
         if ($result && empty($args) && $this instanceof PHPSpec_Specification_Object) {
-            $predicate = $matches[0];
-            $predicateSuffix = substr($method, strlen($predicate));
-            if (!isset($predicateSuffix) || empty($predicateSuffix)) {
-            	$predicateSuffix = '';
-            }
+            $predicate = $matches[1];
+            $predicateSuffix = $matches[2];
 
             if (strpos($predicate, 'have') !== false) {
                 $predicateMethodPrefixes = array('has', 'hasA', 'hasAn');
@@ -369,4 +366,4 @@
         }
     }
 
-}
\ No newline at end of file
+}
Reply all
Reply to author
Forward
0 new messages