features/step_definitions/WireSteps.php in cuke4php-0.9.2 vs features/step_definitions/WireSteps.php in cuke4php-0.9.3
- old
+ new
@@ -9,11 +9,11 @@
/**
* @wire
*/
function beforeWire() {
- $this->aGlobals['before'] = 'beforeWire';
+ $this->before = 'beforeWire';
}
function beforeAll() {
}
@@ -79,9 +79,139 @@
**/
public function stepAStepWithAMultilineString($sString) {
}
+ /**
+ * When /^an error "([^"]*)" with message "([^"]*)" occurs$/
+ **/
+ public function stepAnErrorParameterWithMessageParameterOccurs($sType,$sMessage) {
+ try {
+ trigger_error($sMessage, constant($sType));
+ } catch (Exception $e) {
+ $this->exception = $e;
+ }
+ }
+ /**
+ * When /^an? "([^"]*)" is thrown with message "([^"]*)"$/
+ **/
+ public function stepAnExceptionParameterIsThrownWithMessageParameter($sExceptionClass,$sMessage) {
+ try {
+ throw new $sExceptionClass($sMessage);
+ } catch (Exception $e) {
+ $this->exception = $e;
+ }
+ }
+
+ /**
+ * Then /^an? "([^"]*)" should be caught$/
+ **/
+ public function stepAParameterExceptionShouldBeCaught($sExceptionType) {
+ self::assertInstanceOf($sExceptionType, $this->exception);
+ }
+
+ /**
+ * Given /^I store "([^"]*)" into "([^"]*)"$/
+ **/
+ public function stepIStoreParameterIntoParameter($sValue,$sKey) {
+ $this->$sKey = $sValue;
+ }
+
+
+ /**
+ * Then /^"([^"]*)" should equal "([^"]*)"$/
+ **/
+ public function stepParameterShouldEqualParameter($sKey,$sValue) {
+ self::assertEquals($sValue, $this->$sKey);
+ }
+
+ /**
+ * When /^I unset "([^"]*)"$/
+ **/
+ public function stepIUnsetParameter($sKey) {
+ unset($this->$sKey);
+ }
+
+ /**
+ * Then /^"([^"]*)" (should|should not) be set$/
+ **/
+ public function stepParameterShouldBeSet($sKey, $sShould) {
+ self::assertEquals(($sShould == "should"), isset($this->$sKey));
+ }
+
+ /**
+ * Given /^"([^"]*)" is\:$/
+ **/
+ public function stepParameterIs($sKey,$aTable) {
+ array_shift($aTable); // peel off the table column headings
+ $this->$sKey = $aTable;
+ }
+
+ /**
+ * Then /^"([^"]*)" should equal\:$/
+ **/
+ public function stepParameterShouldEqual($sKey,$aTable) {
+ array_shift($aTable); // peel off the table column headings
+ self::assertEquals($aTable, $this->$sKey);
+ }
+
+ /**
+ * Then /^getting "([^"]*)" should raise an? "([^"]*)"$/
+ **/
+ public function stepGettingParameterShouldRaiseAnParameter($sKey, $sExceptionClass) {
+ unset($this->exception);
+ try {
+ $this->$sKey;
+ self::fail("No Exception Caught");
+ } catch (Exception $e) {
+ $this->exception = $e;
+ }
+ self::assertInstanceOf($sExceptionClass, $this->exception);
+ }
+
+ /**
+ * Transform /^(\d+)$/
+ **/
+ public function transformToInteger($sArg) {
+ return intval($sArg);
+ }
+
+ /**
+ * Transform /^(abcd)$/
+ **/
+ public function transformReverse($sArg) {
+ return "dcba";
+ }
+
+ /**
+ * Transform /^(abcd)$/
+ **/
+ public function transformCapitalize($sArg) {
+ return "ABCD";
+ }
+
+ /**
+ * Transform /^\{(.*)\}$/
+ **/
+ public function transformSubstituteValues($sArg) {
+ return $this->$sArg;
+ }
+
+ /**
+ * Transform /^table:reverse$/
+ **/
+ public function transformReverseTable($aTable) {
+ return array_reverse($aTable);
+ }
+
+
+ /**
+ * Then /^"([^"]*)" should be a kind of "([^"]*)"$/
+ **/
+ public function stepParameterShouldBeAKindOfParameter($sKey,$sTypeName) {
+ self::assertInternalType($sTypeName, $this->$sKey);
+ }
+
}
?>
\ No newline at end of file