Modified: trunk/src/PHPSpec/Specification.php (185 => 186)
--- trunk/src/PHPSpec/Specification.php 2008-01-10 14:34:17 UTC (rev 185)
+++ trunk/src/PHPSpec/Specification.php 2008-01-11 10:17:35 UTC (rev 186)
@@ -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
+}