public function theOperationNamedInFile($queryName, $file)
    {
        // TODO: add support for fragments
        // if a fragment is not used in some operation in the same file a error is thrown

        $this->theOperationInFile($file);
        $this->operationName = $queryName;
        if ($this->client->getGraphQL()) {
            // remove non necessary operations to avoid errors with unsettled variables
            $pattern = '/(query|mutation|subscription)\s+(?!'.$queryName.'\s*[\({])(.+\n)+}\n*/';
            $this->client->setGraphQL(preg_replace($pattern, null, $this->client->getGraphQL()));
        }

        if ($queryName) {
            if (strpos($this->client->getGraphQL(), $queryName) === false) {
                throw new \RuntimeException(sprintf('Does not exist any operation called "%s" in "%s"', $queryName, $file));
            }
        }
    }
public function theOperationNamedInFile($queryName, $file)
    {
        // TODO: add support for fragments
        // if a fragment is not used in some operation in the same file a error is thrown

        $this->theOperationInFile($file);
        $this->operationName = $queryName;
        if ($this->client->getGraphQL()) {
            // remove non necessary operations to avoid errors with unsettled variables
            $pattern = '/(query|mutation|subscription)\s+(?!'.$queryName.'\s*[\({])(.+\n)+}\n*/';
            $this->client->setGraphQL(preg_replace($pattern, null, $this->client->getGraphQL()));
        }

        if ($queryName) {
            if (strpos($this->client->getGraphQL(), $queryName) === false) {
                throw new \RuntimeException(sprintf('Does not exist any operation called "%s" in "%s"', $queryName, $file));
            }
        }
    }
public function theOperationNamedInFile ( $ queryName , $ file ) { // TODO: add support for fragments // if a fragment is not used in some operation in the same file a error is thrown $ this -> theOperationInFile ( $ file ) ; $ this -> operationName = $ queryName ; if ( $ this -> client -> getGraphQL ( ) ) { // remove non necessary operations to avoid errors with unsettled variables $ pattern = '/(query|mutation|subscription)\s+(?!' . $ queryName . '\s*[\({])(.+\n)+}\n*/' ; $ this -> client -> setGraphQL ( preg_replace ( $ pattern , null , $ this -> client -> getGraphQL ( ) ) ) ; } if ( $ queryName ) { if ( strpos ( $ this -> client -> getGraphQL ( ) , $ queryName ) === false ) { throw new \ RuntimeException ( sprintf ( 'Does not exist any operation called "%s" in "%s"' , $ queryName , $ file ) ) ; } } }
Find for specific query name in given file.
The file can contain multiple named queries.

Example: Given the operation named "GetUser" in file 'queries.graphql'

@Given /^the operation named "([^"]*)" in file "([^"]*)"$/
Find for specific query name in given file . The file can contain multiple named queries .