Comments (7)
I am facing same problem - any update?
from contexts.
I ran into this and in the end worked around it by adding a shim to my feature context to translate the string true/false into proper booleans.
It's a bit messy but got the job done...
# FeatureContext.php
...
use Sanpi\Behatch\Context\JsonContext;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
...
/**
* @BeforeScenario
*/
public function getBehatchJsonContext(BeforeScenarioScope $scope)
{
$environment = $scope->getEnvironment();
$this->behatchJsonContext = $environment->getContext('Sanpi\Behatch\Context\JsonContext');
}
/**
* @Then the JSON node :node should be boolean :boolAsString
*/
public function theJsonNodeShouldBeBooleanFalse($node, $boolAsString)
{
if (!$this->behatchJsonContext) {
PHPUnit_Framework_Assert::markTestSkipped('Behatch JsonContext cannot be used.');
}
if ($boolAsString == 'false') {
$bool = false;
} elseif ($boolAsString == 'true') {
$bool = true;
} else {
PHPUnit_Framework_Assert::markTestSkipped(
'Invalid value '.var_export($boolAsString,true).' supplied for boolean comparison.'
);
}
// call the behatch JsonContext with a valid boolean.
return $this->behatchJsonContext->theJsonNodeShouldBeEqualTo($node, $bool);
}
And in the scenario, changing
And the JSON node "is_completed" should be equal to "false"
to
And the JSON node "is_completed" should be boolean "false"
from contexts.
There's actually a pair of open pull requests - #115 and #116 - which would address this
from contexts.
#116 is better I think
from contexts.
#116 merged.
from contexts.
Great and could you create a new release version please ?
from contexts.
@MLKiiwy travis is red, I try to fix that before release 😃
from contexts.
Related Issues (20)
- Typo in RestContext HOT 1
- Make tests green again HOT 8
- Deprecate php5
- Way to easy adjust lots of wait for 'element' HOT 2
- Documentation HOT 3
- Rest Context - Send Request with Parameters Bug HOT 5
- BC break (or bug) with sending POST request with array HOT 2
- [JsonContext] How to handle integers as strings?
- [RestContext] Arrays in request
- Can't add header Authorization for jwt token HOT 6
- Unable to use step "the JSON should be valid according to swagger :dumpPath dump schema :schemaName"
- Cookies are emptied between requests. HOT 5
- How to access RestContext from my custom context? HOT 5
- The service "environment.manager" has a dependency on a non-existent service "behatch.http_call.request".
- Support Symfony 5 packages HOT 3
- \Behatch\HttpCall\HttpCallListener::afterStep() can cause Call to a member function source() on null HOT 2
- Step "the response should be in JSON" is already defined in Behatch\Context\JsonContext::theResponseShouldBeInJson() HOT 1
- Fix Travis CI
- Update PHP and Symfony minimal versions
- symfony 5 Test json schema but response of rest context is symfony response
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from contexts.