idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
8,900
private function countPlaceholders ( $ stepText , $ stepRegex ) { preg_match ( '/^' . $ stepRegex . '$/' , $ stepText , $ matches ) ; return count ( $ matches ) ? count ( $ matches ) - 1 : 0 ; }
Counts regex placeholders using provided text .
8,901
private function getDefaultStyles ( ) { return array ( 'keyword' => new OutputFormatterStyle ( null , null , array ( 'bold' ) ) , 'stdout' => new OutputFormatterStyle ( null , null , array ( ) ) , 'exception' => new OutputFormatterStyle ( 'red' ) , 'undefined' => new OutputFormatterStyle ( 'yellow' ) , 'pending' => new...
Returns default styles .
8,902
private function printExampleRowOnAfterExampleEvent ( Formatter $ formatter , Event $ event , $ eventName ) { if ( ! $ event instanceof AfterScenarioTested || ExampleTested :: AFTER !== $ eventName ) { return ; } $ example = $ event -> getScenario ( ) ; $ this -> exampleSetupPrinter -> printSetup ( $ formatter , $ this...
Prints example row on example AFTER event .
8,903
private function printFooterOnAfterEvent ( Formatter $ formatter , Event $ event ) { if ( ! $ event instanceof AfterOutlineTested ) { return ; } $ this -> tablePrinter -> printFooter ( $ formatter , $ event -> getTestResult ( ) ) ; }
Prints outline footer on outline AFTER event .
8,904
public function paintText ( $ text , Definition $ definition , TestResult $ result ) { $ regex = $ this -> patternTransformer -> transformPatternToRegex ( $ definition -> getPattern ( ) ) ; $ style = $ this -> resultConverter -> convertResultToString ( $ result ) ; $ paramStyle = $ style . '_param' ; if ( '/' !== subst...
Colorizes step text arguments according to definition .
8,905
private function printExamplesSteps ( Formatter $ formatter , OutlineNode $ outline , array $ steps ) { foreach ( $ steps as $ step ) { $ this -> stepPrinter -> printStep ( $ formatter , $ outline , $ step , new UndefinedStepResult ( ) ) ; } $ formatter -> getOutputPrinter ( ) -> writeln ( ) ; }
Prints outline steps .
8,906
private function printExamplesTableHeader ( OutputPrinter $ printer , ExampleTableNode $ table ) { $ printer -> writeln ( sprintf ( '%s{+keyword}%s:{-keyword}' , $ this -> indentText , $ table -> getKeyword ( ) ) ) ; $ rowNum = 0 ; $ wrapper = $ this -> getWrapperClosure ( ) ; $ row = $ table -> getRowAsStringWithWrapp...
Prints examples table header .
8,907
private function getWrapperClosure ( ) { $ style = $ this -> resultConverter -> convertResultCodeToString ( TestResult :: SKIPPED ) ; return function ( $ col ) use ( $ style ) { return sprintf ( '{+%s_param}%s{-%s_param}' , $ style , $ col , $ style ) ; } ; }
Creates wrapper - closure for the example header .
8,908
public function convertResultCodeToString ( $ resultCode ) { switch ( $ resultCode ) { case TestResult :: SKIPPED : return 'skipped' ; case TestResult :: PENDING : return 'pending' ; case TestResult :: FAILED : return 'failed' ; case StepResult :: UNDEFINED : return 'undefined' ; } return 'passed' ; }
Converts provided result code to a string .
8,909
public function calculateScenarioWidth ( Scenario $ scenario , $ indentation , $ subIndentation ) { $ length = $ this -> calculateScenarioHeaderWidth ( $ scenario , $ indentation ) ; foreach ( $ scenario -> getSteps ( ) as $ step ) { $ stepLength = $ this -> calculateStepWidth ( $ step , $ indentation + $ subIndentatio...
Calculates scenario width .
8,910
public function calculateExampleWidth ( ExampleNode $ example , $ indentation , $ subIndentation ) { $ length = $ this -> calculateScenarioHeaderWidth ( $ example , $ indentation ) ; foreach ( $ example -> getSteps ( ) as $ step ) { $ stepLength = $ this -> calculateStepWidth ( $ step , $ indentation + $ subIndentation...
Calculates outline examples width .
8,911
public function calculateScenarioHeaderWidth ( Scenario $ scenario , $ indentation ) { $ indentText = str_repeat ( ' ' , intval ( $ indentation ) ) ; if ( $ scenario instanceof ExampleNode ) { $ header = sprintf ( '%s%s' , $ indentText , $ scenario -> getTitle ( ) ) ; } else { $ title = $ scenario -> getTitle ( ) ; $ l...
Calculates scenario header width .
8,912
public function calculateStepWidth ( StepNode $ step , $ indentation ) { $ indentText = str_repeat ( ' ' , intval ( $ indentation ) ) ; $ text = sprintf ( '%s%s %s' , $ indentText , $ step -> getKeyword ( ) , $ step -> getText ( ) ) ; return mb_strlen ( $ text , 'utf8' ) ; }
Calculates step width .
8,913
protected function loadDefinitionArgumentsTransformer ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Transformation\Call\Filter\DefinitionArgumentsTransformer' ) ; $ definition -> addTag ( CallExtension :: CALL_FILTER_TAG , array ( 'priority' => 200 ) ) ; $ container -> setDefinition ( ...
Loads definition arguments transformer .
8,914
protected function loadDefaultTransformers ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Transformation\Transformer\RepositoryArgumentTransformer' , array ( new Reference ( self :: REPOSITORY_ID ) , new Reference ( CallExtension :: CALL_CENTER_ID ) , new Reference ( DefinitionExtension...
Loads default transformers .
8,915
protected function loadRepository ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Transformation\TransformationRepository' , array ( new Reference ( EnvironmentExtension :: MANAGER_ID ) ) ) ; $ container -> setDefinition ( self :: REPOSITORY_ID , $ definition ) ; }
Loads transformations repository .
8,916
protected function processArgumentsTransformers ( ContainerBuilder $ container ) { $ references = $ this -> processor -> findAndSortTaggedServices ( $ container , self :: ARGUMENT_TRANSFORMER_TAG ) ; $ definition = $ container -> getDefinition ( $ this -> getDefinitionArgumentTransformerId ( ) ) ; foreach ( $ reference...
Processes all available argument transformers .
8,917
public function iRunBehatInteractively ( $ answerString , $ argumentsString ) { $ env = $ this -> process -> getEnv ( ) ; $ env [ 'SHELL_INTERACTIVE' ] = true ; $ this -> process -> setEnv ( $ env ) ; $ this -> process -> setInput ( $ answerString ) ; $ this -> options = '--format-settings=\'{"timer": false}\'' ; $ thi...
Runs behat command with provided parameters in interactive mode
8,918
public function itShouldPassWith ( $ success , PyStringNode $ text ) { $ this -> itShouldFail ( $ success ) ; $ this -> theOutputShouldContain ( $ text ) ; }
Checks whether previously ran command passes|fails with provided output .
8,919
public function fileXmlShouldBeLike ( $ path , PyStringNode $ text ) { $ path = $ this -> workingDir . '/' . $ path ; Assert :: assertFileExists ( $ path ) ; $ fileContent = trim ( file_get_contents ( $ path ) ) ; $ fileContent = preg_replace ( '/time="(.*)"/' , 'time="-IGNORE-VALUE-"' , $ fileContent ) ; $ dom = new D...
Checks whether specified content and structure of the xml is correct without worrying about layout .
8,920
public function xmlShouldBeValid ( $ xmlFile , $ schemaPath ) { $ dom = new DomDocument ( ) ; $ dom -> load ( $ this -> workingDir . '/' . $ xmlFile ) ; $ dom -> schemaValidate ( __DIR__ . '/schema/' . $ schemaPath ) ; }
Checks whether the file is valid according to an XML schema .
8,921
private function loadAnnotationReader ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Hook\Context\Annotation\HookAnnotationReader' ) ; $ definition -> addTag ( ContextExtension :: ANNOTATION_READER_TAG , array ( 'priority' => 50 ) ) ; $ container -> setDefinition ( ContextExtension :: A...
Loads hook annotation reader .
8,922
protected function loadRootNodeListener ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Testwork\Output\Node\EventListener\ChainEventListener' , array ( array ( new Definition ( 'Behat\Behat\Output\Node\EventListener\AST\SuiteListener' , array ( new Reference ( 'output.node.printer.pretty.suit...
Loads pretty formatter node event listener .
8,923
protected function loadTableOutlinePrinter ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Output\Node\Printer\Pretty\PrettyOutlineTablePrinter' , array ( new Reference ( 'output.node.printer.pretty.scenario' ) , new Reference ( 'output.node.printer.pretty.skipped_step' ) , new Reference...
Loads table outline printer .
8,924
protected function loadHookPrinters ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter' , array ( new Reference ( self :: RESULT_TO_STRING_CONVERTER_ID ) , new Reference ( ExceptionExtension :: PRESENTER_ID ) , 0 , true , true ) ) ; $ container ...
Loads hook printers .
8,925
protected function processListenerWrappers ( ContainerBuilder $ container ) { $ this -> processor -> processWrapperServices ( $ container , self :: ROOT_LISTENER_ID , self :: ROOT_LISTENER_WRAPPER_TAG ) ; }
Processes all registered pretty formatter node listener wrappers .
8,926
public function registerScenarioStat ( ScenarioStat $ stat ) { if ( TestResults :: NO_TESTS === $ stat -> getResultCode ( ) ) { return ; } $ this -> scenarioCounters [ $ stat -> getResultCode ( ) ] ++ ; if ( TestResult :: FAILED === $ stat -> getResultCode ( ) ) { $ this -> failedScenarioStats [ ] = $ stat ; } if ( Tes...
Registers scenario stat .
8,927
public function registerStepStat ( StepStat $ stat ) { $ this -> stepCounters [ $ stat -> getResultCode ( ) ] ++ ; if ( TestResult :: FAILED === $ stat -> getResultCode ( ) ) { $ this -> failedStepStats [ ] = $ stat ; } if ( TestResult :: PENDING === $ stat -> getResultCode ( ) ) { $ this -> pendingStepStats [ ] = $ st...
Registers step stat .
8,928
private function isDefinitionShared ( Definition $ definition ) { if ( method_exists ( $ definition , 'isShared' ) ) { return $ definition -> isShared ( ) ; } else if ( method_exists ( $ definition , 'getScope' ) ) { return $ definition -> getScope ( ) !== ContainerBuilder :: SCOPE_PROTOTYPE ; } return false ; }
Checks if provided definition is shared .
8,929
private function extractHeader ( Suite $ suite , Definition $ definition ) { $ pattern = $ definition -> getPattern ( ) ; $ lines = array ( ) ; $ lines [ ] = strtr ( '{suite} <def_dimmed>|</def_dimmed> <info>{type}</info> <def_regex>{regex}</def_regex>' , array ( '{suite}' => $ suite -> getName ( ) , '{type}' => $ this...
Extracts the formatted header from the definition .
8,930
private function extractDescription ( Suite $ suite , Definition $ definition ) { $ definition = $ this -> translateDefinition ( $ suite , $ definition ) ; $ lines = array ( ) ; if ( $ description = $ definition -> getDescription ( ) ) { foreach ( explode ( "\n" , $ description ) as $ descriptionLine ) { $ lines [ ] = ...
Extracts the formatted description from the definition .
8,931
private function extractFooter ( Suite $ suite , Definition $ definition ) { $ lines = array ( ) ; $ lines [ ] = strtr ( '{space}<def_dimmed>|</def_dimmed> at `{path}`' , array ( '{space}' => str_pad ( '' , mb_strlen ( $ suite -> getName ( ) , 'utf8' ) + 1 ) , '{path}' => $ definition -> getPath ( ) ) ) ; if ( $ this -...
Extracts the formatted footer from the definition .
8,932
public function printCounters ( OutputPrinter $ printer , $ intro , array $ stats ) { $ stats = array_filter ( $ stats , function ( $ count ) { return 0 !== $ count ; } ) ; if ( 0 === count ( $ stats ) ) { $ totalCount = 0 ; } else { $ totalCount = array_sum ( $ stats ) ; } $ detailedStats = array ( ) ; foreach ( $ sta...
Prints scenario and step counters .
8,933
final protected function translateDefinition ( Suite $ suite , Definition $ definition ) { return $ this -> translator -> translateDefinition ( $ suite , $ definition ) ; }
Translates definition using translator .
8,934
public function printScenarioPath ( Formatter $ formatter , FeatureNode $ feature , Scenario $ scenario , $ indentation ) { $ printer = $ formatter -> getOutputPrinter ( ) ; if ( ! $ formatter -> getParameter ( 'paths' ) ) { $ printer -> writeln ( ) ; return ; } $ fileAndLine = sprintf ( '%s:%s' , $ this -> relativizeP...
Prints scenario path comment .
8,935
public function printStepPath ( Formatter $ formatter , Scenario $ scenario , StepNode $ step , StepResult $ result , $ indentation ) { $ printer = $ formatter -> getOutputPrinter ( ) ; if ( ! $ result instanceof DefinedStepResult || ! $ result -> getStepDefinition ( ) || ! $ formatter -> getParameter ( 'paths' ) ) { $...
Prints step path comment .
8,936
private function printDefinedStepPath ( OutputPrinter $ printer , DefinedStepResult $ result , $ scenarioWidth , $ stepWidth ) { $ path = $ result -> getStepDefinition ( ) -> getPath ( ) ; $ spacing = str_repeat ( ' ' , max ( 0 , $ scenarioWidth - $ stepWidth ) ) ; $ printer -> writeln ( sprintf ( '%s {+comment}# %s{-c...
Prints defined step path .
8,937
private function relativizePaths ( $ path ) { if ( ! $ this -> basePath ) { return $ path ; } return str_replace ( $ this -> basePath . DIRECTORY_SEPARATOR , '' , $ path ) ; }
Transforms path to relative .
8,938
static private function getReturnClass ( ReflectionFunctionAbstract $ reflection ) { $ type = $ reflection -> getReturnType ( ) ; if ( null === $ type || $ type -> isBuiltin ( ) ) { return null ; } return ( string ) $ type ; }
Extracts parameters from provided definition call .
8,939
private function hasIndex ( $ index ) { return is_string ( $ index ) ? $ this -> hasName ( $ index ) : $ this -> hasPosition ( $ index ) ; }
Returns appropriate closure for filtering parameter by index .
8,940
public function translateDefinition ( Suite $ suite , Definition $ definition , $ language = null ) { $ assetsId = $ suite -> getName ( ) ; $ pattern = $ definition -> getPattern ( ) ; $ translatedPattern = $ this -> translator -> trans ( $ pattern , array ( ) , $ assetsId , $ language ) ; if ( $ pattern != $ translate...
Attempts to translate definition using translator and produce translated one on success .
8,941
private function getArgumentString ( ArgumentInterface $ argument , $ collapse = false ) { if ( $ collapse ) { return '...' ; } if ( $ argument instanceof PyStringNode ) { $ text = '"""' . "\n" . $ argument . "\n" . '"""' ; return $ text ; } return ( string ) $ argument ; }
Returns argument string for provided argument .
8,942
public function createContext ( $ class , array $ arguments = array ( ) , array $ singleUseResolvers = array ( ) ) { $ reflection = new ReflectionClass ( $ class ) ; $ resolvers = array_merge ( $ singleUseResolvers , $ this -> argumentResolvers ) ; $ resolvedArguments = $ this -> resolveArguments ( $ reflection , $ arg...
Creates and initializes context class .
8,943
private function resolveArguments ( ReflectionClass $ reflection , array $ arguments , array $ resolvers ) { $ newArguments = $ arguments ; foreach ( $ resolvers as $ resolver ) { $ newArguments = $ resolver -> resolveArguments ( $ reflection , $ newArguments ) ; } if ( ! $ reflection -> hasMethod ( '__construct' ) ) {...
Resolves arguments for a specific class using registered argument resolvers .
8,944
private function createInstance ( ReflectionClass $ reflection , array $ arguments ) { if ( count ( $ arguments ) ) { return $ reflection -> newInstanceArgs ( $ arguments ) ; } return $ reflection -> newInstance ( ) ; }
Creates context instance .
8,945
private function initializeInstance ( Context $ context ) { foreach ( $ this -> contextInitializers as $ initializer ) { $ initializer -> initializeContext ( $ context ) ; } }
Initializes context class and returns new context instance .
8,946
private function replaceTokensWithRegexCaptureGroups ( $ regex ) { $ tokenRegex = self :: TOKEN_REGEX ; return preg_replace_callback ( self :: PLACEHOLDER_REGEXP , array ( $ this , 'replaceTokenWithRegexCaptureGroup' ) , $ regex ) ; }
Replaces turnip tokens with regex capture groups .
8,947
private function replaceTurnipAlternativeWordsWithRegex ( $ regex ) { $ regex = preg_replace ( self :: ALTERNATIVE_WORD_REGEXP , '(?:\1|\2)' , $ regex ) ; $ regex = $ this -> removeEscapingOfAlternationSyntax ( $ regex ) ; return $ regex ; }
Replaces turnip alternative words with regex non - capturing alternating group .
8,948
private function printTitle ( OutputPrinter $ printer , ExampleNode $ example ) { $ printer -> write ( sprintf ( '%s%s' , $ this -> indentText , $ example -> getTitle ( ) ) ) ; }
Prints example title .
8,949
public function printSuiteDefinitions ( DefinitionPrinter $ printer , $ suite ) { $ environment = $ this -> environmentManager -> buildEnvironment ( $ suite ) ; $ definitions = $ this -> repository -> getEnvironmentDefinitions ( $ environment ) ; $ printer -> printDefinitions ( $ suite , $ definitions ) ; }
Prints definitions for provided suite using printer .
8,950
private function flushStatesIfBeginningOfTheFeature ( $ eventName ) { if ( FeatureTested :: BEFORE !== $ eventName ) { return ; } $ this -> firstBackgroundEnded = false ; $ this -> inBackground = false ; }
Flushes state if the event is the BEFORE feature .
8,951
private function markBeginningOrEndOfTheBackground ( $ eventName ) { if ( BackgroundTested :: BEFORE === $ eventName ) { $ this -> inBackground = true ; } if ( BackgroundTested :: AFTER === $ eventName ) { $ this -> inBackground = false ; } }
Marks beginning or end of the background .
8,952
private function isSkippableEvent ( Event $ event ) { if ( ! $ this -> firstBackgroundEnded ) { return false ; } return $ event instanceof BackgroundTested || $ this -> isNonFailingConsequentBackgroundStep ( $ event ) ; }
Checks if provided event is skippable .
8,953
private function isBeforeStepEventWithOutput ( Event $ event ) { if ( $ event instanceof AfterStepSetup && $ event -> hasOutput ( ) ) { $ this -> stepSetupHadOutput = true ; return true ; } return false ; }
Checks if provided event is a BEFORE step with setup that produced output .
8,954
private function isAfterStepWithOutput ( Event $ event ) { if ( $ event instanceof AfterStepTested && ( $ this -> stepSetupHadOutput || $ event -> hasOutput ( ) ) ) { $ this -> stepSetupHadOutput = false ; return true ; } return false ; }
Checks if provided event is an AFTER step with teardown that produced output .
8,955
private function readMethodCallees ( $ class , ReflectionMethod $ method ) { $ callees = array ( ) ; try { $ prototype = $ method -> getPrototype ( ) ; if ( $ prototype -> getDeclaringClass ( ) -> getName ( ) !== $ method -> getDeclaringClass ( ) -> getName ( ) ) { $ callees = array_merge ( $ callees , $ this -> readMe...
Loads callees associated with specific method .
8,956
private function readDocBlockCallees ( $ class , ReflectionMethod $ method , $ docBlock ) { $ callees = array ( ) ; $ description = $ this -> readDescription ( $ docBlock ) ; $ docBlock = $ this -> mergeMultilines ( $ docBlock ) ; foreach ( explode ( "\n" , $ docBlock ) as $ docLine ) { $ docLine = preg_replace ( self ...
Reads callees from the method doc block .
8,957
private function readDescription ( $ docBlock ) { $ description = preg_replace ( '/^[\s\t]*/m' , '' , $ docBlock ) ; $ description = preg_replace ( '/^\/\*\*\s*|^\s*\*\s|^\s*\*\/$/m' , '' , $ description ) ; $ description = preg_replace ( '/^@.*$/m' , '' , $ description ) ; if ( preg_match ( '/^--.*$/m' , $ description...
Extracts a description from the provided docblock with support for multiline descriptions .
8,958
private function readDocLineCallee ( $ class , ReflectionMethod $ method , $ docLine , $ description = null ) { if ( $ this -> isIgnoredAnnotation ( $ docLine ) ) { return null ; } foreach ( $ this -> readers as $ reader ) { if ( $ callee = $ reader -> readCallee ( $ class , $ method , $ docLine , $ description ) ) { r...
Reads callee from provided doc line using registered annotation readers .
8,959
private function isIgnoredAnnotation ( $ docLine ) { $ lowDocLine = strtolower ( $ docLine ) ; foreach ( self :: $ ignoreAnnotations as $ ignoredAnnotation ) { if ( $ ignoredAnnotation == substr ( $ lowDocLine , 0 , strlen ( $ ignoredAnnotation ) ) ) { return true ; } } return false ; }
Checks if provided doc line is one of the ignored annotations .
8,960
private function loadFactory ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Context\ContextFactory' , array ( new Reference ( ArgumentExtension :: CONSTRUCTOR_ARGUMENT_ORGANISER_ID ) ) ) ; $ container -> setDefinition ( self :: FACTORY_ID , $ definition ) ; }
Loads context factory .
8,961
private function loadArgumentResolverFactory ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Context\Argument\CompositeArgumentResolverFactory' ) ; $ container -> setDefinition ( self :: AGGREGATE_RESOLVER_FACTORY_ID , $ definition ) ; }
Loads argument resolver factory used in the environment handler .
8,962
private function loadEnvironmentHandler ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Context\Environment\Handler\ContextEnvironmentHandler' , array ( new Reference ( self :: FACTORY_ID ) , new Reference ( self :: AGGREGATE_RESOLVER_FACTORY_ID ) ) ) ; $ definition -> addTag ( Environme...
Loads context environment handlers .
8,963
private function loadEnvironmentReader ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Context\Environment\Reader\ContextEnvironmentReader' ) ; $ definition -> addTag ( EnvironmentExtension :: READER_TAG , array ( 'priority' => 50 ) ) ; $ container -> setDefinition ( self :: getEnvironme...
Loads context environment readers .
8,964
private function loadSuiteSetup ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Context\Suite\Setup\SuiteWithContextsSetup' , array ( new Reference ( AutoloaderExtension :: CLASS_LOADER_ID ) , new Reference ( FilesystemExtension :: LOGGER_ID ) ) ) ; $ definition -> addTag ( SuiteExtensio...
Loads context environment setup .
8,965
private function loadSnippetAppender ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Context\Snippet\Appender\ContextSnippetAppender' , array ( new Reference ( FilesystemExtension :: LOGGER_ID ) ) ) ; $ definition -> addTag ( SnippetExtension :: APPENDER_TAG , array ( 'priority' => 50 ) ...
Loads context snippet appender .
8,966
private function loadSnippetGenerators ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Context\Snippet\Generator\ContextSnippetGenerator' , array ( new Reference ( DefinitionExtension :: PATTERN_TRANSFORMER_ID ) ) ) ; $ definition -> addTag ( SnippetExtension :: GENERATOR_TAG , array ( '...
Loads context snippet generators .
8,967
private function loadDefaultClassGenerators ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Context\ContextClass\SimpleClassGenerator' ) ; $ definition -> addTag ( self :: CLASS_GENERATOR_TAG , array ( 'priority' => 50 ) ) ; $ container -> setDefinition ( self :: CLASS_GENERATOR_TAG . '....
Loads default context class generators .
8,968
private function loadDefaultContextReaders ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Context\Reader\AnnotatedContextReader' ) ; $ container -> setDefinition ( self :: getAnnotatedContextReaderId ( ) , $ definition ) ; $ definition = new Definition ( 'Behat\Behat\Context\Reader\Cont...
Loads default context readers .
8,969
private function processClassResolvers ( ContainerBuilder $ container ) { $ references = $ this -> processor -> findAndSortTaggedServices ( $ container , self :: CLASS_RESOLVER_TAG ) ; $ definition = $ container -> getDefinition ( self :: getEnvironmentHandlerId ( ) ) ; foreach ( $ references as $ reference ) { $ defin...
Processes all class resolvers .
8,970
private function processArgumentResolverFactories ( $ container ) { $ references = $ this -> processor -> findAndSortTaggedServices ( $ container , self :: SUITE_SCOPED_RESOLVER_FACTORY_TAG ) ; $ definition = $ container -> getDefinition ( self :: AGGREGATE_RESOLVER_FACTORY_ID ) ; foreach ( $ references as $ reference ...
Processes all argument resolver factories .
8,971
private function processArgumentResolvers ( ContainerBuilder $ container ) { $ references = $ this -> processor -> findAndSortTaggedServices ( $ container , self :: ARGUMENT_RESOLVER_TAG ) ; $ definition = $ container -> getDefinition ( self :: FACTORY_ID ) ; foreach ( $ references as $ reference ) { $ definition -> ad...
Processes all argument resolvers .
8,972
private function processContextInitializers ( ContainerBuilder $ container ) { $ references = $ this -> processor -> findAndSortTaggedServices ( $ container , self :: INITIALIZER_TAG ) ; $ definition = $ container -> getDefinition ( self :: FACTORY_ID ) ; foreach ( $ references as $ reference ) { $ definition -> addMet...
Processes all context initializers .
8,973
private function processContextReaders ( ContainerBuilder $ container ) { $ references = $ this -> processor -> findAndSortTaggedServices ( $ container , self :: READER_TAG ) ; $ definition = $ container -> getDefinition ( self :: getEnvironmentReaderId ( ) ) ; foreach ( $ references as $ reference ) { $ definition -> ...
Processes all context readers .
8,974
private function processClassGenerators ( ContainerBuilder $ container ) { $ references = $ this -> processor -> findAndSortTaggedServices ( $ container , self :: CLASS_GENERATOR_TAG ) ; $ definition = $ container -> getDefinition ( self :: getSuiteSetupId ( ) ) ; foreach ( $ references as $ reference ) { $ definition ...
Processes all class generators .
8,975
private function processAnnotationReaders ( ContainerBuilder $ container ) { $ references = $ this -> processor -> findAndSortTaggedServices ( $ container , self :: ANNOTATION_READER_TAG ) ; $ definition = $ container -> getDefinition ( self :: getAnnotatedContextReaderId ( ) ) ; foreach ( $ references as $ reference )...
Processes all annotation readers .
8,976
public function generatePattern ( $ type , $ stepText ) { foreach ( $ this -> policies as $ policy ) { if ( $ policy -> supportsPatternType ( $ type ) ) { return $ policy -> generatePattern ( $ stepText ) ; } } throw new UnsupportedPatternTypeException ( sprintf ( 'Can not find policy for a pattern type `%s`.' , $ type...
Generates pattern .
8,977
public function transformPatternToRegex ( $ pattern ) { if ( ! isset ( $ this -> patternToRegexpCache [ $ pattern ] ) ) { $ this -> patternToRegexpCache [ $ pattern ] = $ this -> transformPatternToRegexWithSupportedPolicy ( $ pattern ) ; } return $ this -> patternToRegexpCache [ $ pattern ] ; }
Transforms pattern string to regex .
8,978
private function createFeatureDirectory ( $ path ) { mkdir ( $ path , 0777 , true ) ; if ( $ this -> logger ) { $ this -> logger -> directoryCreated ( $ path , 'place your *.feature files here' ) ; } }
Creates feature directory .
8,979
private function locatePath ( $ path ) { if ( $ this -> isAbsolutePath ( $ path ) ) { return $ path ; } return $ this -> basePath . DIRECTORY_SEPARATOR . $ path ; }
Locates path from a relative one .
8,980
public function filterCall ( Call $ call ) { if ( $ container = $ this -> getContainer ( $ call ) ) { $ autowirer = new ArgumentAutowirer ( $ container ) ; $ newArguments = $ autowirer -> autowireArguments ( $ call -> getCallee ( ) -> getReflection ( ) , $ call -> getArguments ( ) ) ; return $ this -> repackageCallIfNe...
Filters a call and returns a new one .
8,981
private function getContainer ( Call $ call ) { if ( ! $ call instanceof EnvironmentCall ) { throw new UnsupportedCallException ( sprintf ( 'ServicesResolver can not filter `%s` call.' , get_class ( $ call ) ) , $ call ) ; } $ environment = $ call -> getEnvironment ( ) ; if ( ! $ environment instanceof ServiceContainer...
Gets container from the call .
8,982
private function repackageCallIfNewArguments ( Call $ call , array $ arguments ) { if ( $ arguments === $ call -> getArguments ( ) ) { return $ call ; } return $ this -> repackageCallWithNewArguments ( $ call , $ arguments ) ; }
Repackages old calls with new arguments but only if two differ .
8,983
private function repackageCallWithNewArguments ( Call $ call , array $ newArguments ) { if ( $ call instanceof DefinitionCall ) { return $ this -> repackageDefinitionCall ( $ call , $ newArguments ) ; } if ( $ call instanceof TransformationCall ) { return $ this -> repackageTransformationCall ( $ call , $ newArguments ...
Repackages old calls with new arguments .
8,984
private function repackageDefinitionCall ( DefinitionCall $ call , array $ newArguments ) { $ definition = $ call -> getCallee ( ) ; if ( ! $ definition instanceof Definition ) { throw new UnsupportedCallException ( sprintf ( 'Something is wrong in callee associated with `%s` call.' , get_class ( $ call ) ) , $ call ) ...
Repackages definition call with new arguments .
8,985
private function repackageTransformationCall ( TransformationCall $ call , array $ newArguments ) { $ transformation = $ call -> getCallee ( ) ; if ( ! $ transformation instanceof Transformation ) { throw new UnsupportedCallException ( sprintf ( 'Something is wrong in callee associated with `%s` call.' , get_class ( $ ...
Repackages transformation call with new arguments .
8,986
private function getSuiteFilters ( Suite $ suite ) { if ( ! $ suite -> hasSetting ( 'filters' ) || ! is_array ( $ suite -> getSetting ( 'filters' ) ) ) { return array ( ) ; } $ filters = array ( ) ; foreach ( $ suite -> getSetting ( 'filters' ) as $ type => $ filterString ) { $ filters [ ] = $ this -> createFilter ( $ ...
Returns list of filters from suite settings .
8,987
private function createFilter ( $ type , $ filterString , Suite $ suite ) { if ( 'role' === $ type ) { return new RoleFilter ( $ filterString ) ; } if ( 'name' === $ type ) { return new NameFilter ( $ filterString ) ; } if ( 'tags' === $ type ) { return new TagFilter ( $ filterString ) ; } if ( 'narrative' === $ type )...
Creates filter of provided type .
8,988
private function moveToNextAvailableFeature ( ) { while ( ! count ( $ this -> features ) && $ this -> position < count ( $ this -> paths ) ) { $ this -> features = $ this -> parseFeature ( $ this -> paths [ $ this -> position ] ) ; $ this -> position ++ ; } $ this -> currentFeature = array_shift ( $ this -> features ) ...
Parses paths consequently .
8,989
private function loadParameters ( ContainerBuilder $ container ) { $ container -> setParameter ( 'gherkin.paths.lib' , $ this -> getLibPath ( ) ) ; $ container -> setParameter ( 'gherkin.paths.i18n' , '%gherkin.paths.lib%/i18n.php' ) ; $ container -> setParameter ( 'suite.generic.default_settings' , array ( 'paths' => ...
Loads default container parameters .
8,990
private function getLibPath ( ) { $ reflection = new ReflectionClass ( 'Behat\Gherkin\Gherkin' ) ; $ libPath = rtrim ( dirname ( $ reflection -> getFilename ( ) ) . '/../../../' , DIRECTORY_SEPARATOR ) ; return $ libPath ; }
Returns gherkin library path .
8,991
private function loadGherkin ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Gherkin\Gherkin' ) ; $ container -> setDefinition ( self :: MANAGER_ID , $ definition ) ; }
Loads gherkin service .
8,992
private function loadKeywords ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Gherkin\Keywords\CachedArrayKeywords' , array ( '%gherkin.paths.i18n%' ) ) ; $ container -> setDefinition ( self :: KEYWORDS_ID , $ definition ) ; $ definition = new Definition ( 'Behat\Gherkin\Keywords\KeywordsDumpe...
Loads keyword services .
8,993
private function loadParser ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Gherkin\Parser' , array ( new Reference ( 'gherkin.lexer' ) ) ) ; $ container -> setDefinition ( 'gherkin.parser' , $ definition ) ; $ definition = new Definition ( 'Behat\Gherkin\Lexer' , array ( new Reference ( 'gher...
Loads gherkin parser .
8,994
private function loadDefaultLoaders ( ContainerBuilder $ container , $ cachePath ) { $ definition = new Definition ( 'Behat\Gherkin\Loader\GherkinFileLoader' , array ( new Reference ( 'gherkin.parser' ) ) ) ; if ( $ cachePath ) { $ cacheDefinition = new Definition ( 'Behat\Gherkin\Cache\FileCache' , array ( $ cachePath...
Loads gherkin loaders .
8,995
private function loadProfileFilters ( ContainerBuilder $ container , array $ filters ) { $ gherkin = $ container -> getDefinition ( self :: MANAGER_ID ) ; foreach ( $ filters as $ type => $ filterString ) { $ filter = $ this -> createFilterDefinition ( $ type , $ filterString ) ; $ gherkin -> addMethodCall ( 'addFilter...
Loads profile - level gherkin filters .
8,996
private function loadSyntaxController ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Gherkin\Cli\SyntaxController' , array ( new Reference ( self :: KEYWORDS_DUMPER_ID ) , new Reference ( TranslatorExtension :: TRANSLATOR_ID ) ) ) ; $ definition -> addTag ( CliExtension :: CONTROLLER_TA...
Loads syntax controller .
8,997
private function loadFilterController ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Gherkin\Cli\FilterController' , array ( new Reference ( self :: MANAGER_ID ) ) ) ; $ definition -> addTag ( CliExtension :: CONTROLLER_TAG , array ( 'priority' => 700 ) ) ; $ container -> setDefinition ...
Loads filter controller .
8,998
private function loadSuiteWithPathsSetup ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Gherkin\Suite\Setup\SuiteWithPathsSetup' , array ( '%paths.base%' , new Reference ( FilesystemExtension :: LOGGER_ID ) ) ) ; $ definition -> addTag ( SuiteExtension :: SETUP_TAG , array ( 'priority' ...
Loads suite with paths setup .
8,999
private function loadFilesystemFeatureLocator ( ContainerBuilder $ container ) { $ definition = new Definition ( 'Behat\Behat\Gherkin\Specification\Locator\FilesystemFeatureLocator' , array ( new Reference ( self :: MANAGER_ID ) , '%paths.base%' ) ) ; $ definition -> addTag ( SpecificationExtension :: LOCATOR_TAG , arr...
Loads filesystem feature locator .