These are chat archives for
Sign in to start talking
BDD framework for PHP 5.3+
Sep 08 2014 08:04 UTC
Hello, there is someway to pass a null value? I tried with the '~' character but it's not working
Tried with this transformation /*
/^(null)$/ but it's not working neither. It is because it's inside a TableNode?
Sep 08 2014 08:37 UTC
explain your problem. Your message make no sense without context.
Sep 08 2014 08:53 UTC
Imagine this Scenario:
Scenario: Save all products from file
Given the following products:
| code | name |
| 1 | null |
Well, null is the string 'null', not a real null value.
Can I make it null somehow?
I mean, when you get the data with the DableNode
Sep 08 2014 08:55 UTC
Simply by not setting it in your TableNode I guess
Sep 08 2014 08:57 UTC
In that case an empty string is passed
(sorry for my english if is wrong)
Sep 08 2014 08:58 UTC
You're using FriendlyContext ?
(weird that you give an empty string, if it's for testing your object it's not the job of behat)
Sep 08 2014 09:07 UTC
Just the default implements SnippetAcceptingContext
This is not the real Scenario, it is just an example
Sep 08 2014 09:09 UTC
So you can easily use
$name = $name !== 'null' ?: null;
Sep 08 2014 09:12 UTC
you can use a table transform to do what you want
Sep 08 2014 09:21 UTC
e.g. in your example you'd use
that function would receive the TableNode and return... something. I guess an array?
Then your step definition would type hint array instead of TableNode and get the processed array
any other steps that use that same table format
Params from Gherkin are always strings
Sep 08 2014 09:30 UTC
Thank you. I am going to try
Sep 08 2014 09:55 UTC
There is a PR for
row:code,name that avoids you having to write the loop but it's not been merged yet, might be in 3.1