/** @test */
 public function itCanCreateAResponseDefinition()
 {
     $schemaFile = 'file://' . __DIR__ . '/../fixtures/petstore.json';
     $factory = new SwaggerSchemaFactory();
     $schema = $factory->createSchema($schemaFile);
     $responseDefinition = $schema->getRequestDefinition('addPet')->getResponseDefinition(200);
     assertThat($responseDefinition, isInstanceOf(ResponseDefinition::class));
     assertThat($responseDefinition->getContentTypes(), contains('application/json'));
     assertThat($responseDefinition->getBodySchema(), isType('object'));
     assertThat($responseDefinition->getStatusCode(), equalTo(200));
 }
Пример #2
0
/**
 * retourne vrai si $input est un objet de classe SimpleXMLElement, faux sinon
 *
 * @param mixed $input objet à tester
 * @return bool 
 */
function isSimpleXMLElementSceau($input)
{
    return isType('SimpleXMLElement', $input);
}
 /**
  * @Given /^the "([^"]*)" property is a string$/
  */
 public function thePropertyIsAString($property)
 {
     $payload = $this->getScopePayload();
     isType('string', $this->arrayGet($payload, $property), "Asserting the [{$property}] property in current scope [{$this->scope}] is a string: " . json_encode($payload));
 }
 public function testItCanLoadAYamlFile()
 {
     $retriever = new YamlUriRetriever();
     $object = $retriever->retrieve('file://' . __DIR__ . '/../../fixtures/petstore.yml');
     assertThat($object, isType('object'));
 }
Пример #5
0
 function isEreader()
 {
     return isType('ereader');
 }
Пример #6
0
/**
 * @param string        $method
 * @param string|object $type
 * @param array         $methodArgs
 * @return \Closure
 */
function methodReturnType($method, $type, array $methodArgs = [])
{
    return combine(isObject(), hasMethod($method), function ($object) use($method, $type, $methodArgs) {
        /** @var \Closure $typeCheck */
        $typeCheck = isType($type);
        $return = callOnClone($object, $method, $methodArgs);
        return $typeCheck($return);
    });
}
Пример #7
0
/**
 * @param string $key
 * @param string $type
 * @return \Closure
 */
function keyIsType($key, $type)
{
    if (!is_string($key)) {
        return never();
    }
    return combine(hasKey($key), function ($item) use($key, $type) {
        /** @var callable $typeCheck */
        $typeCheck = isType($type);
        return $typeCheck(polymorphicKeyValue($item, $key));
    });
}
Пример #8
0
/**
 * @param string $type
 * @return \Closure
 */
function isNotType($type)
{
    return negate(isType($type));
}