repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6 values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1 value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
typhonius/acquia-php-sdk-v2 | src/CloudApi/Connector.php | Connector.request | public function request(string $verb, string $path, array $query = [], array $options = [])
{
$options['query'] = $query;
if (!empty($options['query']['filter']) && is_array($options['query']['filter'])) {
// Default to an AND filter.
$options['query']['filter'] = implode(',', $options['query']['filter']);
}
$response = $this->makeRequest($verb, $path, $query, $options);
return $this->processResponse($response);
} | php | public function request(string $verb, string $path, array $query = [], array $options = [])
{
$options['query'] = $query;
if (!empty($options['query']['filter']) && is_array($options['query']['filter'])) {
// Default to an AND filter.
$options['query']['filter'] = implode(',', $options['query']['filter']);
}
$response = $this->makeRequest($verb, $path, $query, $options);
return $this->processResponse($response);
} | [
"public",
"function",
"request",
"(",
"string",
"$",
"verb",
",",
"string",
"$",
"path",
",",
"array",
"$",
"query",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"[",
"'query'",
"]",
"=",
"$",
"query",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"options",
"[",
"'query'",
"]",
"[",
"'filter'",
"]",
")",
"&&",
"is_array",
"(",
"$",
"options",
"[",
"'query'",
"]",
"[",
"'filter'",
"]",
")",
")",
"{",
"// Default to an AND filter.",
"$",
"options",
"[",
"'query'",
"]",
"[",
"'filter'",
"]",
"=",
"implode",
"(",
"','",
",",
"$",
"options",
"[",
"'query'",
"]",
"[",
"'filter'",
"]",
")",
";",
"}",
"$",
"response",
"=",
"$",
"this",
"->",
"makeRequest",
"(",
"$",
"verb",
",",
"$",
"path",
",",
"$",
"query",
",",
"$",
"options",
")",
";",
"return",
"$",
"this",
"->",
"processResponse",
"(",
"$",
"response",
")",
";",
"}"
] | Takes parameters passed in, makes a request to the API, and processes the response.
@param string $verb
@param string $path
@param array $query
@param array $options
@return object|array|StreamInterface | [
"Takes",
"parameters",
"passed",
"in",
"makes",
"a",
"request",
"to",
"the",
"API",
"and",
"processes",
"the",
"response",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Connector.php#L61-L72 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Connector.php | Connector.makeRequest | public function makeRequest(string $verb, string $path, array $query = [], array $options = [])
{
try {
$response = $this->client->$verb(self::BASE_URI . $path, $options);
} catch (ClientException $e) {
print $e->getMessage();
$response = $e->getResponse();
}
return $response;
} | php | public function makeRequest(string $verb, string $path, array $query = [], array $options = [])
{
try {
$response = $this->client->$verb(self::BASE_URI . $path, $options);
} catch (ClientException $e) {
print $e->getMessage();
$response = $e->getResponse();
}
return $response;
} | [
"public",
"function",
"makeRequest",
"(",
"string",
"$",
"verb",
",",
"string",
"$",
"path",
",",
"array",
"$",
"query",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"$",
"verb",
"(",
"self",
"::",
"BASE_URI",
".",
"$",
"path",
",",
"$",
"options",
")",
";",
"}",
"catch",
"(",
"ClientException",
"$",
"e",
")",
"{",
"print",
"$",
"e",
"->",
"getMessage",
"(",
")",
";",
"$",
"response",
"=",
"$",
"e",
"->",
"getResponse",
"(",
")",
";",
"}",
"return",
"$",
"response",
";",
"}"
] | Makes a request to the API.
@param string $verb
@param string $path
@param array $query
@param array $options
@return ResponseInterface | [
"Makes",
"a",
"request",
"to",
"the",
"API",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Connector.php#L83-L93 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Connector.php | Connector.processResponse | public function processResponse(ResponseInterface $response)
{
$body = $response->getBody();
$object = json_decode($body);
if (json_last_error() === JSON_ERROR_NONE) {
// JSON is valid
if (property_exists($object, '_embedded') && property_exists($object->_embedded, 'items')) {
$return = $object->_embedded->items;
} elseif (property_exists($object, 'error')) {
if (is_array($object->message)) {
foreach ($object->message as $message) {
$output .= $message;
}
throw new \Exception($output);
} else {
throw new \Exception($object->message);
}
} else {
$return = $object;
}
} else {
$return = $body;
}
return $return;
} | php | public function processResponse(ResponseInterface $response)
{
$body = $response->getBody();
$object = json_decode($body);
if (json_last_error() === JSON_ERROR_NONE) {
// JSON is valid
if (property_exists($object, '_embedded') && property_exists($object->_embedded, 'items')) {
$return = $object->_embedded->items;
} elseif (property_exists($object, 'error')) {
if (is_array($object->message)) {
foreach ($object->message as $message) {
$output .= $message;
}
throw new \Exception($output);
} else {
throw new \Exception($object->message);
}
} else {
$return = $object;
}
} else {
$return = $body;
}
return $return;
} | [
"public",
"function",
"processResponse",
"(",
"ResponseInterface",
"$",
"response",
")",
"{",
"$",
"body",
"=",
"$",
"response",
"->",
"getBody",
"(",
")",
";",
"$",
"object",
"=",
"json_decode",
"(",
"$",
"body",
")",
";",
"if",
"(",
"json_last_error",
"(",
")",
"===",
"JSON_ERROR_NONE",
")",
"{",
"// JSON is valid",
"if",
"(",
"property_exists",
"(",
"$",
"object",
",",
"'_embedded'",
")",
"&&",
"property_exists",
"(",
"$",
"object",
"->",
"_embedded",
",",
"'items'",
")",
")",
"{",
"$",
"return",
"=",
"$",
"object",
"->",
"_embedded",
"->",
"items",
";",
"}",
"elseif",
"(",
"property_exists",
"(",
"$",
"object",
",",
"'error'",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"object",
"->",
"message",
")",
")",
"{",
"foreach",
"(",
"$",
"object",
"->",
"message",
"as",
"$",
"message",
")",
"{",
"$",
"output",
".=",
"$",
"message",
";",
"}",
"throw",
"new",
"\\",
"Exception",
"(",
"$",
"output",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"$",
"object",
"->",
"message",
")",
";",
"}",
"}",
"else",
"{",
"$",
"return",
"=",
"$",
"object",
";",
"}",
"}",
"else",
"{",
"$",
"return",
"=",
"$",
"body",
";",
"}",
"return",
"$",
"return",
";",
"}"
] | Processes the returned response from the API.
@param ResponseInterface $response
@return object|array|StreamInterface
@throws \Exception | [
"Processes",
"the",
"returned",
"response",
"from",
"the",
"API",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Connector.php#L102-L129 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.addQuery | public function addQuery($name, $value)
{
$this->query = array_merge_recursive($this->query, [$name => $value]);
} | php | public function addQuery($name, $value)
{
$this->query = array_merge_recursive($this->query, [$name => $value]);
} | [
"public",
"function",
"addQuery",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"query",
"=",
"array_merge_recursive",
"(",
"$",
"this",
"->",
"query",
",",
"[",
"$",
"name",
"=>",
"$",
"value",
"]",
")",
";",
"}"
] | Add a query parameter to filter results.
@param string $name
@param string $value | [
"Add",
"a",
"query",
"parameter",
"to",
"filter",
"results",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L90-L93 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.databaseCopy | public function databaseCopy($environmentFromUuid, $dbName, $environmentToUuid)
{
$options = [
'form_params' => [
'name' => $dbName,
'source' => $environmentFromUuid,
],
];
return new OperationResponse(
$this->connector->request('post', "/environments/${environmentToUuid}/databases", $this->query, $options)
);
} | php | public function databaseCopy($environmentFromUuid, $dbName, $environmentToUuid)
{
$options = [
'form_params' => [
'name' => $dbName,
'source' => $environmentFromUuid,
],
];
return new OperationResponse(
$this->connector->request('post', "/environments/${environmentToUuid}/databases", $this->query, $options)
);
} | [
"public",
"function",
"databaseCopy",
"(",
"$",
"environmentFromUuid",
",",
"$",
"dbName",
",",
"$",
"environmentToUuid",
")",
"{",
"$",
"options",
"=",
"[",
"'form_params'",
"=>",
"[",
"'name'",
"=>",
"$",
"dbName",
",",
"'source'",
"=>",
"$",
"environmentFromUuid",
",",
"]",
",",
"]",
";",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'post'",
",",
"\"/environments/${environmentToUuid}/databases\"",
",",
"$",
"this",
"->",
"query",
",",
"$",
"options",
")",
")",
";",
"}"
] | Copies a database from an environment to an environment.
@param string $environmentFromUuid
@param string $dbName
@param string $environmentToUuid
@return OperationResponse | [
"Copies",
"a",
"database",
"from",
"an",
"environment",
"to",
"an",
"environment",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L207-L219 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.databaseCreate | public function databaseCreate($applicationUuid, $name)
{
$options = [
'form_params' => [
'name' => $name,
],
];
return new OperationResponse(
$this->connector->request('post', "/applications/${applicationUuid}/databases", $this->query, $options)
);
} | php | public function databaseCreate($applicationUuid, $name)
{
$options = [
'form_params' => [
'name' => $name,
],
];
return new OperationResponse(
$this->connector->request('post', "/applications/${applicationUuid}/databases", $this->query, $options)
);
} | [
"public",
"function",
"databaseCreate",
"(",
"$",
"applicationUuid",
",",
"$",
"name",
")",
"{",
"$",
"options",
"=",
"[",
"'form_params'",
"=>",
"[",
"'name'",
"=>",
"$",
"name",
",",
"]",
",",
"]",
";",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'post'",
",",
"\"/applications/${applicationUuid}/databases\"",
",",
"$",
"this",
"->",
"query",
",",
"$",
"options",
")",
")",
";",
"}"
] | Create a new database.
@param string $applicationUuid
@param string $name
@return OperationResponse | [
"Create",
"a",
"new",
"database",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L228-L239 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.databaseBackup | public function databaseBackup($environmentUuid, $dbName, $backupId)
{
return new BackupResponse(
$this->connector->request(
'get',
"/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}",
$this->query
)
);
} | php | public function databaseBackup($environmentUuid, $dbName, $backupId)
{
return new BackupResponse(
$this->connector->request(
'get',
"/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}",
$this->query
)
);
} | [
"public",
"function",
"databaseBackup",
"(",
"$",
"environmentUuid",
",",
"$",
"dbName",
",",
"$",
"backupId",
")",
"{",
"return",
"new",
"BackupResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'get'",
",",
"\"/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}\"",
",",
"$",
"this",
"->",
"query",
")",
")",
";",
"}"
] | Gets information about a database backup.
@param string $environmentUuid
@param string $dbName
@param int $backupId
@return BackupResponse | [
"Gets",
"information",
"about",
"a",
"database",
"backup",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L299-L308 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.restoreDatabaseBackup | public function restoreDatabaseBackup($environmentUuid, $dbName, $backupId)
{
return new OperationResponse(
$this->connector->request(
'post',
"/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}/actions/restore",
$this->query
)
);
} | php | public function restoreDatabaseBackup($environmentUuid, $dbName, $backupId)
{
return new OperationResponse(
$this->connector->request(
'post',
"/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}/actions/restore",
$this->query
)
);
} | [
"public",
"function",
"restoreDatabaseBackup",
"(",
"$",
"environmentUuid",
",",
"$",
"dbName",
",",
"$",
"backupId",
")",
"{",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'post'",
",",
"\"/environments/${environmentUuid}/databases/${dbName}/backups/${backupId}/actions/restore\"",
",",
"$",
"this",
"->",
"query",
")",
")",
";",
"}"
] | Restores a database backup to a database in an environment.
@param string $environmentUuid
@param string $dbName
@param int $backupId
@return OperationResponse | [
"Restores",
"a",
"database",
"backup",
"to",
"a",
"database",
"in",
"an",
"environment",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L318-L327 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.copyFiles | public function copyFiles($environmentUuidFrom, $environmentUuidTo)
{
$options = [
'form_params' => [
'source' => $environmentUuidFrom,
],
];
return new OperationResponse(
$this->connector->request('post', "/environments/${environmentUuidTo}/files", $this->query, $options)
);
} | php | public function copyFiles($environmentUuidFrom, $environmentUuidTo)
{
$options = [
'form_params' => [
'source' => $environmentUuidFrom,
],
];
return new OperationResponse(
$this->connector->request('post', "/environments/${environmentUuidTo}/files", $this->query, $options)
);
} | [
"public",
"function",
"copyFiles",
"(",
"$",
"environmentUuidFrom",
",",
"$",
"environmentUuidTo",
")",
"{",
"$",
"options",
"=",
"[",
"'form_params'",
"=>",
"[",
"'source'",
"=>",
"$",
"environmentUuidFrom",
",",
"]",
",",
"]",
";",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'post'",
",",
"\"/environments/${environmentUuidTo}/files\"",
",",
"$",
"this",
"->",
"query",
",",
"$",
"options",
")",
")",
";",
"}"
] | Copies files from an environment to another environment.
@param string $environmentUuidFrom
@param string $environmentUuidTo
@return OperationResponse | [
"Copies",
"files",
"from",
"an",
"environment",
"to",
"another",
"environment",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L336-L347 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.switchCode | public function switchCode($environmentUuid, $branch)
{
$options = [
'form_params' => [
'branch' => $branch,
],
];
return new OperationResponse(
$this->connector->request(
'post',
"/environments/${environmentUuid}/code/actions/switch",
$this->query,
$options
)
);
} | php | public function switchCode($environmentUuid, $branch)
{
$options = [
'form_params' => [
'branch' => $branch,
],
];
return new OperationResponse(
$this->connector->request(
'post',
"/environments/${environmentUuid}/code/actions/switch",
$this->query,
$options
)
);
} | [
"public",
"function",
"switchCode",
"(",
"$",
"environmentUuid",
",",
"$",
"branch",
")",
"{",
"$",
"options",
"=",
"[",
"'form_params'",
"=>",
"[",
"'branch'",
"=>",
"$",
"branch",
",",
"]",
",",
"]",
";",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'post'",
",",
"\"/environments/${environmentUuid}/code/actions/switch\"",
",",
"$",
"this",
"->",
"query",
",",
"$",
"options",
")",
")",
";",
"}"
] | Deploys a code branch/tag to an environment.
@param string $environmentUuid
@param string $branch
@return OperationResponse | [
"Deploys",
"a",
"code",
"branch",
"/",
"tag",
"to",
"an",
"environment",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L356-L373 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.deployCode | public function deployCode($environmentFromUuid, $environmentToUuid, $commitMessage = null)
{
$options = [
'form_params' => [
'source' => $environmentFromUuid,
'message' => $commitMessage,
],
];
return new OperationResponse(
$this->connector->request(
'post',
"/environments/${environmentToUuid}/code",
$this->query,
$options
)
);
} | php | public function deployCode($environmentFromUuid, $environmentToUuid, $commitMessage = null)
{
$options = [
'form_params' => [
'source' => $environmentFromUuid,
'message' => $commitMessage,
],
];
return new OperationResponse(
$this->connector->request(
'post',
"/environments/${environmentToUuid}/code",
$this->query,
$options
)
);
} | [
"public",
"function",
"deployCode",
"(",
"$",
"environmentFromUuid",
",",
"$",
"environmentToUuid",
",",
"$",
"commitMessage",
"=",
"null",
")",
"{",
"$",
"options",
"=",
"[",
"'form_params'",
"=>",
"[",
"'source'",
"=>",
"$",
"environmentFromUuid",
",",
"'message'",
"=>",
"$",
"commitMessage",
",",
"]",
",",
"]",
";",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'post'",
",",
"\"/environments/${environmentToUuid}/code\"",
",",
"$",
"this",
"->",
"query",
",",
"$",
"options",
")",
")",
";",
"}"
] | Deploys code from one environment to another environment.
@param string $environmentFromUuid
@param string $environmentToUuid
@param string $commitMessage | [
"Deploys",
"code",
"from",
"one",
"environment",
"to",
"another",
"environment",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L382-L400 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.createDomain | public function createDomain($environmentUuid, $hostname)
{
$options = [
'form_params' => [
'hostname' => $hostname,
],
];
return new OperationResponse(
$this->connector->request('post', "/environments/${environmentUuid}/domains", $this->query, $options)
);
} | php | public function createDomain($environmentUuid, $hostname)
{
$options = [
'form_params' => [
'hostname' => $hostname,
],
];
return new OperationResponse(
$this->connector->request('post', "/environments/${environmentUuid}/domains", $this->query, $options)
);
} | [
"public",
"function",
"createDomain",
"(",
"$",
"environmentUuid",
",",
"$",
"hostname",
")",
"{",
"$",
"options",
"=",
"[",
"'form_params'",
"=>",
"[",
"'hostname'",
"=>",
"$",
"hostname",
",",
"]",
",",
"]",
";",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'post'",
",",
"\"/environments/${environmentUuid}/domains\"",
",",
"$",
"this",
"->",
"query",
",",
"$",
"options",
")",
")",
";",
"}"
] | Adds a domain to an environment.
@param string $environmentUuid
@param string $hostname
@return OperationResponse | [
"Adds",
"a",
"domain",
"to",
"an",
"environment",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L426-L438 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.purgeVarnishCache | public function purgeVarnishCache($environmentUuid, array $domains)
{
$options = [
'form_params' => [
'domains' => $domains,
],
];
return new OperationResponse(
$this->connector->request(
'post',
"/environments/${environmentUuid}/domains/actions/clear-varnish",
$this->query,
$options
)
);
} | php | public function purgeVarnishCache($environmentUuid, array $domains)
{
$options = [
'form_params' => [
'domains' => $domains,
],
];
return new OperationResponse(
$this->connector->request(
'post',
"/environments/${environmentUuid}/domains/actions/clear-varnish",
$this->query,
$options
)
);
} | [
"public",
"function",
"purgeVarnishCache",
"(",
"$",
"environmentUuid",
",",
"array",
"$",
"domains",
")",
"{",
"$",
"options",
"=",
"[",
"'form_params'",
"=>",
"[",
"'domains'",
"=>",
"$",
"domains",
",",
"]",
",",
"]",
";",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'post'",
",",
"\"/environments/${environmentUuid}/domains/actions/clear-varnish\"",
",",
"$",
"this",
"->",
"query",
",",
"$",
"options",
")",
")",
";",
"}"
] | Purges varnish for selected domains in an environment.
@param string $environmentUuid
@param array $domains
@return OperationResponse | [
"Purges",
"varnish",
"for",
"selected",
"domains",
"in",
"an",
"environment",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L461-L478 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.renameEnvironment | public function renameEnvironment($environmentUuid, $label)
{
$options = [
'form_params' => [
'label' => $label,
],
];
return new OperationResponse(
$this->connector->request(
'post',
"/environments/${environmentUuid}/actions/change-label",
$this->query,
$options
)
);
} | php | public function renameEnvironment($environmentUuid, $label)
{
$options = [
'form_params' => [
'label' => $label,
],
];
return new OperationResponse(
$this->connector->request(
'post',
"/environments/${environmentUuid}/actions/change-label",
$this->query,
$options
)
);
} | [
"public",
"function",
"renameEnvironment",
"(",
"$",
"environmentUuid",
",",
"$",
"label",
")",
"{",
"$",
"options",
"=",
"[",
"'form_params'",
"=>",
"[",
"'label'",
"=>",
"$",
"label",
",",
"]",
",",
"]",
";",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'post'",
",",
"\"/environments/${environmentUuid}/actions/change-label\"",
",",
"$",
"this",
"->",
"query",
",",
"$",
"options",
")",
")",
";",
"}"
] | Renames an environment.
@param string $environmentUuid
@param string $label
@return OperationResponse | [
"Renames",
"an",
"environment",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L538-L555 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.disableLiveDev | public function disableLiveDev($environmentUuid)
{
$options = [
'form_params' => [
'discard' => 1,
],
];
return new OperationResponse(
$this->connector->request(
'post',
"/environments/${environmentUuid}/livedev/actions/disable",
$this->query,
$options
)
);
} | php | public function disableLiveDev($environmentUuid)
{
$options = [
'form_params' => [
'discard' => 1,
],
];
return new OperationResponse(
$this->connector->request(
'post',
"/environments/${environmentUuid}/livedev/actions/disable",
$this->query,
$options
)
);
} | [
"public",
"function",
"disableLiveDev",
"(",
"$",
"environmentUuid",
")",
"{",
"$",
"options",
"=",
"[",
"'form_params'",
"=>",
"[",
"'discard'",
"=>",
"1",
",",
"]",
",",
"]",
";",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'post'",
",",
"\"/environments/${environmentUuid}/livedev/actions/disable\"",
",",
"$",
"this",
"->",
"query",
",",
"$",
"options",
")",
")",
";",
"}"
] | Disable livedev mode for an environment.
@param string $environmentUuid
@return OperationResponse | [
"Disable",
"livedev",
"mode",
"for",
"an",
"environment",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L593-L610 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.createCron | public function createCron($environmentUuid, $command, $frequency, $label)
{
$options = [
'form_params' => [
'command' => $command,
'frequency' => $frequency,
'label' => $label,
],
];
return new OperationResponse(
$this->connector->request('post', "/environments/${environmentUuid}/crons", $this->query, $options)
);
} | php | public function createCron($environmentUuid, $command, $frequency, $label)
{
$options = [
'form_params' => [
'command' => $command,
'frequency' => $frequency,
'label' => $label,
],
];
return new OperationResponse(
$this->connector->request('post', "/environments/${environmentUuid}/crons", $this->query, $options)
);
} | [
"public",
"function",
"createCron",
"(",
"$",
"environmentUuid",
",",
"$",
"command",
",",
"$",
"frequency",
",",
"$",
"label",
")",
"{",
"$",
"options",
"=",
"[",
"'form_params'",
"=>",
"[",
"'command'",
"=>",
"$",
"command",
",",
"'frequency'",
"=>",
"$",
"frequency",
",",
"'label'",
"=>",
"$",
"label",
",",
"]",
",",
"]",
";",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'post'",
",",
"\"/environments/${environmentUuid}/crons\"",
",",
"$",
"this",
"->",
"query",
",",
"$",
"options",
")",
")",
";",
"}"
] | Add a cron task.
@param string $environmentUuid
@param string $command
@param string $frequency
@param string $label
@return OperationResponse | [
"Add",
"a",
"cron",
"task",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L690-L704 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.updateRole | public function updateRole($roleUuid, array $permissions)
{
$options = [
'form_params' => [
'permissions' => $permissions,
],
];
return new OperationResponse(
$this->connector->request('put', "/roles/${roleUuid}", $this->query, $options)
);
} | php | public function updateRole($roleUuid, array $permissions)
{
$options = [
'form_params' => [
'permissions' => $permissions,
],
];
return new OperationResponse(
$this->connector->request('put', "/roles/${roleUuid}", $this->query, $options)
);
} | [
"public",
"function",
"updateRole",
"(",
"$",
"roleUuid",
",",
"array",
"$",
"permissions",
")",
"{",
"$",
"options",
"=",
"[",
"'form_params'",
"=>",
"[",
"'permissions'",
"=>",
"$",
"permissions",
",",
"]",
",",
"]",
";",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'put'",
",",
"\"/roles/${roleUuid}\"",
",",
"$",
"this",
"->",
"query",
",",
"$",
"options",
")",
")",
";",
"}"
] | Update the permissions associated with a role.
@param string $roleUuid
@param array $permissions
@return OperationResponse | [
"Update",
"the",
"permissions",
"associated",
"with",
"a",
"role",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L836-L847 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.createRole | public function createRole($organizationUuid, $name, array $permissions, $description = null)
{
$options = [
'form_params' => [
'name' => $name,
'permissions' => $permissions,
'description' => $description,
],
];
return new OperationResponse(
$this->connector->request('post', "/organizations/${organizationUuid}/roles", $this->query, $options)
);
} | php | public function createRole($organizationUuid, $name, array $permissions, $description = null)
{
$options = [
'form_params' => [
'name' => $name,
'permissions' => $permissions,
'description' => $description,
],
];
return new OperationResponse(
$this->connector->request('post', "/organizations/${organizationUuid}/roles", $this->query, $options)
);
} | [
"public",
"function",
"createRole",
"(",
"$",
"organizationUuid",
",",
"$",
"name",
",",
"array",
"$",
"permissions",
",",
"$",
"description",
"=",
"null",
")",
"{",
"$",
"options",
"=",
"[",
"'form_params'",
"=>",
"[",
"'name'",
"=>",
"$",
"name",
",",
"'permissions'",
"=>",
"$",
"permissions",
",",
"'description'",
"=>",
"$",
"description",
",",
"]",
",",
"]",
";",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'post'",
",",
"\"/organizations/${organizationUuid}/roles\"",
",",
"$",
"this",
"->",
"query",
",",
"$",
"options",
")",
")",
";",
"}"
] | Create a new role.
@param string $organizationUuid
@param string $name
@param array $permissions
@param null|string $description
@return OperationResponse | [
"Create",
"a",
"new",
"role",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L858-L871 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.renameTeam | public function renameTeam($teamUuid, $name)
{
$options = [
'form_params' => [
'name' => $name,
],
];
return new OperationResponse(
$this->connector->request('put', "/teams/${teamUuid}", $options)
);
} | php | public function renameTeam($teamUuid, $name)
{
$options = [
'form_params' => [
'name' => $name,
],
];
return new OperationResponse(
$this->connector->request('put', "/teams/${teamUuid}", $options)
);
} | [
"public",
"function",
"renameTeam",
"(",
"$",
"teamUuid",
",",
"$",
"name",
")",
"{",
"$",
"options",
"=",
"[",
"'form_params'",
"=>",
"[",
"'name'",
"=>",
"$",
"name",
",",
"]",
",",
"]",
";",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'put'",
",",
"\"/teams/${teamUuid}\"",
",",
"$",
"options",
")",
")",
";",
"}"
] | Rename an existing team.
@param string $teamUuid
@param string $name
@return OperationResponse | [
"Rename",
"an",
"existing",
"team",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L916-L927 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.createTeam | public function createTeam($organizationUuid, $name)
{
$options = [
'form_params' => [
'name' => $name,
],
];
return new OperationResponse(
$this->connector->request('post', "/organizations/${organizationUuid}/teams", $this->query, $options)
);
} | php | public function createTeam($organizationUuid, $name)
{
$options = [
'form_params' => [
'name' => $name,
],
];
return new OperationResponse(
$this->connector->request('post', "/organizations/${organizationUuid}/teams", $this->query, $options)
);
} | [
"public",
"function",
"createTeam",
"(",
"$",
"organizationUuid",
",",
"$",
"name",
")",
"{",
"$",
"options",
"=",
"[",
"'form_params'",
"=>",
"[",
"'name'",
"=>",
"$",
"name",
",",
"]",
",",
"]",
";",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'post'",
",",
"\"/organizations/${organizationUuid}/teams\"",
",",
"$",
"this",
"->",
"query",
",",
"$",
"options",
")",
")",
";",
"}"
] | Create a new team.
@param string $organizationUuid
@param string $name
@return OperationResponse | [
"Create",
"a",
"new",
"team",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L936-L947 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.addApplicationToTeam | public function addApplicationToTeam($teamUuid, $applicationUuid)
{
$options = [
'form_params' => [
'uuid' => $applicationUuid,
],
];
return new OperationResponse(
$this->connector->request('post', "/teams/${teamUuid}/applications", $this->query, $options)
);
} | php | public function addApplicationToTeam($teamUuid, $applicationUuid)
{
$options = [
'form_params' => [
'uuid' => $applicationUuid,
],
];
return new OperationResponse(
$this->connector->request('post', "/teams/${teamUuid}/applications", $this->query, $options)
);
} | [
"public",
"function",
"addApplicationToTeam",
"(",
"$",
"teamUuid",
",",
"$",
"applicationUuid",
")",
"{",
"$",
"options",
"=",
"[",
"'form_params'",
"=>",
"[",
"'uuid'",
"=>",
"$",
"applicationUuid",
",",
"]",
",",
"]",
";",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'post'",
",",
"\"/teams/${teamUuid}/applications\"",
",",
"$",
"this",
"->",
"query",
",",
"$",
"options",
")",
")",
";",
"}"
] | Add an application to a team.
@param string $teamUuid
@param string $applicationUuid
@return OperationResponse | [
"Add",
"an",
"application",
"to",
"a",
"team",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L969-L980 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.createTeamInvite | public function createTeamInvite($teamUuid, $email, $roles)
{
$options = [
'form_params' => [
'email' => $email,
'roles' => $roles
],
];
return new OperationResponse(
$this->connector->request('post', "/teams/${teamUuid}/invites", $options)
);
} | php | public function createTeamInvite($teamUuid, $email, $roles)
{
$options = [
'form_params' => [
'email' => $email,
'roles' => $roles
],
];
return new OperationResponse(
$this->connector->request('post', "/teams/${teamUuid}/invites", $options)
);
} | [
"public",
"function",
"createTeamInvite",
"(",
"$",
"teamUuid",
",",
"$",
"email",
",",
"$",
"roles",
")",
"{",
"$",
"options",
"=",
"[",
"'form_params'",
"=>",
"[",
"'email'",
"=>",
"$",
"email",
",",
"'roles'",
"=>",
"$",
"roles",
"]",
",",
"]",
";",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'post'",
",",
"\"/teams/${teamUuid}/invites\"",
",",
"$",
"options",
")",
")",
";",
"}"
] | Invites a user to join a team.
@param string $teamUuid
@param string $email
@param array $roles
@return OperationResponse | [
"Invites",
"a",
"user",
"to",
"join",
"a",
"team",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L990-L1002 |
typhonius/acquia-php-sdk-v2 | src/CloudApi/Client.php | Client.createOrganizationAdminInvite | public function createOrganizationAdminInvite($organizationUuid, $email)
{
$options = [
'form_params' => [
'email' => $email,
],
];
return new OperationResponse(
$this->connector->request('post', "/teams/${organizationUuid}/invites", $this->query, $options)
);
} | php | public function createOrganizationAdminInvite($organizationUuid, $email)
{
$options = [
'form_params' => [
'email' => $email,
],
];
return new OperationResponse(
$this->connector->request('post', "/teams/${organizationUuid}/invites", $this->query, $options)
);
} | [
"public",
"function",
"createOrganizationAdminInvite",
"(",
"$",
"organizationUuid",
",",
"$",
"email",
")",
"{",
"$",
"options",
"=",
"[",
"'form_params'",
"=>",
"[",
"'email'",
"=>",
"$",
"email",
",",
"]",
",",
"]",
";",
"return",
"new",
"OperationResponse",
"(",
"$",
"this",
"->",
"connector",
"->",
"request",
"(",
"'post'",
",",
"\"/teams/${organizationUuid}/invites\"",
",",
"$",
"this",
"->",
"query",
",",
"$",
"options",
")",
")",
";",
"}"
] | Invites a user to become admin of an organization.
@param string $organizationUuid
@param string $email
@return OperationResponse | [
"Invites",
"a",
"user",
"to",
"become",
"admin",
"of",
"an",
"organization",
"."
] | train | https://github.com/typhonius/acquia-php-sdk-v2/blob/d7a3349052dd26e85f60a7a002118d0afd70c8a5/src/CloudApi/Client.php#L1011-L1022 |
Waavi/url-shortener | src/Drivers/BaseDriver.php | BaseDriver.shorten | public function shorten($url)
{
$link = new Link;
$link->setLongUrl($url);
$this->provider->shorten($link);
return $link->getShortUrl();
} | php | public function shorten($url)
{
$link = new Link;
$link->setLongUrl($url);
$this->provider->shorten($link);
return $link->getShortUrl();
} | [
"public",
"function",
"shorten",
"(",
"$",
"url",
")",
"{",
"$",
"link",
"=",
"new",
"Link",
";",
"$",
"link",
"->",
"setLongUrl",
"(",
"$",
"url",
")",
";",
"$",
"this",
"->",
"provider",
"->",
"shorten",
"(",
"$",
"link",
")",
";",
"return",
"$",
"link",
"->",
"getShortUrl",
"(",
")",
";",
"}"
] | Shorten the given url
@param string $url
@throws \Guzzle\Http\Exception\BadResponseException
@throws \Mremi\UrlShortener\Exception\InvalidApiResponseException
@return string | [
"Shorten",
"the",
"given",
"url"
] | train | https://github.com/Waavi/url-shortener/blob/15301d166765681929e1bdc25eb2c1e01d416f31/src/Drivers/BaseDriver.php#L24-L30 |
Waavi/url-shortener | src/Drivers/BaseDriver.php | BaseDriver.expand | public function expand($url)
{
$link = new Link;
$link->setShortUrl($url);
$this->provider->expand($link);
return $link->getLongUrl();
} | php | public function expand($url)
{
$link = new Link;
$link->setShortUrl($url);
$this->provider->expand($link);
return $link->getLongUrl();
} | [
"public",
"function",
"expand",
"(",
"$",
"url",
")",
"{",
"$",
"link",
"=",
"new",
"Link",
";",
"$",
"link",
"->",
"setShortUrl",
"(",
"$",
"url",
")",
";",
"$",
"this",
"->",
"provider",
"->",
"expand",
"(",
"$",
"link",
")",
";",
"return",
"$",
"link",
"->",
"getLongUrl",
"(",
")",
";",
"}"
] | Expand the given url
@param string $url
@throws \Guzzle\Http\Exception\BadResponseException
@throws \Mremi\UrlShortener\Exception\InvalidApiResponseException
@return string | [
"Expand",
"the",
"given",
"url"
] | train | https://github.com/Waavi/url-shortener/blob/15301d166765681929e1bdc25eb2c1e01d416f31/src/Drivers/BaseDriver.php#L40-L46 |
Waavi/url-shortener | src/UrlShortener.php | UrlShortener.driver | public function driver($driverName)
{
$shortener = new UrlShortener($this->driverFactory);
$shortener->setDriver($driverName);
return $shortener;
} | php | public function driver($driverName)
{
$shortener = new UrlShortener($this->driverFactory);
$shortener->setDriver($driverName);
return $shortener;
} | [
"public",
"function",
"driver",
"(",
"$",
"driverName",
")",
"{",
"$",
"shortener",
"=",
"new",
"UrlShortener",
"(",
"$",
"this",
"->",
"driverFactory",
")",
";",
"$",
"shortener",
"->",
"setDriver",
"(",
"$",
"driverName",
")",
";",
"return",
"$",
"shortener",
";",
"}"
] | Creates a new URL Shortener instance with the given driver name.
Useful for chained calls using the facade when a different driver is to be used for just one request.
@param string $driverName
@return UrlShortener | [
"Creates",
"a",
"new",
"URL",
"Shortener",
"instance",
"with",
"the",
"given",
"driver",
"name",
".",
"Useful",
"for",
"chained",
"calls",
"using",
"the",
"facade",
"when",
"a",
"different",
"driver",
"is",
"to",
"be",
"used",
"for",
"just",
"one",
"request",
"."
] | train | https://github.com/Waavi/url-shortener/blob/15301d166765681929e1bdc25eb2c1e01d416f31/src/UrlShortener.php#L40-L45 |
Waavi/url-shortener | src/UrlShortener.php | UrlShortener.expand | public function expand($url)
{
try {
return $this->driver->expand($url);
} catch (BadResponseException $e) {
throw new Exceptions\InvalidResponseException($e->getMessage());
} catch (InvalidApiResponseException $e) {
throw new Exceptions\InvalidResponseException($e->getMessage());
}
} | php | public function expand($url)
{
try {
return $this->driver->expand($url);
} catch (BadResponseException $e) {
throw new Exceptions\InvalidResponseException($e->getMessage());
} catch (InvalidApiResponseException $e) {
throw new Exceptions\InvalidResponseException($e->getMessage());
}
} | [
"public",
"function",
"expand",
"(",
"$",
"url",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"driver",
"->",
"expand",
"(",
"$",
"url",
")",
";",
"}",
"catch",
"(",
"BadResponseException",
"$",
"e",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"InvalidResponseException",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"}",
"catch",
"(",
"InvalidApiResponseException",
"$",
"e",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"InvalidResponseException",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | Expand the given url
@param string $url
@throws InvalidResponseException
@return string | [
"Expand",
"the",
"given",
"url"
] | train | https://github.com/Waavi/url-shortener/blob/15301d166765681929e1bdc25eb2c1e01d416f31/src/UrlShortener.php#L72-L81 |
Waavi/url-shortener | src/Drivers/Factory.php | Factory.make | public function make($driverName)
{
$driverName = trim(strtolower($driverName));
switch ($driverName) {
case 'google':
return $this->google;
case 'bitly':
return $this->bitly;
default:
throw new InvalidArgumentException('Invalid URL Shortener driver name');
}
} | php | public function make($driverName)
{
$driverName = trim(strtolower($driverName));
switch ($driverName) {
case 'google':
return $this->google;
case 'bitly':
return $this->bitly;
default:
throw new InvalidArgumentException('Invalid URL Shortener driver name');
}
} | [
"public",
"function",
"make",
"(",
"$",
"driverName",
")",
"{",
"$",
"driverName",
"=",
"trim",
"(",
"strtolower",
"(",
"$",
"driverName",
")",
")",
";",
"switch",
"(",
"$",
"driverName",
")",
"{",
"case",
"'google'",
":",
"return",
"$",
"this",
"->",
"google",
";",
"case",
"'bitly'",
":",
"return",
"$",
"this",
"->",
"bitly",
";",
"default",
":",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Invalid URL Shortener driver name'",
")",
";",
"}",
"}"
] | Create a new Url Shortener driver instance based on its name
@param string $driverName google|bitly
@throws InvalidArgumentException
@return DriverInterface | [
"Create",
"a",
"new",
"Url",
"Shortener",
"driver",
"instance",
"based",
"on",
"its",
"name"
] | train | https://github.com/Waavi/url-shortener/blob/15301d166765681929e1bdc25eb2c1e01d416f31/src/Drivers/Factory.php#L49-L60 |
Waavi/url-shortener | src/UrlShortenerServiceProvider.php | UrlShortenerServiceProvider.register | public function register()
{
$this->app->singleton('urlshortener.factory', Drivers\Factory::class);
$this->app->singleton('urlshortener', function ($app) {
$shortener = new UrlShortener($app['urlshortener.factory']);
$shortener->setDriver($app['config']->get('urlshortener.driver'));
return $shortener;
});
} | php | public function register()
{
$this->app->singleton('urlshortener.factory', Drivers\Factory::class);
$this->app->singleton('urlshortener', function ($app) {
$shortener = new UrlShortener($app['urlshortener.factory']);
$shortener->setDriver($app['config']->get('urlshortener.driver'));
return $shortener;
});
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'urlshortener.factory'",
",",
"Drivers",
"\\",
"Factory",
"::",
"class",
")",
";",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'urlshortener'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"shortener",
"=",
"new",
"UrlShortener",
"(",
"$",
"app",
"[",
"'urlshortener.factory'",
"]",
")",
";",
"$",
"shortener",
"->",
"setDriver",
"(",
"$",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'urlshortener.driver'",
")",
")",
";",
"return",
"$",
"shortener",
";",
"}",
")",
";",
"}"
] | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/Waavi/url-shortener/blob/15301d166765681929e1bdc25eb2c1e01d416f31/src/UrlShortenerServiceProvider.php#L36-L44 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.iCanSee | public function iCanSee( $id )
{
trigger_error(
"iCanSee is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$element = null;
$session = $this->getSession();
for ($i = 0; $i < 15; $i++) {
if ($element = $session->getPage()->findById($id)) {
break;
}
usleep(200 * 1000);// 1 million microseconds is 1 second
}
Assertion::assertTrue($element !== null, "Item '{$id}' did not appear on the page within 3 seconds");
} | php | public function iCanSee( $id )
{
trigger_error(
"iCanSee is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$element = null;
$session = $this->getSession();
for ($i = 0; $i < 15; $i++) {
if ($element = $session->getPage()->findById($id)) {
break;
}
usleep(200 * 1000);// 1 million microseconds is 1 second
}
Assertion::assertTrue($element !== null, "Item '{$id}' did not appear on the page within 3 seconds");
} | [
"public",
"function",
"iCanSee",
"(",
"$",
"id",
")",
"{",
"trigger_error",
"(",
"\"iCanSee is deprecated since v6.3.0 and will be removed in v7.0.0\"",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"element",
"=",
"null",
";",
"$",
"session",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"15",
";",
"$",
"i",
"++",
")",
"{",
"if",
"(",
"$",
"element",
"=",
"$",
"session",
"->",
"getPage",
"(",
")",
"->",
"findById",
"(",
"$",
"id",
")",
")",
"{",
"break",
";",
"}",
"usleep",
"(",
"200",
"*",
"1000",
")",
";",
"// 1 million microseconds is 1 second",
"}",
"Assertion",
"::",
"assertTrue",
"(",
"$",
"element",
"!==",
"null",
",",
"\"Item '{$id}' did not appear on the page within 3 seconds\"",
")",
";",
"}"
] | @Given I see :id (link/button/form)
@When I can see :id (link/button/form)
A "spin function" sentence to wait for a given element to appear.
Waits maximum 3 seconds, tries every 200ms
@link http://docs.behat.org/en/v2.5/cookbook/using_spin_functions.html
@deprecated deprecated since version 6.3.0 | [
"@Given",
"I",
"see",
":",
"id",
"(",
"link",
"/",
"button",
"/",
"form",
")",
"@When",
"I",
"can",
"see",
":",
"id",
"(",
"link",
"/",
"button",
"/",
"form",
")"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L47-L64 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.fillFieldWithValue | public function fillFieldWithValue( $field, $value = '' )
{
trigger_error(
"fillFieldWithValue is deprecated since v6.3.0, use PlatformUI Context fillFieldWithValue instead",
E_USER_DEPRECATED
);
$this->getSession()->getPage()->fillField( $field, $value );
} | php | public function fillFieldWithValue( $field, $value = '' )
{
trigger_error(
"fillFieldWithValue is deprecated since v6.3.0, use PlatformUI Context fillFieldWithValue instead",
E_USER_DEPRECATED
);
$this->getSession()->getPage()->fillField( $field, $value );
} | [
"public",
"function",
"fillFieldWithValue",
"(",
"$",
"field",
",",
"$",
"value",
"=",
"''",
")",
"{",
"trigger_error",
"(",
"\"fillFieldWithValue is deprecated since v6.3.0, use PlatformUI Context fillFieldWithValue instead\"",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"getPage",
"(",
")",
"->",
"fillField",
"(",
"$",
"field",
",",
"$",
"value",
")",
";",
"}"
] | @When I fill in :field with :value
@When I set :field as empty
Fill field identified by ':field' with ':value'
@deprecated deprecated since version 6.3.0 | [
"@When",
"I",
"fill",
"in",
":",
"field",
"with",
":",
"value",
"@When",
"I",
"set",
":",
"field",
"as",
"empty"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L132-L139 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.iShouldBeOnPage | public function iShouldBeOnPage( $pageIdentifier = 'home' )
{
$currentUrl = $this->getUrlWithoutQueryString( $this->getSession()->getCurrentUrl() );
$expectedUrl = $this->locatePath( $this->getPathByPageIdentifier( $pageIdentifier ) );
Assertion::assertEquals(
$expectedUrl,
$currentUrl,
"Unexpected URL of the current site. Expected: '$expectedUrl'. Actual: '$currentUrl'."
);
} | php | public function iShouldBeOnPage( $pageIdentifier = 'home' )
{
$currentUrl = $this->getUrlWithoutQueryString( $this->getSession()->getCurrentUrl() );
$expectedUrl = $this->locatePath( $this->getPathByPageIdentifier( $pageIdentifier ) );
Assertion::assertEquals(
$expectedUrl,
$currentUrl,
"Unexpected URL of the current site. Expected: '$expectedUrl'. Actual: '$currentUrl'."
);
} | [
"public",
"function",
"iShouldBeOnPage",
"(",
"$",
"pageIdentifier",
"=",
"'home'",
")",
"{",
"$",
"currentUrl",
"=",
"$",
"this",
"->",
"getUrlWithoutQueryString",
"(",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"getCurrentUrl",
"(",
")",
")",
";",
"$",
"expectedUrl",
"=",
"$",
"this",
"->",
"locatePath",
"(",
"$",
"this",
"->",
"getPathByPageIdentifier",
"(",
"$",
"pageIdentifier",
")",
")",
";",
"Assertion",
"::",
"assertEquals",
"(",
"$",
"expectedUrl",
",",
"$",
"currentUrl",
",",
"\"Unexpected URL of the current site. Expected: '$expectedUrl'. Actual: '$currentUrl'.\"",
")",
";",
"}"
] | @Then I should be at/on (the) homepage
@Then I should be at/on (the) :page page
Asserts that the current page is the one identified by ':page', or the homepage. | [
"@Then",
"I",
"should",
"be",
"at",
"/",
"on",
"(",
"the",
")",
"homepage",
"@Then",
"I",
"should",
"be",
"at",
"/",
"on",
"(",
"the",
")",
":",
"page",
"page"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L147-L158 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.onPageSectionIClickAtButton | public function onPageSectionIClickAtButton( $button, $pageSection = null )
{
trigger_error(
"onPageSectionIClickAtButton is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$base = $this->makeXpathForBlock( $pageSection );
$el = $this->getXpath()->findButtons( $button, $base );
EzAssertion::assertElementFound( $button, $el, $pageSection, 'button' );
$el[0]->click();
} | php | public function onPageSectionIClickAtButton( $button, $pageSection = null )
{
trigger_error(
"onPageSectionIClickAtButton is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$base = $this->makeXpathForBlock( $pageSection );
$el = $this->getXpath()->findButtons( $button, $base );
EzAssertion::assertElementFound( $button, $el, $pageSection, 'button' );
$el[0]->click();
} | [
"public",
"function",
"onPageSectionIClickAtButton",
"(",
"$",
"button",
",",
"$",
"pageSection",
"=",
"null",
")",
"{",
"trigger_error",
"(",
"\"onPageSectionIClickAtButton is deprecated since v6.3.0 and will be removed in v7.0.0\"",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"base",
"=",
"$",
"this",
"->",
"makeXpathForBlock",
"(",
"$",
"pageSection",
")",
";",
"$",
"el",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"findButtons",
"(",
"$",
"button",
",",
"$",
"base",
")",
";",
"EzAssertion",
"::",
"assertElementFound",
"(",
"$",
"button",
",",
"$",
"el",
",",
"$",
"pageSection",
",",
"'button'",
")",
";",
"$",
"el",
"[",
"0",
"]",
"->",
"click",
"(",
")",
";",
"}"
] | @Given on :pageSection I clicked at/on :button button
@When on :pageSection I click at/on :button button
Clicks the button identified by ':button', located in section ':section'
@deprecated deprecated since version 6.3.0 | [
"@Given",
"on",
":",
"pageSection",
"I",
"clicked",
"at",
"/",
"on",
":",
"button",
"button",
"@When",
"on",
":",
"pageSection",
"I",
"click",
"at",
"/",
"on",
":",
"button",
"button"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L185-L195 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.onPageSectionIClickAtLink | public function onPageSectionIClickAtLink( $link, $pageSection = null )
{
trigger_error(
"onPageSectionIClickAtLink is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$base = $this->makeXpathForBlock( $pageSection );
$el = $this->getXpath()->findLinks( $link, $base );
EzAssertion::assertElementFound( $link, $el, $pageSection, 'link' );
$el[0]->click();
} | php | public function onPageSectionIClickAtLink( $link, $pageSection = null )
{
trigger_error(
"onPageSectionIClickAtLink is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$base = $this->makeXpathForBlock( $pageSection );
$el = $this->getXpath()->findLinks( $link, $base );
EzAssertion::assertElementFound( $link, $el, $pageSection, 'link' );
$el[0]->click();
} | [
"public",
"function",
"onPageSectionIClickAtLink",
"(",
"$",
"link",
",",
"$",
"pageSection",
"=",
"null",
")",
"{",
"trigger_error",
"(",
"\"onPageSectionIClickAtLink is deprecated since v6.3.0 and will be removed in v7.0.0\"",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"base",
"=",
"$",
"this",
"->",
"makeXpathForBlock",
"(",
"$",
"pageSection",
")",
";",
"$",
"el",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"findLinks",
"(",
"$",
"link",
",",
"$",
"base",
")",
";",
"EzAssertion",
"::",
"assertElementFound",
"(",
"$",
"link",
",",
"$",
"el",
",",
"$",
"pageSection",
",",
"'link'",
")",
";",
"$",
"el",
"[",
"0",
"]",
"->",
"click",
"(",
")",
";",
"}"
] | @Given on :pageSection I clicked on/at link link
@When on :pageSection I click on/at :link link
Click a link with text ':link' on page section ':pageSection'
Asserts that at least one link element is found.
@deprecated deprecated since version 6.3.0 | [
"@Given",
"on",
":",
"pageSection",
"I",
"clicked",
"on",
"/",
"at",
"link",
"link",
"@When",
"on",
":",
"pageSection",
"I",
"click",
"on",
"/",
"at",
":",
"link",
"link"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L223-L233 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.checkOption | public function checkOption( $option )
{
trigger_error(
"checkOption is deprecated since v6.3.0, use PlatformUI Context checkOption instead",
E_USER_DEPRECATED
);
$fieldElements = $this->getXpath()->findFields( $option );
EzAssertion::assertElementFound( $option, $fieldElements, null, 'checkbox' );
// this is needed for the cases where are checkboxes and radio's
// side by side, for main option the radio and the extra being the
// checkboxes values
if ( strtolower( $fieldElements[0]->getAttribute( 'type' ) ) !== 'checkbox' )
{
$value = $fieldElements[0]->getAttribute( 'value' );
$fieldElements = $this->getXpath()->findXpath( "//input[@type='checkbox' and @value='$value']" );
EzAssertion::assertElementFound( $value, $fieldElements, null, 'checkbox' );
}
$fieldElements[0]->check();
} | php | public function checkOption( $option )
{
trigger_error(
"checkOption is deprecated since v6.3.0, use PlatformUI Context checkOption instead",
E_USER_DEPRECATED
);
$fieldElements = $this->getXpath()->findFields( $option );
EzAssertion::assertElementFound( $option, $fieldElements, null, 'checkbox' );
// this is needed for the cases where are checkboxes and radio's
// side by side, for main option the radio and the extra being the
// checkboxes values
if ( strtolower( $fieldElements[0]->getAttribute( 'type' ) ) !== 'checkbox' )
{
$value = $fieldElements[0]->getAttribute( 'value' );
$fieldElements = $this->getXpath()->findXpath( "//input[@type='checkbox' and @value='$value']" );
EzAssertion::assertElementFound( $value, $fieldElements, null, 'checkbox' );
}
$fieldElements[0]->check();
} | [
"public",
"function",
"checkOption",
"(",
"$",
"option",
")",
"{",
"trigger_error",
"(",
"\"checkOption is deprecated since v6.3.0, use PlatformUI Context checkOption instead\"",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"fieldElements",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"findFields",
"(",
"$",
"option",
")",
";",
"EzAssertion",
"::",
"assertElementFound",
"(",
"$",
"option",
",",
"$",
"fieldElements",
",",
"null",
",",
"'checkbox'",
")",
";",
"// this is needed for the cases where are checkboxes and radio's",
"// side by side, for main option the radio and the extra being the",
"// checkboxes values",
"if",
"(",
"strtolower",
"(",
"$",
"fieldElements",
"[",
"0",
"]",
"->",
"getAttribute",
"(",
"'type'",
")",
")",
"!==",
"'checkbox'",
")",
"{",
"$",
"value",
"=",
"$",
"fieldElements",
"[",
"0",
"]",
"->",
"getAttribute",
"(",
"'value'",
")",
";",
"$",
"fieldElements",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"findXpath",
"(",
"\"//input[@type='checkbox' and @value='$value']\"",
")",
";",
"EzAssertion",
"::",
"assertElementFound",
"(",
"$",
"value",
",",
"$",
"fieldElements",
",",
"null",
",",
"'checkbox'",
")",
";",
"}",
"$",
"fieldElements",
"[",
"0",
"]",
"->",
"check",
"(",
")",
";",
"}"
] | @Given I checked :label checkbox
@When I check :label checkbox
Toggles the value for the checkbox with name ':label'
@deprecated deprecated since version 6.3.0 | [
"@Given",
"I",
"checked",
":",
"label",
"checkbox",
"@When",
"I",
"check",
":",
"label",
"checkbox"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L243-L263 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.iSelect | public function iSelect( $option )
{
trigger_error(
"iSelect is deprecated since v6.3.0, use PlatformUI Context iSelect instead",
E_USER_DEPRECATED
);
$elements = $this->getXpath()->findXpath( "//select" );
Assertion::assertNotEmpty( $elements, "Unable to find a select field" );
$elements[0]->selectOption( $option );
} | php | public function iSelect( $option )
{
trigger_error(
"iSelect is deprecated since v6.3.0, use PlatformUI Context iSelect instead",
E_USER_DEPRECATED
);
$elements = $this->getXpath()->findXpath( "//select" );
Assertion::assertNotEmpty( $elements, "Unable to find a select field" );
$elements[0]->selectOption( $option );
} | [
"public",
"function",
"iSelect",
"(",
"$",
"option",
")",
"{",
"trigger_error",
"(",
"\"iSelect is deprecated since v6.3.0, use PlatformUI Context iSelect instead\"",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"elements",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"findXpath",
"(",
"\"//select\"",
")",
";",
"Assertion",
"::",
"assertNotEmpty",
"(",
"$",
"elements",
",",
"\"Unable to find a select field\"",
")",
";",
"$",
"elements",
"[",
"0",
"]",
"->",
"selectOption",
"(",
"$",
"option",
")",
";",
"}"
] | @When I select :option
Selects option with value ':value'
IMPORTANT: Will thrown an error if more than 1 select/dropdown is found on page
@deprecated deprecated since version 6.3.0 | [
"@When",
"I",
"select",
":",
"option"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L273-L282 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.iSelectRadioButton | public function iSelectRadioButton( $label )
{
trigger_error(
"iSelectRadioButton is deprecated since v6.3.0, use PlatformUI Context iSelectRadioButton instead",
E_USER_DEPRECATED
);
$el = $this->getSession()->getPage()->findField( $label );
Assertion::assertNotNull( $el, "Couldn't find a radio input with '$label'" );
$el->check();
} | php | public function iSelectRadioButton( $label )
{
trigger_error(
"iSelectRadioButton is deprecated since v6.3.0, use PlatformUI Context iSelectRadioButton instead",
E_USER_DEPRECATED
);
$el = $this->getSession()->getPage()->findField( $label );
Assertion::assertNotNull( $el, "Couldn't find a radio input with '$label'" );
$el->check();
} | [
"public",
"function",
"iSelectRadioButton",
"(",
"$",
"label",
")",
"{",
"trigger_error",
"(",
"\"iSelectRadioButton is deprecated since v6.3.0, use PlatformUI Context iSelectRadioButton instead\"",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"el",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"getPage",
"(",
")",
"->",
"findField",
"(",
"$",
"label",
")",
";",
"Assertion",
"::",
"assertNotNull",
"(",
"$",
"el",
",",
"\"Couldn't find a radio input with '$label'\"",
")",
";",
"$",
"el",
"->",
"check",
"(",
")",
";",
"}"
] | @Given I selected :label radio button
@When I select :label radio button
Selects the radio button with label ':label'
@deprecated deprecated since version 6.3.0 | [
"@Given",
"I",
"selected",
":",
"label",
"radio",
"button",
"@When",
"I",
"select",
":",
"label",
"radio",
"button"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L292-L301 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.iFillFormWith | public function iFillFormWith( TableNode $table )
{
trigger_error(
"onPageSectionIClickAtLink is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
foreach ( GherkinHelper::convertTableToArrayOfData( $table ) as $field => $value )
{
$elements = $this->getXpath()->findFields( $field );
Assertion::assertNotEmpty( $elements, "Unable to find '{$field}' field" );
$elements[0]->setValue( $value );
}
} | php | public function iFillFormWith( TableNode $table )
{
trigger_error(
"onPageSectionIClickAtLink is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
foreach ( GherkinHelper::convertTableToArrayOfData( $table ) as $field => $value )
{
$elements = $this->getXpath()->findFields( $field );
Assertion::assertNotEmpty( $elements, "Unable to find '{$field}' field" );
$elements[0]->setValue( $value );
}
} | [
"public",
"function",
"iFillFormWith",
"(",
"TableNode",
"$",
"table",
")",
"{",
"trigger_error",
"(",
"\"onPageSectionIClickAtLink is deprecated since v6.3.0 and will be removed in v7.0.0\"",
",",
"E_USER_DEPRECATED",
")",
";",
"foreach",
"(",
"GherkinHelper",
"::",
"convertTableToArrayOfData",
"(",
"$",
"table",
")",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"$",
"elements",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"findFields",
"(",
"$",
"field",
")",
";",
"Assertion",
"::",
"assertNotEmpty",
"(",
"$",
"elements",
",",
"\"Unable to find '{$field}' field\"",
")",
";",
"$",
"elements",
"[",
"0",
"]",
"->",
"setValue",
"(",
"$",
"value",
")",
";",
"}",
"}"
] | @Given I filled form with:
@When I fill form with:
Fills a form with the provided field/value pairs:
| field | value |
| Title | A title text |
| Content | Some content |
@deprecated deprecated since version 6.3.0 | [
"@Given",
"I",
"filled",
"form",
"with",
":",
"@When",
"I",
"fill",
"form",
"with",
":"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L314-L327 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.formHasValue | public function formHasValue( TableNode $table )
{
trigger_error(
"onPageSectionIClickAtLink is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
foreach ( GherkinHelper::convertTableToArrayOfData( $table ) as $field => $value )
{
$elements = $this->getXpath()->findFields( $field );
Assertion::assertNotEmpty( $elements, "Unable to find '{$field}' field" );
Assertion::assertEquals( $value, $elements[0]->getValue(), "Field values don't match" );
}
} | php | public function formHasValue( TableNode $table )
{
trigger_error(
"onPageSectionIClickAtLink is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
foreach ( GherkinHelper::convertTableToArrayOfData( $table ) as $field => $value )
{
$elements = $this->getXpath()->findFields( $field );
Assertion::assertNotEmpty( $elements, "Unable to find '{$field}' field" );
Assertion::assertEquals( $value, $elements[0]->getValue(), "Field values don't match" );
}
} | [
"public",
"function",
"formHasValue",
"(",
"TableNode",
"$",
"table",
")",
"{",
"trigger_error",
"(",
"\"onPageSectionIClickAtLink is deprecated since v6.3.0 and will be removed in v7.0.0\"",
",",
"E_USER_DEPRECATED",
")",
";",
"foreach",
"(",
"GherkinHelper",
"::",
"convertTableToArrayOfData",
"(",
"$",
"table",
")",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"$",
"elements",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"findFields",
"(",
"$",
"field",
")",
";",
"Assertion",
"::",
"assertNotEmpty",
"(",
"$",
"elements",
",",
"\"Unable to find '{$field}' field\"",
")",
";",
"Assertion",
"::",
"assertEquals",
"(",
"$",
"value",
",",
"$",
"elements",
"[",
"0",
"]",
"->",
"getValue",
"(",
")",
",",
"\"Field values don't match\"",
")",
";",
"}",
"}"
] | @Then I see field with value:
Checks a form for the provided field/value pairs:
| field | value |
| Title | A title text |
| Content | Some content |
@deprecated deprecated since version 6.3.0 | [
"@Then",
"I",
"see",
"field",
"with",
"value",
":"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L339-L352 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.onPageSectionISeeLinks | public function onPageSectionISeeLinks( TableNode $table, $pageSection = null )
{
trigger_error(
"iSeeLinks is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$rows = $table->getRows();
array_shift( $rows );
foreach ( $rows as $row )
{
$link = $row[0];
$el = $this->getXpath()->findLinks( $link, $this->makeXpathForBlock( $pageSection ) );
Assertion::assertNotEmpty( $el, "Unexpected link found" );
}
} | php | public function onPageSectionISeeLinks( TableNode $table, $pageSection = null )
{
trigger_error(
"iSeeLinks is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$rows = $table->getRows();
array_shift( $rows );
foreach ( $rows as $row )
{
$link = $row[0];
$el = $this->getXpath()->findLinks( $link, $this->makeXpathForBlock( $pageSection ) );
Assertion::assertNotEmpty( $el, "Unexpected link found" );
}
} | [
"public",
"function",
"onPageSectionISeeLinks",
"(",
"TableNode",
"$",
"table",
",",
"$",
"pageSection",
"=",
"null",
")",
"{",
"trigger_error",
"(",
"\"iSeeLinks is deprecated since v6.3.0 and will be removed in v7.0.0\"",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"rows",
"=",
"$",
"table",
"->",
"getRows",
"(",
")",
";",
"array_shift",
"(",
"$",
"rows",
")",
";",
"foreach",
"(",
"$",
"rows",
"as",
"$",
"row",
")",
"{",
"$",
"link",
"=",
"$",
"row",
"[",
"0",
"]",
";",
"$",
"el",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"findLinks",
"(",
"$",
"link",
",",
"$",
"this",
"->",
"makeXpathForBlock",
"(",
"$",
"pageSection",
")",
")",
";",
"Assertion",
"::",
"assertNotEmpty",
"(",
"$",
"el",
",",
"\"Unexpected link found\"",
")",
";",
"}",
"}"
] | @Then on :pageSection I (should) see (the) (following) links:
@deprecated deprecated since version 6.3.0 | [
"@Then",
"on",
":",
"pageSection",
"I",
"(",
"should",
")",
"see",
"(",
"the",
")",
"(",
"following",
")",
"links",
":"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L379-L396 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.iSeeLinksInFollowingOrder | public function iSeeLinksInFollowingOrder( TableNode $table )
{
trigger_error(
"iSeeLinksInFollowingOrder is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
// get all links
$available = $this->getXpath()->findXpath( "//a[@href]" );
$rows = $table->getRows();
array_shift( $rows );
// remove links from embeded arrays
$links = array();
foreach ( $rows as $row )
{
$links[] = $row[0];
}
// and finaly verify their existence
$this->checkLinksExistence( $links, $available );
} | php | public function iSeeLinksInFollowingOrder( TableNode $table )
{
trigger_error(
"iSeeLinksInFollowingOrder is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
// get all links
$available = $this->getXpath()->findXpath( "//a[@href]" );
$rows = $table->getRows();
array_shift( $rows );
// remove links from embeded arrays
$links = array();
foreach ( $rows as $row )
{
$links[] = $row[0];
}
// and finaly verify their existence
$this->checkLinksExistence( $links, $available );
} | [
"public",
"function",
"iSeeLinksInFollowingOrder",
"(",
"TableNode",
"$",
"table",
")",
"{",
"trigger_error",
"(",
"\"iSeeLinksInFollowingOrder is deprecated since v6.3.0 and will be removed in v7.0.0\"",
",",
"E_USER_DEPRECATED",
")",
";",
"// get all links",
"$",
"available",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"findXpath",
"(",
"\"//a[@href]\"",
")",
";",
"$",
"rows",
"=",
"$",
"table",
"->",
"getRows",
"(",
")",
";",
"array_shift",
"(",
"$",
"rows",
")",
";",
"// remove links from embeded arrays",
"$",
"links",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"rows",
"as",
"$",
"row",
")",
"{",
"$",
"links",
"[",
"]",
"=",
"$",
"row",
"[",
"0",
"]",
";",
"}",
"// and finaly verify their existence",
"$",
"this",
"->",
"checkLinksExistence",
"(",
"$",
"links",
",",
"$",
"available",
")",
";",
"}"
] | @Then I (should) see (the) links in the following order:
@Then I (should) see (the) links in this order:
Checks if links exist, and appear in the specified order
@deprecated deprecated since version 6.3.0 | [
"@Then",
"I",
"(",
"should",
")",
"see",
"(",
"the",
")",
"links",
"in",
"the",
"following",
"order",
":",
"@Then",
"I",
"(",
"should",
")",
"see",
"(",
"the",
")",
"links",
"in",
"this",
"order",
":"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L448-L470 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.iSeeFollowingLinksIn | public function iSeeFollowingLinksIn( TableNode $table )
{
trigger_error(
"iSeeFollowingLinksIn is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$session = $this->getSession();
$rows = $table->getRows();
array_shift( $rows );
foreach ( $rows as $row )
{
Assertion::assertEquals( 2, count( $row ), "The table should be have array with link and tag" );
// prepare XPath
list( $link, $type ) = $row;
$tags = $this->getTagsFor( $type );
$xpaths = explode( '|', $this->getXpath()->makeElementXpath( 'link', $link ) );
$xpath = implode(
'|',
array_map(
function( $tag ) use( $xpaths )
{
return "//$tag/" . implode( "| //$tag/", $xpaths );
},
$tags
)
);
// search and do assertions
$el = $this->getXpath()->findXpath( $xpath );
EzAssertion::assertSingleElement( $link, $el, $type, 'link' );
}
} | php | public function iSeeFollowingLinksIn( TableNode $table )
{
trigger_error(
"iSeeFollowingLinksIn is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$session = $this->getSession();
$rows = $table->getRows();
array_shift( $rows );
foreach ( $rows as $row )
{
Assertion::assertEquals( 2, count( $row ), "The table should be have array with link and tag" );
// prepare XPath
list( $link, $type ) = $row;
$tags = $this->getTagsFor( $type );
$xpaths = explode( '|', $this->getXpath()->makeElementXpath( 'link', $link ) );
$xpath = implode(
'|',
array_map(
function( $tag ) use( $xpaths )
{
return "//$tag/" . implode( "| //$tag/", $xpaths );
},
$tags
)
);
// search and do assertions
$el = $this->getXpath()->findXpath( $xpath );
EzAssertion::assertSingleElement( $link, $el, $type, 'link' );
}
} | [
"public",
"function",
"iSeeFollowingLinksIn",
"(",
"TableNode",
"$",
"table",
")",
"{",
"trigger_error",
"(",
"\"iSeeFollowingLinksIn is deprecated since v6.3.0 and will be removed in v7.0.0\"",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"session",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
";",
"$",
"rows",
"=",
"$",
"table",
"->",
"getRows",
"(",
")",
";",
"array_shift",
"(",
"$",
"rows",
")",
";",
"foreach",
"(",
"$",
"rows",
"as",
"$",
"row",
")",
"{",
"Assertion",
"::",
"assertEquals",
"(",
"2",
",",
"count",
"(",
"$",
"row",
")",
",",
"\"The table should be have array with link and tag\"",
")",
";",
"// prepare XPath",
"list",
"(",
"$",
"link",
",",
"$",
"type",
")",
"=",
"$",
"row",
";",
"$",
"tags",
"=",
"$",
"this",
"->",
"getTagsFor",
"(",
"$",
"type",
")",
";",
"$",
"xpaths",
"=",
"explode",
"(",
"'|'",
",",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"makeElementXpath",
"(",
"'link'",
",",
"$",
"link",
")",
")",
";",
"$",
"xpath",
"=",
"implode",
"(",
"'|'",
",",
"array_map",
"(",
"function",
"(",
"$",
"tag",
")",
"use",
"(",
"$",
"xpaths",
")",
"{",
"return",
"\"//$tag/\"",
".",
"implode",
"(",
"\"| //$tag/\"",
",",
"$",
"xpaths",
")",
";",
"}",
",",
"$",
"tags",
")",
")",
";",
"// search and do assertions",
"$",
"el",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"findXpath",
"(",
"$",
"xpath",
")",
";",
"EzAssertion",
"::",
"assertSingleElement",
"(",
"$",
"link",
",",
"$",
"el",
",",
"$",
"type",
",",
"'link'",
")",
";",
"}",
"}"
] | @Then I (should) see (the) (following) links in:
Example: this is used to see in tag cloud which tags have more results
| link | tag |
| link1 | title |
| link2 | list |
| link3 | text |
@deprecated deprecated since version 6.3.0 | [
"@Then",
"I",
"(",
"should",
")",
"see",
"(",
"the",
")",
"(",
"following",
")",
"links",
"in",
":"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L483-L516 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.iSeeTitle | public function iSeeTitle( $title )
{
trigger_error(
"iSeeTitle is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$literal = $this->getXpath()->literal( $title );
$tags = $this->getTagsFor( "title" );
$innerXpath = "[text() = {$literal} or .//*[text() = {$literal}]]";
$xpathOptions = array_map(
function( $tag ) use( $innerXpath )
{
return "//$tag$innerXpath";
},
$tags
);
$xpath = implode( '|', $xpathOptions );
$el = $this->getXpath()->findXpath( $xpath );
// assert that message was found
EzAssertion::assertSingleElement( $title, $el, null, 'title' );
} | php | public function iSeeTitle( $title )
{
trigger_error(
"iSeeTitle is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$literal = $this->getXpath()->literal( $title );
$tags = $this->getTagsFor( "title" );
$innerXpath = "[text() = {$literal} or .//*[text() = {$literal}]]";
$xpathOptions = array_map(
function( $tag ) use( $innerXpath )
{
return "//$tag$innerXpath";
},
$tags
);
$xpath = implode( '|', $xpathOptions );
$el = $this->getXpath()->findXpath( $xpath );
// assert that message was found
EzAssertion::assertSingleElement( $title, $el, null, 'title' );
} | [
"public",
"function",
"iSeeTitle",
"(",
"$",
"title",
")",
"{",
"trigger_error",
"(",
"\"iSeeTitle is deprecated since v6.3.0 and will be removed in v7.0.0\"",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"literal",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"literal",
"(",
"$",
"title",
")",
";",
"$",
"tags",
"=",
"$",
"this",
"->",
"getTagsFor",
"(",
"\"title\"",
")",
";",
"$",
"innerXpath",
"=",
"\"[text() = {$literal} or .//*[text() = {$literal}]]\"",
";",
"$",
"xpathOptions",
"=",
"array_map",
"(",
"function",
"(",
"$",
"tag",
")",
"use",
"(",
"$",
"innerXpath",
")",
"{",
"return",
"\"//$tag$innerXpath\"",
";",
"}",
",",
"$",
"tags",
")",
";",
"$",
"xpath",
"=",
"implode",
"(",
"'|'",
",",
"$",
"xpathOptions",
")",
";",
"$",
"el",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"findXpath",
"(",
"$",
"xpath",
")",
";",
"// assert that message was found",
"EzAssertion",
"::",
"assertSingleElement",
"(",
"$",
"title",
",",
"$",
"el",
",",
"null",
",",
"'title'",
")",
";",
"}"
] | @Then I (should) see :title title/topic
Asserts that a (single) title element exists with the text ':title'
@deprecated deprecated since version 6.3.0 | [
"@Then",
"I",
"(",
"should",
")",
"see",
":",
"title",
"title",
"/",
"topic"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L525-L548 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.iSeeTableWith | public function iSeeTableWith( TableNode $table )
{
trigger_error(
"iSeeTableWith is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$rows = $table->getRows();
$headers = array_shift( $rows );
$max = count( $headers );
$mainHeader = array_shift( $headers );
foreach ( $rows as $row )
{
$mainColumn = array_shift( $row );
$foundRows = $this->getTableRow( $mainColumn, $mainHeader );
$found = false;
$maxFound = count( $foundRows );
for ( $i = 0; $i < $maxFound && !$found; $i++ )
{
if ( $this->existTableRow( $foundRows[$i], $row, $headers ) )
{
$found = true;
}
}
$message = "Couldn't find row with elements: '" . implode( ",", array_merge( array( $mainColumn ), $row ) ) . "'";
Assertion::assertTrue( $found, $message );
}
} | php | public function iSeeTableWith( TableNode $table )
{
trigger_error(
"iSeeTableWith is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$rows = $table->getRows();
$headers = array_shift( $rows );
$max = count( $headers );
$mainHeader = array_shift( $headers );
foreach ( $rows as $row )
{
$mainColumn = array_shift( $row );
$foundRows = $this->getTableRow( $mainColumn, $mainHeader );
$found = false;
$maxFound = count( $foundRows );
for ( $i = 0; $i < $maxFound && !$found; $i++ )
{
if ( $this->existTableRow( $foundRows[$i], $row, $headers ) )
{
$found = true;
}
}
$message = "Couldn't find row with elements: '" . implode( ",", array_merge( array( $mainColumn ), $row ) ) . "'";
Assertion::assertTrue( $found, $message );
}
} | [
"public",
"function",
"iSeeTableWith",
"(",
"TableNode",
"$",
"table",
")",
"{",
"trigger_error",
"(",
"\"iSeeTableWith is deprecated since v6.3.0 and will be removed in v7.0.0\"",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"rows",
"=",
"$",
"table",
"->",
"getRows",
"(",
")",
";",
"$",
"headers",
"=",
"array_shift",
"(",
"$",
"rows",
")",
";",
"$",
"max",
"=",
"count",
"(",
"$",
"headers",
")",
";",
"$",
"mainHeader",
"=",
"array_shift",
"(",
"$",
"headers",
")",
";",
"foreach",
"(",
"$",
"rows",
"as",
"$",
"row",
")",
"{",
"$",
"mainColumn",
"=",
"array_shift",
"(",
"$",
"row",
")",
";",
"$",
"foundRows",
"=",
"$",
"this",
"->",
"getTableRow",
"(",
"$",
"mainColumn",
",",
"$",
"mainHeader",
")",
";",
"$",
"found",
"=",
"false",
";",
"$",
"maxFound",
"=",
"count",
"(",
"$",
"foundRows",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"maxFound",
"&&",
"!",
"$",
"found",
";",
"$",
"i",
"++",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"existTableRow",
"(",
"$",
"foundRows",
"[",
"$",
"i",
"]",
",",
"$",
"row",
",",
"$",
"headers",
")",
")",
"{",
"$",
"found",
"=",
"true",
";",
"}",
"}",
"$",
"message",
"=",
"\"Couldn't find row with elements: '\"",
".",
"implode",
"(",
"\",\"",
",",
"array_merge",
"(",
"array",
"(",
"$",
"mainColumn",
")",
",",
"$",
"row",
")",
")",
".",
"\"'\"",
";",
"Assertion",
"::",
"assertTrue",
"(",
"$",
"found",
",",
"$",
"message",
")",
";",
"}",
"}"
] | @Then I (should) see table with:
Asserts that a table exists with specified values.
The table header needs to have the number of the column to which the values belong,
all the other text is optional, normaly using 'Column' for easier understanding:
| Column 1 | Column 2 | Column 4 |
| Value A | Value B | Value D |
...
| Value I | Value J | Value L |
@deprecated deprecated since version 6.3.0 | [
"@Then",
"I",
"(",
"should",
")",
"see",
"table",
"with",
":"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L564-L593 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.onPageSectionISeeTextEmphasized | public function onPageSectionISeeTextEmphasized( $text, $pageSection = null )
{
trigger_error(
"onPageSectionISeeTextEmphasized is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
// first find the text
$base = $this->makeXpathForBlock( $pageSection );
$el = $this->getXpath()->findXpath( "$base//*[contains( text(), {$this->getXpath()->literal( $text )} )]" );
EzAssertion::assertSingleElement( $text, $el, $pageSection, 'emphasized text' );
// finally verify if it has custom characteristics
Assertion::assertTrue(
$this->isElementEmphasized( $el[0] ),
"The text '$text' isn't emphasized"
);
} | php | public function onPageSectionISeeTextEmphasized( $text, $pageSection = null )
{
trigger_error(
"onPageSectionISeeTextEmphasized is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
// first find the text
$base = $this->makeXpathForBlock( $pageSection );
$el = $this->getXpath()->findXpath( "$base//*[contains( text(), {$this->getXpath()->literal( $text )} )]" );
EzAssertion::assertSingleElement( $text, $el, $pageSection, 'emphasized text' );
// finally verify if it has custom characteristics
Assertion::assertTrue(
$this->isElementEmphasized( $el[0] ),
"The text '$text' isn't emphasized"
);
} | [
"public",
"function",
"onPageSectionISeeTextEmphasized",
"(",
"$",
"text",
",",
"$",
"pageSection",
"=",
"null",
")",
"{",
"trigger_error",
"(",
"\"onPageSectionISeeTextEmphasized is deprecated since v6.3.0 and will be removed in v7.0.0\"",
",",
"E_USER_DEPRECATED",
")",
";",
"// first find the text",
"$",
"base",
"=",
"$",
"this",
"->",
"makeXpathForBlock",
"(",
"$",
"pageSection",
")",
";",
"$",
"el",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"findXpath",
"(",
"\"$base//*[contains( text(), {$this->getXpath()->literal( $text )} )]\"",
")",
";",
"EzAssertion",
"::",
"assertSingleElement",
"(",
"$",
"text",
",",
"$",
"el",
",",
"$",
"pageSection",
",",
"'emphasized text'",
")",
";",
"// finally verify if it has custom characteristics",
"Assertion",
"::",
"assertTrue",
"(",
"$",
"this",
"->",
"isElementEmphasized",
"(",
"$",
"el",
"[",
"0",
"]",
")",
",",
"\"The text '$text' isn't emphasized\"",
")",
";",
"}"
] | @Then on :pageSection I (should) see the :text text emphasized
@deprecated deprecated since version 6.3.0 | [
"@Then",
"on",
":",
"pageSection",
"I",
"(",
"should",
")",
"see",
"the",
":",
"text",
"text",
"emphasized"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L616-L633 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.iSeeWarning | public function iSeeWarning( $message )
{
trigger_error(
"iSeeWarning is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$el = $this->getXpath()->findXpath(
"//*[contains( @class, 'warning' ) or contains( @class, 'error' )]"
. "//*[text() = {$this->getXpath()->literal( $message )}]"
);
Assertion::assertNotNull( $el, "Couldn't find error/warning message '{$message}'" );
} | php | public function iSeeWarning( $message )
{
trigger_error(
"iSeeWarning is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$el = $this->getXpath()->findXpath(
"//*[contains( @class, 'warning' ) or contains( @class, 'error' )]"
. "//*[text() = {$this->getXpath()->literal( $message )}]"
);
Assertion::assertNotNull( $el, "Couldn't find error/warning message '{$message}'" );
} | [
"public",
"function",
"iSeeWarning",
"(",
"$",
"message",
")",
"{",
"trigger_error",
"(",
"\"iSeeWarning is deprecated since v6.3.0 and will be removed in v7.0.0\"",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"el",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"findXpath",
"(",
"\"//*[contains( @class, 'warning' ) or contains( @class, 'error' )]\"",
".",
"\"//*[text() = {$this->getXpath()->literal( $message )}]\"",
")",
";",
"Assertion",
"::",
"assertNotNull",
"(",
"$",
"el",
",",
"\"Couldn't find error/warning message '{$message}'\"",
")",
";",
"}"
] | @Then I (should) see :message warning/error
Checks that an element with the class 'warning' or 'error' exists with text ':message'
@deprecated deprecated since version 6.3.0 | [
"@Then",
"I",
"(",
"should",
")",
"see",
":",
"message",
"warning",
"/",
"error"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L642-L654 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.onPageSectionISeeText | public function onPageSectionISeeText( $text, $pageSection = null )
{
trigger_error(
"onPageSectionISeeText is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$base = $this->makeXpathForBlock( $pageSection );
$literal = $this->getXpath()->literal( $text );
$el = $this->getXpath()->findXpath( "$base//*[contains( text(), $literal )]" );
Assertion::assertNotNull( $el, "Couldn't find '$text' text" );
Assertion::assertEquals( trim( $el->getText() ), $text, "Couldn't find '$text' text" );
} | php | public function onPageSectionISeeText( $text, $pageSection = null )
{
trigger_error(
"onPageSectionISeeText is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$base = $this->makeXpathForBlock( $pageSection );
$literal = $this->getXpath()->literal( $text );
$el = $this->getXpath()->findXpath( "$base//*[contains( text(), $literal )]" );
Assertion::assertNotNull( $el, "Couldn't find '$text' text" );
Assertion::assertEquals( trim( $el->getText() ), $text, "Couldn't find '$text' text" );
} | [
"public",
"function",
"onPageSectionISeeText",
"(",
"$",
"text",
",",
"$",
"pageSection",
"=",
"null",
")",
"{",
"trigger_error",
"(",
"\"onPageSectionISeeText is deprecated since v6.3.0 and will be removed in v7.0.0\"",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"base",
"=",
"$",
"this",
"->",
"makeXpathForBlock",
"(",
"$",
"pageSection",
")",
";",
"$",
"literal",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"literal",
"(",
"$",
"text",
")",
";",
"$",
"el",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"findXpath",
"(",
"\"$base//*[contains( text(), $literal )]\"",
")",
";",
"Assertion",
"::",
"assertNotNull",
"(",
"$",
"el",
",",
"\"Couldn't find '$text' text\"",
")",
";",
"Assertion",
"::",
"assertEquals",
"(",
"trim",
"(",
"$",
"el",
"->",
"getText",
"(",
")",
")",
",",
"$",
"text",
",",
"\"Couldn't find '$text' text\"",
")",
";",
"}"
] | @Then on :pageSection I (should) see the exact :text message/text
@deprecated deprecated since version 6.3.0 | [
"@Then",
"on",
":",
"pageSection",
"I",
"(",
"should",
")",
"see",
"the",
"exact",
":",
"text",
"message",
"/",
"text"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L677-L691 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.iSeeMessage | public function iSeeMessage( $text )
{
trigger_error(
"iSeeMessage is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$this->checkForExceptions();
$this->assertSession()->pageTextContains( $text );
} | php | public function iSeeMessage( $text )
{
trigger_error(
"iSeeMessage is deprecated since v6.3.0 and will be removed in v7.0.0",
E_USER_DEPRECATED
);
$this->checkForExceptions();
$this->assertSession()->pageTextContains( $text );
} | [
"public",
"function",
"iSeeMessage",
"(",
"$",
"text",
")",
"{",
"trigger_error",
"(",
"\"iSeeMessage is deprecated since v6.3.0 and will be removed in v7.0.0\"",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"this",
"->",
"checkForExceptions",
"(",
")",
";",
"$",
"this",
"->",
"assertSession",
"(",
")",
"->",
"pageTextContains",
"(",
"$",
"text",
")",
";",
"}"
] | @Then I (should) see :message message/text
Checks that current page contains text.
@deprecated deprecated since version 6.3.0 | [
"@Then",
"I",
"(",
"should",
")",
"see",
":",
"message",
"message",
"/",
"text"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L700-L708 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.isCheckedOption | public function isCheckedOption( $label )
{
trigger_error(
"isCheckedOption is deprecated since v6.3.0, use PlatformUI Context isCheckedOption instead",
E_USER_DEPRECATED
);
$isChecked = $this->getCheckboxChecked( $label );
Assertion::assertTrue( $isChecked, "Checkbox $label is not checked" );
} | php | public function isCheckedOption( $label )
{
trigger_error(
"isCheckedOption is deprecated since v6.3.0, use PlatformUI Context isCheckedOption instead",
E_USER_DEPRECATED
);
$isChecked = $this->getCheckboxChecked( $label );
Assertion::assertTrue( $isChecked, "Checkbox $label is not checked" );
} | [
"public",
"function",
"isCheckedOption",
"(",
"$",
"label",
")",
"{",
"trigger_error",
"(",
"\"isCheckedOption is deprecated since v6.3.0, use PlatformUI Context isCheckedOption instead\"",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"isChecked",
"=",
"$",
"this",
"->",
"getCheckboxChecked",
"(",
"$",
"label",
")",
";",
"Assertion",
"::",
"assertTrue",
"(",
"$",
"isChecked",
",",
"\"Checkbox $label is not checked\"",
")",
";",
"}"
] | @Then the checkbox :label should be checked
@deprecated deprecated since version 6.3.0 | [
"@Then",
"the",
"checkbox",
":",
"label",
"should",
"be",
"checked"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L732-L740 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.isNotCheckedOption | public function isNotCheckedOption( $label )
{
trigger_error(
"isNotCheckedOption is deprecated since v6.3.0, use PlatformUI Context isNotCheckedOption instead",
E_USER_DEPRECATED
);
$isChecked = $this->getCheckboxChecked( $label );
Assertion::assertFalse( $isChecked, "Checkbox $label is checked" );
} | php | public function isNotCheckedOption( $label )
{
trigger_error(
"isNotCheckedOption is deprecated since v6.3.0, use PlatformUI Context isNotCheckedOption instead",
E_USER_DEPRECATED
);
$isChecked = $this->getCheckboxChecked( $label );
Assertion::assertFalse( $isChecked, "Checkbox $label is checked" );
} | [
"public",
"function",
"isNotCheckedOption",
"(",
"$",
"label",
")",
"{",
"trigger_error",
"(",
"\"isNotCheckedOption is deprecated since v6.3.0, use PlatformUI Context isNotCheckedOption instead\"",
",",
"E_USER_DEPRECATED",
")",
";",
"$",
"isChecked",
"=",
"$",
"this",
"->",
"getCheckboxChecked",
"(",
"$",
"label",
")",
";",
"Assertion",
"::",
"assertFalse",
"(",
"$",
"isChecked",
",",
"\"Checkbox $label is checked\"",
")",
";",
"}"
] | @Then the checkbox :label should not be checked
@deprecated deprecated since version 6.3.0 | [
"@Then",
"the",
"checkbox",
":",
"label",
"should",
"not",
"be",
"checked"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L747-L755 |
ezsystems/BehatBundle | Context/Browser/SubContext/CommonActions.php | CommonActions.getCheckboxChecked | private function getCheckboxChecked( $option )
{
$fieldElements = $this->getXpath()->findFields( $option );
EzAssertion::assertElementFound( $option, $fieldElements, null, 'checkbox' );
// this is needed for the cases where are checkboxes and radio's
// side by side, for main option the radio and the extra being the
// checkboxes values
if ( strtolower( $fieldElements[0]->getAttribute( 'type' ) ) !== 'checkbox' )
{
$value = $fieldElements[0]->getAttribute( 'value' );
$fieldElements = $this->getXpath()->findXpath( "//input[@type='checkbox' and @value='$value']" );
EzAssertion::assertElementFound( $value, $fieldElements, null, 'checkbox' );
}
return $isChecked = ( $fieldElements[0]->getAttribute( 'checked' ) ) === 'true';
} | php | private function getCheckboxChecked( $option )
{
$fieldElements = $this->getXpath()->findFields( $option );
EzAssertion::assertElementFound( $option, $fieldElements, null, 'checkbox' );
// this is needed for the cases where are checkboxes and radio's
// side by side, for main option the radio and the extra being the
// checkboxes values
if ( strtolower( $fieldElements[0]->getAttribute( 'type' ) ) !== 'checkbox' )
{
$value = $fieldElements[0]->getAttribute( 'value' );
$fieldElements = $this->getXpath()->findXpath( "//input[@type='checkbox' and @value='$value']" );
EzAssertion::assertElementFound( $value, $fieldElements, null, 'checkbox' );
}
return $isChecked = ( $fieldElements[0]->getAttribute( 'checked' ) ) === 'true';
} | [
"private",
"function",
"getCheckboxChecked",
"(",
"$",
"option",
")",
"{",
"$",
"fieldElements",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"findFields",
"(",
"$",
"option",
")",
";",
"EzAssertion",
"::",
"assertElementFound",
"(",
"$",
"option",
",",
"$",
"fieldElements",
",",
"null",
",",
"'checkbox'",
")",
";",
"// this is needed for the cases where are checkboxes and radio's",
"// side by side, for main option the radio and the extra being the",
"// checkboxes values",
"if",
"(",
"strtolower",
"(",
"$",
"fieldElements",
"[",
"0",
"]",
"->",
"getAttribute",
"(",
"'type'",
")",
")",
"!==",
"'checkbox'",
")",
"{",
"$",
"value",
"=",
"$",
"fieldElements",
"[",
"0",
"]",
"->",
"getAttribute",
"(",
"'value'",
")",
";",
"$",
"fieldElements",
"=",
"$",
"this",
"->",
"getXpath",
"(",
")",
"->",
"findXpath",
"(",
"\"//input[@type='checkbox' and @value='$value']\"",
")",
";",
"EzAssertion",
"::",
"assertElementFound",
"(",
"$",
"value",
",",
"$",
"fieldElements",
",",
"null",
",",
"'checkbox'",
")",
";",
"}",
"return",
"$",
"isChecked",
"=",
"(",
"$",
"fieldElements",
"[",
"0",
"]",
"->",
"getAttribute",
"(",
"'checked'",
")",
")",
"===",
"'true'",
";",
"}"
] | Helper for checkbox | [
"Helper",
"for",
"checkbox"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Browser/SubContext/CommonActions.php#L760-L776 |
ezsystems/BehatBundle | ObjectManager/BasicContent.php | BasicContent.createContent | public function createContent( $contentType, $fields, $parentLocationId )
{
$repository = $this->getRepository();
$languageCode = self::DEFAULT_LANGUAGE;
$content = $this->getRepository()->sudo(
function(Repository $repository) use ( $parentLocationId, $contentType, $fields, $languageCode )
{
$content = $this->createContentDraft($parentLocationId, $contentType, $fields, $languageCode);
return $content = $repository->getContentService()->publishVersion($content->versionInfo);
}
);
return $content->contentInfo->mainLocationId;
} | php | public function createContent( $contentType, $fields, $parentLocationId )
{
$repository = $this->getRepository();
$languageCode = self::DEFAULT_LANGUAGE;
$content = $this->getRepository()->sudo(
function(Repository $repository) use ( $parentLocationId, $contentType, $fields, $languageCode )
{
$content = $this->createContentDraft($parentLocationId, $contentType, $fields, $languageCode);
return $content = $repository->getContentService()->publishVersion($content->versionInfo);
}
);
return $content->contentInfo->mainLocationId;
} | [
"public",
"function",
"createContent",
"(",
"$",
"contentType",
",",
"$",
"fields",
",",
"$",
"parentLocationId",
")",
"{",
"$",
"repository",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
";",
"$",
"languageCode",
"=",
"self",
"::",
"DEFAULT_LANGUAGE",
";",
"$",
"content",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
"->",
"sudo",
"(",
"function",
"(",
"Repository",
"$",
"repository",
")",
"use",
"(",
"$",
"parentLocationId",
",",
"$",
"contentType",
",",
"$",
"fields",
",",
"$",
"languageCode",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"createContentDraft",
"(",
"$",
"parentLocationId",
",",
"$",
"contentType",
",",
"$",
"fields",
",",
"$",
"languageCode",
")",
";",
"return",
"$",
"content",
"=",
"$",
"repository",
"->",
"getContentService",
"(",
")",
"->",
"publishVersion",
"(",
"$",
"content",
"->",
"versionInfo",
")",
";",
"}",
")",
";",
"return",
"$",
"content",
"->",
"contentInfo",
"->",
"mainLocationId",
";",
"}"
] | Creates and publishes a Content.
@param string $contentType
@param array $fields
@param mixxed $parentLocationId
@return mixed The content's main location id | [
"Creates",
"and",
"publishes",
"a",
"Content",
"."
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/ObjectManager/BasicContent.php#L40-L54 |
ezsystems/BehatBundle | ObjectManager/BasicContent.php | BasicContent.publishDraft | public function publishDraft( Content $content )
{
$this->getRepository()->sudo(
function(Repository $repository) use ( $content )
{
$repository->getContentService()->publishVersion($content->versionInfo->id);
}
);
} | php | public function publishDraft( Content $content )
{
$this->getRepository()->sudo(
function(Repository $repository) use ( $content )
{
$repository->getContentService()->publishVersion($content->versionInfo->id);
}
);
} | [
"public",
"function",
"publishDraft",
"(",
"Content",
"$",
"content",
")",
"{",
"$",
"this",
"->",
"getRepository",
"(",
")",
"->",
"sudo",
"(",
"function",
"(",
"Repository",
"$",
"repository",
")",
"use",
"(",
"$",
"content",
")",
"{",
"$",
"repository",
"->",
"getContentService",
"(",
")",
"->",
"publishVersion",
"(",
"$",
"content",
"->",
"versionInfo",
"->",
"id",
")",
";",
"}",
")",
";",
"}"
] | Publishes a content draft.
@param Content $content | [
"Publishes",
"a",
"content",
"draft",
"."
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/ObjectManager/BasicContent.php#L61-L69 |
ezsystems/BehatBundle | ObjectManager/BasicContent.php | BasicContent.createContentDraft | function createContentDraft($parentLocationId, $contentTypeIdentifier, $fields, $languageCode = null )
{
$languageCode = $languageCode ?: self::DEFAULT_LANGUAGE;
$repository = $this->getRepository();
$content = $repository->sudo(
function() use( $repository, $languageCode, $contentTypeIdentifier, $fields, $parentLocationId )
{
$contentService = $repository->getcontentService();
$contentTypeService = $repository->getContentTypeService();
$locationCreateStruct = $repository->getLocationService()->newLocationCreateStruct( $parentLocationId );
$contentTypeIdentifier = $contentTypeService->loadContentTypeByIdentifier( $contentTypeIdentifier );
$contentCreateStruct = $contentService->newContentCreateStruct( $contentTypeIdentifier, $languageCode );
foreach ( array_keys( $fields ) as $key ) {
$contentCreateStruct->setField( $key, $fields[$key] );
}
return $contentService->createContent( $contentCreateStruct, array( $locationCreateStruct ) );
}
);
$this->addObjectToList( $content );
return $content;
} | php | function createContentDraft($parentLocationId, $contentTypeIdentifier, $fields, $languageCode = null )
{
$languageCode = $languageCode ?: self::DEFAULT_LANGUAGE;
$repository = $this->getRepository();
$content = $repository->sudo(
function() use( $repository, $languageCode, $contentTypeIdentifier, $fields, $parentLocationId )
{
$contentService = $repository->getcontentService();
$contentTypeService = $repository->getContentTypeService();
$locationCreateStruct = $repository->getLocationService()->newLocationCreateStruct( $parentLocationId );
$contentTypeIdentifier = $contentTypeService->loadContentTypeByIdentifier( $contentTypeIdentifier );
$contentCreateStruct = $contentService->newContentCreateStruct( $contentTypeIdentifier, $languageCode );
foreach ( array_keys( $fields ) as $key ) {
$contentCreateStruct->setField( $key, $fields[$key] );
}
return $contentService->createContent( $contentCreateStruct, array( $locationCreateStruct ) );
}
);
$this->addObjectToList( $content );
return $content;
} | [
"function",
"createContentDraft",
"(",
"$",
"parentLocationId",
",",
"$",
"contentTypeIdentifier",
",",
"$",
"fields",
",",
"$",
"languageCode",
"=",
"null",
")",
"{",
"$",
"languageCode",
"=",
"$",
"languageCode",
"?",
":",
"self",
"::",
"DEFAULT_LANGUAGE",
";",
"$",
"repository",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
";",
"$",
"content",
"=",
"$",
"repository",
"->",
"sudo",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"repository",
",",
"$",
"languageCode",
",",
"$",
"contentTypeIdentifier",
",",
"$",
"fields",
",",
"$",
"parentLocationId",
")",
"{",
"$",
"contentService",
"=",
"$",
"repository",
"->",
"getcontentService",
"(",
")",
";",
"$",
"contentTypeService",
"=",
"$",
"repository",
"->",
"getContentTypeService",
"(",
")",
";",
"$",
"locationCreateStruct",
"=",
"$",
"repository",
"->",
"getLocationService",
"(",
")",
"->",
"newLocationCreateStruct",
"(",
"$",
"parentLocationId",
")",
";",
"$",
"contentTypeIdentifier",
"=",
"$",
"contentTypeService",
"->",
"loadContentTypeByIdentifier",
"(",
"$",
"contentTypeIdentifier",
")",
";",
"$",
"contentCreateStruct",
"=",
"$",
"contentService",
"->",
"newContentCreateStruct",
"(",
"$",
"contentTypeIdentifier",
",",
"$",
"languageCode",
")",
";",
"foreach",
"(",
"array_keys",
"(",
"$",
"fields",
")",
"as",
"$",
"key",
")",
"{",
"$",
"contentCreateStruct",
"->",
"setField",
"(",
"$",
"key",
",",
"$",
"fields",
"[",
"$",
"key",
"]",
")",
";",
"}",
"return",
"$",
"contentService",
"->",
"createContent",
"(",
"$",
"contentCreateStruct",
",",
"array",
"(",
"$",
"locationCreateStruct",
")",
")",
";",
"}",
")",
";",
"$",
"this",
"->",
"addObjectToList",
"(",
"$",
"content",
")",
";",
"return",
"$",
"content",
";",
"}"
] | Creates a content draft using sudo().
@param Location $parentLocationId
@param string $contentTypeIdentifier
@param string $languageCode
@param array $fields Fields, as primitives understood by setField
@return Content an unpublished Content draft | [
"Creates",
"a",
"content",
"draft",
"using",
"sudo",
"()",
"."
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/ObjectManager/BasicContent.php#L81-L105 |
ezsystems/BehatBundle | ObjectManager/BasicContent.php | BasicContent.destroy | protected function destroy( ValueObject $object )
{
/** @var \eZ\Publish\API\Repository\Repository $repository */
$repository = $this->getRepository();
$contentId = $object->id;
$repository->sudo(
function() use( $repository, $contentId )
{
try
{
$contentService = $repository->getContentService();
$contentInfo = $contentService->loadContentInfo( $contentId );
$contentService->deleteContent( $contentInfo );
}
catch ( ApiExceptions\NotFoundException $e )
{
// Nothing to do
}
}
);
} | php | protected function destroy( ValueObject $object )
{
/** @var \eZ\Publish\API\Repository\Repository $repository */
$repository = $this->getRepository();
$contentId = $object->id;
$repository->sudo(
function() use( $repository, $contentId )
{
try
{
$contentService = $repository->getContentService();
$contentInfo = $contentService->loadContentInfo( $contentId );
$contentService->deleteContent( $contentInfo );
}
catch ( ApiExceptions\NotFoundException $e )
{
// Nothing to do
}
}
);
} | [
"protected",
"function",
"destroy",
"(",
"ValueObject",
"$",
"object",
")",
"{",
"/** @var \\eZ\\Publish\\API\\Repository\\Repository $repository */",
"$",
"repository",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
";",
"$",
"contentId",
"=",
"$",
"object",
"->",
"id",
";",
"$",
"repository",
"->",
"sudo",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"repository",
",",
"$",
"contentId",
")",
"{",
"try",
"{",
"$",
"contentService",
"=",
"$",
"repository",
"->",
"getContentService",
"(",
")",
";",
"$",
"contentInfo",
"=",
"$",
"contentService",
"->",
"loadContentInfo",
"(",
"$",
"contentId",
")",
";",
"$",
"contentService",
"->",
"deleteContent",
"(",
"$",
"contentInfo",
")",
";",
"}",
"catch",
"(",
"ApiExceptions",
"\\",
"NotFoundException",
"$",
"e",
")",
"{",
"// Nothing to do",
"}",
"}",
")",
";",
"}"
] | Deletes the content object provided
used to clean after testing | [
"Deletes",
"the",
"content",
"object",
"provided",
"used",
"to",
"clean",
"after",
"testing"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/ObjectManager/BasicContent.php#L162-L182 |
ezsystems/BehatBundle | Helper/ValueObject.php | ValueObject.getProperty | static function getProperty( ValueObjectInterface $object, $property )
{
if ( property_exists( $object, $property ) )
{
return $object->$property;
}
else if ( method_exists( $object, 'setField' ) )
{
return $object->getField( $property );
}
else
{
throw new InvalidArgumentException( $property, "wasn't found in the '" . get_class( $object ) ."' object" );
}
} | php | static function getProperty( ValueObjectInterface $object, $property )
{
if ( property_exists( $object, $property ) )
{
return $object->$property;
}
else if ( method_exists( $object, 'setField' ) )
{
return $object->getField( $property );
}
else
{
throw new InvalidArgumentException( $property, "wasn't found in the '" . get_class( $object ) ."' object" );
}
} | [
"static",
"function",
"getProperty",
"(",
"ValueObjectInterface",
"$",
"object",
",",
"$",
"property",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"object",
",",
"$",
"property",
")",
")",
"{",
"return",
"$",
"object",
"->",
"$",
"property",
";",
"}",
"else",
"if",
"(",
"method_exists",
"(",
"$",
"object",
",",
"'setField'",
")",
")",
"{",
"return",
"$",
"object",
"->",
"getField",
"(",
"$",
"property",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"$",
"property",
",",
"\"wasn't found in the '\"",
".",
"get_class",
"(",
"$",
"object",
")",
".",
"\"' object\"",
")",
";",
"}",
"}"
] | Gets $property from $object
@param \eZ\Publish\API\Repository\Values\ValueObject $object The object to be updated
@param string $property Name of property or field
@return mixed
@throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentException If the property/field is not found | [
"Gets",
"$property",
"from",
"$object"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Helper/ValueObject.php#L33-L47 |
ezsystems/BehatBundle | Helper/ValueObject.php | ValueObject.setProperty | static function setProperty( ValueObjectInterface $object, $property, $value )
{
if ( property_exists( $object, $property ) )
{
$object->$property = $value;
}
else if ( method_exists( $object, 'setField' ) )
{
$object->setField( $property, $value );
}
else
{
throw new InvalidArgumentException( $property, "wasn't found in the '" . get_class( $object ) ."' object" );
}
} | php | static function setProperty( ValueObjectInterface $object, $property, $value )
{
if ( property_exists( $object, $property ) )
{
$object->$property = $value;
}
else if ( method_exists( $object, 'setField' ) )
{
$object->setField( $property, $value );
}
else
{
throw new InvalidArgumentException( $property, "wasn't found in the '" . get_class( $object ) ."' object" );
}
} | [
"static",
"function",
"setProperty",
"(",
"ValueObjectInterface",
"$",
"object",
",",
"$",
"property",
",",
"$",
"value",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"object",
",",
"$",
"property",
")",
")",
"{",
"$",
"object",
"->",
"$",
"property",
"=",
"$",
"value",
";",
"}",
"else",
"if",
"(",
"method_exists",
"(",
"$",
"object",
",",
"'setField'",
")",
")",
"{",
"$",
"object",
"->",
"setField",
"(",
"$",
"property",
",",
"$",
"value",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"$",
"property",
",",
"\"wasn't found in the '\"",
".",
"get_class",
"(",
"$",
"object",
")",
".",
"\"' object\"",
")",
";",
"}",
"}"
] | Sets $property in $object to $value
@param \eZ\Publish\API\Repository\Values\ValueObject $object The object to be updated
@param string $property Name of property or field
@param mixed $value The value to set the property/field to
@throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentException If the property/field is not found | [
"Sets",
"$property",
"in",
"$object",
"to",
"$value"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Helper/ValueObject.php#L58-L72 |
ezsystems/BehatBundle | Helper/ValueObject.php | ValueObject.setProperties | static function setProperties( ValueObjectInterface $object, array $values )
{
foreach ( $values as $property => $value )
{
$this->setProperty( $object, $property, $value );
}
} | php | static function setProperties( ValueObjectInterface $object, array $values )
{
foreach ( $values as $property => $value )
{
$this->setProperty( $object, $property, $value );
}
} | [
"static",
"function",
"setProperties",
"(",
"ValueObjectInterface",
"$",
"object",
",",
"array",
"$",
"values",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"property",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"setProperty",
"(",
"$",
"object",
",",
"$",
"property",
",",
"$",
"value",
")",
";",
"}",
"}"
] | Sets an objects properties
@param \eZ\Publish\API\Repository\Values\ValueObject $object Object to be updated
@param array $values Associative array with properties => values | [
"Sets",
"an",
"objects",
"properties"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Helper/ValueObject.php#L80-L86 |
ezsystems/BehatBundle | Helper/ValueObject.php | ValueObject.tooArray | static function tooArray( ValueObjectInterface $object )
{
// clone object to ReflectionClass
$reflectionClass = new \ReflectionClass( $object );
// get each property/field
$properties = array();
foreach ( $reflectionClass->getProperties() as $reflectionProperty )
{
$properties[$reflectionProperty->getName()] = $this->getProperty( $object, $reflectionProperty->getName() );
}
return $properties;
} | php | static function tooArray( ValueObjectInterface $object )
{
// clone object to ReflectionClass
$reflectionClass = new \ReflectionClass( $object );
// get each property/field
$properties = array();
foreach ( $reflectionClass->getProperties() as $reflectionProperty )
{
$properties[$reflectionProperty->getName()] = $this->getProperty( $object, $reflectionProperty->getName() );
}
return $properties;
} | [
"static",
"function",
"tooArray",
"(",
"ValueObjectInterface",
"$",
"object",
")",
"{",
"// clone object to ReflectionClass",
"$",
"reflectionClass",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"object",
")",
";",
"// get each property/field",
"$",
"properties",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"reflectionClass",
"->",
"getProperties",
"(",
")",
"as",
"$",
"reflectionProperty",
")",
"{",
"$",
"properties",
"[",
"$",
"reflectionProperty",
"->",
"getName",
"(",
")",
"]",
"=",
"$",
"this",
"->",
"getProperty",
"(",
"$",
"object",
",",
"$",
"reflectionProperty",
"->",
"getName",
"(",
")",
")",
";",
"}",
"return",
"$",
"properties",
";",
"}"
] | Convert/serialize ValueObject to array
@param \eZ\Publish\API\Repository\Values\ValueObject $object Object to get all properties/fields
@return array
@todo For ContentType the object will have several fields/properties with same name (for example 'names' that will exist in every FieldDefinition) | [
"Convert",
"/",
"serialize",
"ValueObject",
"to",
"array"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Helper/ValueObject.php#L97-L110 |
ezsystems/BehatBundle | ObjectManager/User.php | User.searchUserGroups | public function searchUserGroups( $name, $parentLocationId = null )
{
return $this->getContext()->getUserGroupManager()->searchUserGroups( $name, $parentLocationId );
} | php | public function searchUserGroups( $name, $parentLocationId = null )
{
return $this->getContext()->getUserGroupManager()->searchUserGroups( $name, $parentLocationId );
} | [
"public",
"function",
"searchUserGroups",
"(",
"$",
"name",
",",
"$",
"parentLocationId",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getContext",
"(",
")",
"->",
"getUserGroupManager",
"(",
")",
"->",
"searchUserGroups",
"(",
"$",
"name",
",",
"$",
"parentLocationId",
")",
";",
"}"
] | Search User Groups with given name
@param string $name name of User Group to search for
@param string $parentLocationId (optional) parent location id to search in
@return search results | [
"Search",
"User",
"Groups",
"with",
"given",
"name"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/ObjectManager/User.php#L64-L67 |
ezsystems/BehatBundle | ObjectManager/User.php | User.createUserGroup | public function createUserGroup( $name, $parentGroup = null )
{
return $this->getContext()->getUserGroupManager()->createUserGroup( $name, $parentGroup );
} | php | public function createUserGroup( $name, $parentGroup = null )
{
return $this->getContext()->getUserGroupManager()->createUserGroup( $name, $parentGroup );
} | [
"public",
"function",
"createUserGroup",
"(",
"$",
"name",
",",
"$",
"parentGroup",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getContext",
"(",
")",
"->",
"getUserGroupManager",
"(",
")",
"->",
"createUserGroup",
"(",
"$",
"name",
",",
"$",
"parentGroup",
")",
";",
"}"
] | Create new User Group inside existing parent User Group
@param string $name User Group name
@param \eZ\Publish\API\Repository\Values\User\UserGroup $parentGroup (optional) parent user group, defaults to UserGroup "/Users"
@return \eZ\Publish\API\Repository\Values\User\UserGroup | [
"Create",
"new",
"User",
"Group",
"inside",
"existing",
"parent",
"User",
"Group"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/ObjectManager/User.php#L77-L80 |
ezsystems/BehatBundle | ObjectManager/User.php | User.loadUser | public function loadUser( $id )
{
/** @var \eZ\Publish\API\Repository\Repository $repository */
$repository = $this->getRepository();
$userService = $repository->getUserService();
$user = $repository->sudo(
function() use( $id, $userService )
{
return $userService->loadUser( $id );
}
);
return $user;
} | php | public function loadUser( $id )
{
/** @var \eZ\Publish\API\Repository\Repository $repository */
$repository = $this->getRepository();
$userService = $repository->getUserService();
$user = $repository->sudo(
function() use( $id, $userService )
{
return $userService->loadUser( $id );
}
);
return $user;
} | [
"public",
"function",
"loadUser",
"(",
"$",
"id",
")",
"{",
"/** @var \\eZ\\Publish\\API\\Repository\\Repository $repository */",
"$",
"repository",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
";",
"$",
"userService",
"=",
"$",
"repository",
"->",
"getUserService",
"(",
")",
";",
"$",
"user",
"=",
"$",
"repository",
"->",
"sudo",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"id",
",",
"$",
"userService",
")",
"{",
"return",
"$",
"userService",
"->",
"loadUser",
"(",
"$",
"id",
")",
";",
"}",
")",
";",
"return",
"$",
"user",
";",
"}"
] | Load a User by id
@param int $id User content identifier
@return \eZ\Publish\API\Repository\Values\User\User | [
"Load",
"a",
"User",
"by",
"id"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/ObjectManager/User.php#L89-L103 |
ezsystems/BehatBundle | ObjectManager/User.php | User.loadUserByLogin | public function loadUserByLogin( $login )
{
/** @var \eZ\Publish\API\Repository\Repository $repository */
$repository = $this->getRepository();
$userService = $repository->getUserService();
$user = $repository->sudo(
function() use( $login, $userService )
{
return $userService->loadUserByLogin( $login );
}
);
return $user;
} | php | public function loadUserByLogin( $login )
{
/** @var \eZ\Publish\API\Repository\Repository $repository */
$repository = $this->getRepository();
$userService = $repository->getUserService();
$user = $repository->sudo(
function() use( $login, $userService )
{
return $userService->loadUserByLogin( $login );
}
);
return $user;
} | [
"public",
"function",
"loadUserByLogin",
"(",
"$",
"login",
")",
"{",
"/** @var \\eZ\\Publish\\API\\Repository\\Repository $repository */",
"$",
"repository",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
";",
"$",
"userService",
"=",
"$",
"repository",
"->",
"getUserService",
"(",
")",
";",
"$",
"user",
"=",
"$",
"repository",
"->",
"sudo",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"login",
",",
"$",
"userService",
")",
"{",
"return",
"$",
"userService",
"->",
"loadUserByLogin",
"(",
"$",
"login",
")",
";",
"}",
")",
";",
"return",
"$",
"user",
";",
"}"
] | Load a User by login
@param int $id User content identifier
@return \eZ\Publish\API\Repository\Values\User\User | [
"Load",
"a",
"User",
"by",
"login"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/ObjectManager/User.php#L112-L126 |
ezsystems/BehatBundle | ObjectManager/User.php | User.updateUser | public function updateUser( $user, $fields = array() )
{
/** @var \eZ\Publish\API\Repository\Repository $repository */
$repository = $this->getRepository();
$contentService = $repository->getContentService();
$userService = $repository->getUserService();
$userUpdateStruct = $userService->newUserUpdateStruct();
$contentUpdateStruct = $contentService->newContentUpdateStruct();
foreach ( $fields as $fieldName => $fieldValue )
{
switch ( $fieldName )
{
case 'password':
// TODO: throw, not impl.
break;
case 'email':
// TODO: throw, not impl.
break;
default:
$contentUpdateStruct->setField( $fieldName, $fieldValue, 'eng-GB' );
break;
}
}
$userUpdateStruct->contentUpdateStruct = $contentUpdateStruct;
$repository->sudo(
function() use( $user, $userUpdateStruct, $userService )
{
$userService->updateUser( $user, $userUpdateStruct );
}
);
} | php | public function updateUser( $user, $fields = array() )
{
/** @var \eZ\Publish\API\Repository\Repository $repository */
$repository = $this->getRepository();
$contentService = $repository->getContentService();
$userService = $repository->getUserService();
$userUpdateStruct = $userService->newUserUpdateStruct();
$contentUpdateStruct = $contentService->newContentUpdateStruct();
foreach ( $fields as $fieldName => $fieldValue )
{
switch ( $fieldName )
{
case 'password':
// TODO: throw, not impl.
break;
case 'email':
// TODO: throw, not impl.
break;
default:
$contentUpdateStruct->setField( $fieldName, $fieldValue, 'eng-GB' );
break;
}
}
$userUpdateStruct->contentUpdateStruct = $contentUpdateStruct;
$repository->sudo(
function() use( $user, $userUpdateStruct, $userService )
{
$userService->updateUser( $user, $userUpdateStruct );
}
);
} | [
"public",
"function",
"updateUser",
"(",
"$",
"user",
",",
"$",
"fields",
"=",
"array",
"(",
")",
")",
"{",
"/** @var \\eZ\\Publish\\API\\Repository\\Repository $repository */",
"$",
"repository",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
";",
"$",
"contentService",
"=",
"$",
"repository",
"->",
"getContentService",
"(",
")",
";",
"$",
"userService",
"=",
"$",
"repository",
"->",
"getUserService",
"(",
")",
";",
"$",
"userUpdateStruct",
"=",
"$",
"userService",
"->",
"newUserUpdateStruct",
"(",
")",
";",
"$",
"contentUpdateStruct",
"=",
"$",
"contentService",
"->",
"newContentUpdateStruct",
"(",
")",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"fieldName",
"=>",
"$",
"fieldValue",
")",
"{",
"switch",
"(",
"$",
"fieldName",
")",
"{",
"case",
"'password'",
":",
"// TODO: throw, not impl.",
"break",
";",
"case",
"'email'",
":",
"// TODO: throw, not impl.",
"break",
";",
"default",
":",
"$",
"contentUpdateStruct",
"->",
"setField",
"(",
"$",
"fieldName",
",",
"$",
"fieldValue",
",",
"'eng-GB'",
")",
";",
"break",
";",
"}",
"}",
"$",
"userUpdateStruct",
"->",
"contentUpdateStruct",
"=",
"$",
"contentUpdateStruct",
";",
"$",
"repository",
"->",
"sudo",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"user",
",",
"$",
"userUpdateStruct",
",",
"$",
"userService",
")",
"{",
"$",
"userService",
"->",
"updateUser",
"(",
"$",
"user",
",",
"$",
"userUpdateStruct",
")",
";",
"}",
")",
";",
"}"
] | Update user with given field and value
@param $user user to update
@param $fieldLabel name of the field to update
@param $fieldValue value of the field to update to | [
"Update",
"user",
"with",
"given",
"field",
"and",
"value"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/ObjectManager/User.php#L228-L260 |
ezsystems/BehatBundle | ObjectManager/User.php | User.checkUserExistenceByEmail | public function checkUserExistenceByEmail( $email, $parentGroupName = null )
{
/** @var \eZ\Publish\API\Repository\Repository $repository */
$repository = $this->getRepository();
$userService = $repository->getUserService();
$existingUsers = $userService->loadUsersByEmail( $email );
if ( count( $existingUsers ) == 0 )
{
return false;
}
if ( $parentGroupName )
{
foreach ( $existingUsers as $user )
{
$userGroups = $userService->loadUserGroupsOfUser( $user );
foreach ( $userGroups as $userGroup )
{
if ( $userGroup->getFieldValue( 'name' ) == $parentGroupName )
return true;
}
}
}
return false;
} | php | public function checkUserExistenceByEmail( $email, $parentGroupName = null )
{
/** @var \eZ\Publish\API\Repository\Repository $repository */
$repository = $this->getRepository();
$userService = $repository->getUserService();
$existingUsers = $userService->loadUsersByEmail( $email );
if ( count( $existingUsers ) == 0 )
{
return false;
}
if ( $parentGroupName )
{
foreach ( $existingUsers as $user )
{
$userGroups = $userService->loadUserGroupsOfUser( $user );
foreach ( $userGroups as $userGroup )
{
if ( $userGroup->getFieldValue( 'name' ) == $parentGroupName )
return true;
}
}
}
return false;
} | [
"public",
"function",
"checkUserExistenceByEmail",
"(",
"$",
"email",
",",
"$",
"parentGroupName",
"=",
"null",
")",
"{",
"/** @var \\eZ\\Publish\\API\\Repository\\Repository $repository */",
"$",
"repository",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
";",
"$",
"userService",
"=",
"$",
"repository",
"->",
"getUserService",
"(",
")",
";",
"$",
"existingUsers",
"=",
"$",
"userService",
"->",
"loadUsersByEmail",
"(",
"$",
"email",
")",
";",
"if",
"(",
"count",
"(",
"$",
"existingUsers",
")",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"parentGroupName",
")",
"{",
"foreach",
"(",
"$",
"existingUsers",
"as",
"$",
"user",
")",
"{",
"$",
"userGroups",
"=",
"$",
"userService",
"->",
"loadUserGroupsOfUser",
"(",
"$",
"user",
")",
";",
"foreach",
"(",
"$",
"userGroups",
"as",
"$",
"userGroup",
")",
"{",
"if",
"(",
"$",
"userGroup",
"->",
"getFieldValue",
"(",
"'name'",
")",
"==",
"$",
"parentGroupName",
")",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] | Checks if the User with email $email exists
@param string $email User email
@param string $parentGroupName User group name to search inside
@return boolean true if it exists, false if not | [
"Checks",
"if",
"the",
"User",
"with",
"email",
"$email",
"exists"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/ObjectManager/User.php#L425-L451 |
ezsystems/BehatBundle | ObjectManager/User.php | User.checkUserExistenceById | public function checkUserExistenceById( $id )
{
/** @var \eZ\Publish\API\Repository\Repository $repository */
$repository = $this->getRepository();
$userService = $repository->getUserService();
return $repository->sudo(
function() use( $id, $userService )
{
// attempt to load the user with the id
try
{
$userService->loadUser( $id );
return true;
}
catch ( ApiExceptions\NotFoundException $e )
{
return false;
}
}
);
} | php | public function checkUserExistenceById( $id )
{
/** @var \eZ\Publish\API\Repository\Repository $repository */
$repository = $this->getRepository();
$userService = $repository->getUserService();
return $repository->sudo(
function() use( $id, $userService )
{
// attempt to load the user with the id
try
{
$userService->loadUser( $id );
return true;
}
catch ( ApiExceptions\NotFoundException $e )
{
return false;
}
}
);
} | [
"public",
"function",
"checkUserExistenceById",
"(",
"$",
"id",
")",
"{",
"/** @var \\eZ\\Publish\\API\\Repository\\Repository $repository */",
"$",
"repository",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
";",
"$",
"userService",
"=",
"$",
"repository",
"->",
"getUserService",
"(",
")",
";",
"return",
"$",
"repository",
"->",
"sudo",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"id",
",",
"$",
"userService",
")",
"{",
"// attempt to load the user with the id",
"try",
"{",
"$",
"userService",
"->",
"loadUser",
"(",
"$",
"id",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"ApiExceptions",
"\\",
"NotFoundException",
"$",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}",
")",
";",
"}"
] | Checks if the User with $id exists
@param string $id Identifier of the possible content
@return boolean true if it exists, false if not | [
"Checks",
"if",
"the",
"User",
"with",
"$id",
"exists"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/ObjectManager/User.php#L460-L481 |
ezsystems/BehatBundle | ObjectManager/User.php | User.verifyPasswordHash | public function verifyPasswordHash( $login, $password, $type, $passwordHash )
{
// If type is 6 or higher it uses PHP's builtin password_verify
if ($type >= 6) {
return password_verify($password, $passwordHash);
}
// If not fall back to old logic
return $this->createPasswordHash($login, $password, $type) === $passwordHash;
} | php | public function verifyPasswordHash( $login, $password, $type, $passwordHash )
{
// If type is 6 or higher it uses PHP's builtin password_verify
if ($type >= 6) {
return password_verify($password, $passwordHash);
}
// If not fall back to old logic
return $this->createPasswordHash($login, $password, $type) === $passwordHash;
} | [
"public",
"function",
"verifyPasswordHash",
"(",
"$",
"login",
",",
"$",
"password",
",",
"$",
"type",
",",
"$",
"passwordHash",
")",
"{",
"// If type is 6 or higher it uses PHP's builtin password_verify",
"if",
"(",
"$",
"type",
">=",
"6",
")",
"{",
"return",
"password_verify",
"(",
"$",
"password",
",",
"$",
"passwordHash",
")",
";",
"}",
"// If not fall back to old logic",
"return",
"$",
"this",
"->",
"createPasswordHash",
"(",
"$",
"login",
",",
"$",
"password",
",",
"$",
"type",
")",
"===",
"$",
"passwordHash",
";",
"}"
] | @param string $login
@param string $password
@param int $type
@param string $passwordHash
@return bool | [
"@param",
"string",
"$login",
"@param",
"string",
"$password",
"@param",
"int",
"$type",
"@param",
"string",
"$passwordHash"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/ObjectManager/User.php#L491-L500 |
ezsystems/BehatBundle | Context/Object/Role.php | Role.iSeeRole | public function iSeeRole( $name )
{
$role = $this->getRoleManager()->getRole( $name );
Assertion::assertNotNull(
$role,
"Couldn't find Role with name $name"
);
} | php | public function iSeeRole( $name )
{
$role = $this->getRoleManager()->getRole( $name );
Assertion::assertNotNull(
$role,
"Couldn't find Role with name $name"
);
} | [
"public",
"function",
"iSeeRole",
"(",
"$",
"name",
")",
"{",
"$",
"role",
"=",
"$",
"this",
"->",
"getRoleManager",
"(",
")",
"->",
"getRole",
"(",
"$",
"name",
")",
";",
"Assertion",
"::",
"assertNotNull",
"(",
"$",
"role",
",",
"\"Couldn't find Role with name $name\"",
")",
";",
"}"
] | @Then I see that a/an :name role exists
Verifies that a role with $name exists. | [
"@Then",
"I",
"see",
"that",
"a",
"/",
"an",
":",
"name",
"role",
"exists"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/Role.php#L38-L45 |
ezsystems/BehatBundle | Context/Object/Role.php | Role.iDontSeeRole | public function iDontSeeRole( $name )
{
$role = $this->getRoleManager()->getRole( $name );
Assertion::assertNull(
$role,
"Found Role with name $name"
);
} | php | public function iDontSeeRole( $name )
{
$role = $this->getRoleManager()->getRole( $name );
Assertion::assertNull(
$role,
"Found Role with name $name"
);
} | [
"public",
"function",
"iDontSeeRole",
"(",
"$",
"name",
")",
"{",
"$",
"role",
"=",
"$",
"this",
"->",
"getRoleManager",
"(",
")",
"->",
"getRole",
"(",
"$",
"name",
")",
";",
"Assertion",
"::",
"assertNull",
"(",
"$",
"role",
",",
"\"Found Role with name $name\"",
")",
";",
"}"
] | @Then I see that a/an :name role does not exists
Verifies that a role with $name exists. | [
"@Then",
"I",
"see",
"that",
"a",
"/",
"an",
":",
"name",
"role",
"does",
"not",
"exists"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/Role.php#L62-L69 |
ezsystems/BehatBundle | ObjectManager/FieldType.php | FieldType.publishContent | private function publishContent( $field, $value )
{
$repository = $this->getRepository();
$languageCode = self::DEFAULT_LANGUAGE;
$content = $repository->sudo(
function() use( $repository, $languageCode, $field, $value )
{
$contentService = $repository->getcontentService();
$locationCreateStruct = $repository->getLocationService()->newLocationCreateStruct( '2' );
$contentType = $this->fieldConstructionObject[ 'contentType' ];
$contentCreateStruct = $contentService->newContentCreateStruct( $contentType, $languageCode );
if ( $field != null && $value != null )
{
$value = ( $value == 'empty' ) ? null : $value;
$value = is_numeric( $value ) ? $value + 0 : $value;
$contentCreateStruct->setField( $field, $value );
}
$draft = $contentService->createContent( $contentCreateStruct, array( $locationCreateStruct ) );
$content = $contentService->publishVersion( $draft->versionInfo );
return $content;
}
);
$this->fieldConstructionObject[ 'content' ] = $content;
$this->fieldConstructionObject[ 'objectState' ] = self::CONTENT_PUBLISHED;
} | php | private function publishContent( $field, $value )
{
$repository = $this->getRepository();
$languageCode = self::DEFAULT_LANGUAGE;
$content = $repository->sudo(
function() use( $repository, $languageCode, $field, $value )
{
$contentService = $repository->getcontentService();
$locationCreateStruct = $repository->getLocationService()->newLocationCreateStruct( '2' );
$contentType = $this->fieldConstructionObject[ 'contentType' ];
$contentCreateStruct = $contentService->newContentCreateStruct( $contentType, $languageCode );
if ( $field != null && $value != null )
{
$value = ( $value == 'empty' ) ? null : $value;
$value = is_numeric( $value ) ? $value + 0 : $value;
$contentCreateStruct->setField( $field, $value );
}
$draft = $contentService->createContent( $contentCreateStruct, array( $locationCreateStruct ) );
$content = $contentService->publishVersion( $draft->versionInfo );
return $content;
}
);
$this->fieldConstructionObject[ 'content' ] = $content;
$this->fieldConstructionObject[ 'objectState' ] = self::CONTENT_PUBLISHED;
} | [
"private",
"function",
"publishContent",
"(",
"$",
"field",
",",
"$",
"value",
")",
"{",
"$",
"repository",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
";",
"$",
"languageCode",
"=",
"self",
"::",
"DEFAULT_LANGUAGE",
";",
"$",
"content",
"=",
"$",
"repository",
"->",
"sudo",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"repository",
",",
"$",
"languageCode",
",",
"$",
"field",
",",
"$",
"value",
")",
"{",
"$",
"contentService",
"=",
"$",
"repository",
"->",
"getcontentService",
"(",
")",
";",
"$",
"locationCreateStruct",
"=",
"$",
"repository",
"->",
"getLocationService",
"(",
")",
"->",
"newLocationCreateStruct",
"(",
"'2'",
")",
";",
"$",
"contentType",
"=",
"$",
"this",
"->",
"fieldConstructionObject",
"[",
"'contentType'",
"]",
";",
"$",
"contentCreateStruct",
"=",
"$",
"contentService",
"->",
"newContentCreateStruct",
"(",
"$",
"contentType",
",",
"$",
"languageCode",
")",
";",
"if",
"(",
"$",
"field",
"!=",
"null",
"&&",
"$",
"value",
"!=",
"null",
")",
"{",
"$",
"value",
"=",
"(",
"$",
"value",
"==",
"'empty'",
")",
"?",
"null",
":",
"$",
"value",
";",
"$",
"value",
"=",
"is_numeric",
"(",
"$",
"value",
")",
"?",
"$",
"value",
"+",
"0",
":",
"$",
"value",
";",
"$",
"contentCreateStruct",
"->",
"setField",
"(",
"$",
"field",
",",
"$",
"value",
")",
";",
"}",
"$",
"draft",
"=",
"$",
"contentService",
"->",
"createContent",
"(",
"$",
"contentCreateStruct",
",",
"array",
"(",
"$",
"locationCreateStruct",
")",
")",
";",
"$",
"content",
"=",
"$",
"contentService",
"->",
"publishVersion",
"(",
"$",
"draft",
"->",
"versionInfo",
")",
";",
"return",
"$",
"content",
";",
"}",
")",
";",
"$",
"this",
"->",
"fieldConstructionObject",
"[",
"'content'",
"]",
"=",
"$",
"content",
";",
"$",
"this",
"->",
"fieldConstructionObject",
"[",
"'objectState'",
"]",
"=",
"self",
"::",
"CONTENT_PUBLISHED",
";",
"}"
] | Publishes the content
@param string The field name
@param mixed The field value | [
"Publishes",
"the",
"content"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/ObjectManager/FieldType.php#L196-L222 |
ezsystems/BehatBundle | ObjectManager/FieldType.php | FieldType.createContentType | private function createContentType()
{
$repository = $this->getRepository();
$contentTypeService = $repository->getContentTypeService();
$name = $this->fieldConstructionObject[ 'fieldType' ]->identifier;
$name = uniqid($name . '#', true);
$name = str_replace('.', '', $name);
$identifier = strtolower( $name );
$contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct( $identifier );
$contentTypeCreateStruct->mainLanguageCode = self::DEFAULT_LANGUAGE;
$contentTypeCreateStruct->names = array( self::DEFAULT_LANGUAGE => $name );
$contentTypeCreateStruct->nameSchema = $name;
$this->fieldConstructionObject[ 'contentType' ] = $contentTypeCreateStruct;
$this->fieldConstructionObject[ 'objectState' ] = self::CONTENT_TYPE_CREATED;
} | php | private function createContentType()
{
$repository = $this->getRepository();
$contentTypeService = $repository->getContentTypeService();
$name = $this->fieldConstructionObject[ 'fieldType' ]->identifier;
$name = uniqid($name . '#', true);
$name = str_replace('.', '', $name);
$identifier = strtolower( $name );
$contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct( $identifier );
$contentTypeCreateStruct->mainLanguageCode = self::DEFAULT_LANGUAGE;
$contentTypeCreateStruct->names = array( self::DEFAULT_LANGUAGE => $name );
$contentTypeCreateStruct->nameSchema = $name;
$this->fieldConstructionObject[ 'contentType' ] = $contentTypeCreateStruct;
$this->fieldConstructionObject[ 'objectState' ] = self::CONTENT_TYPE_CREATED;
} | [
"private",
"function",
"createContentType",
"(",
")",
"{",
"$",
"repository",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
";",
"$",
"contentTypeService",
"=",
"$",
"repository",
"->",
"getContentTypeService",
"(",
")",
";",
"$",
"name",
"=",
"$",
"this",
"->",
"fieldConstructionObject",
"[",
"'fieldType'",
"]",
"->",
"identifier",
";",
"$",
"name",
"=",
"uniqid",
"(",
"$",
"name",
".",
"'#'",
",",
"true",
")",
";",
"$",
"name",
"=",
"str_replace",
"(",
"'.'",
",",
"''",
",",
"$",
"name",
")",
";",
"$",
"identifier",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"$",
"contentTypeCreateStruct",
"=",
"$",
"contentTypeService",
"->",
"newContentTypeCreateStruct",
"(",
"$",
"identifier",
")",
";",
"$",
"contentTypeCreateStruct",
"->",
"mainLanguageCode",
"=",
"self",
"::",
"DEFAULT_LANGUAGE",
";",
"$",
"contentTypeCreateStruct",
"->",
"names",
"=",
"array",
"(",
"self",
"::",
"DEFAULT_LANGUAGE",
"=>",
"$",
"name",
")",
";",
"$",
"contentTypeCreateStruct",
"->",
"nameSchema",
"=",
"$",
"name",
";",
"$",
"this",
"->",
"fieldConstructionObject",
"[",
"'contentType'",
"]",
"=",
"$",
"contentTypeCreateStruct",
";",
"$",
"this",
"->",
"fieldConstructionObject",
"[",
"'objectState'",
"]",
"=",
"self",
"::",
"CONTENT_TYPE_CREATED",
";",
"}"
] | Creates an instance of a contenttype and stores it for later publishing | [
"Creates",
"an",
"instance",
"of",
"a",
"contenttype",
"and",
"stores",
"it",
"for",
"later",
"publishing"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/ObjectManager/FieldType.php#L312-L326 |
ezsystems/BehatBundle | Helper/Xpath.php | Xpath.makeElementXpath | public function makeElementXpath( $element, $search )
{
$selectorsHandler = $this->session->getSelectorsHandler();
$literal = $selectorsHandler->xpathLiteral( $search );
// To be able to work on mink 1.6 (ezplatform) & mink 1.5 (5.4+ezpublish-community) w/o deprecation exceptions
$selector = $selectorsHandler->isSelectorRegistered( 'named_partial' ) ?
$selectorsHandler->getSelector( 'named_partial' ) :
$selectorsHandler->getSelector( 'named' );
return $selector->translateToXPath( array( $element, $literal ) );
} | php | public function makeElementXpath( $element, $search )
{
$selectorsHandler = $this->session->getSelectorsHandler();
$literal = $selectorsHandler->xpathLiteral( $search );
// To be able to work on mink 1.6 (ezplatform) & mink 1.5 (5.4+ezpublish-community) w/o deprecation exceptions
$selector = $selectorsHandler->isSelectorRegistered( 'named_partial' ) ?
$selectorsHandler->getSelector( 'named_partial' ) :
$selectorsHandler->getSelector( 'named' );
return $selector->translateToXPath( array( $element, $literal ) );
} | [
"public",
"function",
"makeElementXpath",
"(",
"$",
"element",
",",
"$",
"search",
")",
"{",
"$",
"selectorsHandler",
"=",
"$",
"this",
"->",
"session",
"->",
"getSelectorsHandler",
"(",
")",
";",
"$",
"literal",
"=",
"$",
"selectorsHandler",
"->",
"xpathLiteral",
"(",
"$",
"search",
")",
";",
"// To be able to work on mink 1.6 (ezplatform) & mink 1.5 (5.4+ezpublish-community) w/o deprecation exceptions",
"$",
"selector",
"=",
"$",
"selectorsHandler",
"->",
"isSelectorRegistered",
"(",
"'named_partial'",
")",
"?",
"$",
"selectorsHandler",
"->",
"getSelector",
"(",
"'named_partial'",
")",
":",
"$",
"selectorsHandler",
"->",
"getSelector",
"(",
"'named'",
")",
";",
"return",
"$",
"selector",
"->",
"translateToXPath",
"(",
"array",
"(",
"$",
"element",
",",
"$",
"literal",
")",
")",
";",
"}"
] | Make XPath for a specific element/object using Behat selectors
@param string $element Type of element for the XPath
@param string $search String to search
@return string XPath for the element/object | [
"Make",
"XPath",
"for",
"a",
"specific",
"element",
"/",
"object",
"using",
"Behat",
"selectors"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Helper/Xpath.php#L62-L73 |
ezsystems/BehatBundle | Helper/Xpath.php | Xpath.findObjects | public function findObjects( $element, $search, $prefix = null )
{
$xpath = $this->mergePrefixToXpath(
$prefix,
$this->makeElementXpath( $element, $search )
);
return $this->findXpath( $xpath );
} | php | public function findObjects( $element, $search, $prefix = null )
{
$xpath = $this->mergePrefixToXpath(
$prefix,
$this->makeElementXpath( $element, $search )
);
return $this->findXpath( $xpath );
} | [
"public",
"function",
"findObjects",
"(",
"$",
"element",
",",
"$",
"search",
",",
"$",
"prefix",
"=",
"null",
")",
"{",
"$",
"xpath",
"=",
"$",
"this",
"->",
"mergePrefixToXpath",
"(",
"$",
"prefix",
",",
"$",
"this",
"->",
"makeElementXpath",
"(",
"$",
"element",
",",
"$",
"search",
")",
")",
";",
"return",
"$",
"this",
"->",
"findXpath",
"(",
"$",
"xpath",
")",
";",
"}"
] | Find page objects/elements
@param string $element Object type
@param string $search Text to search for
@param null|string $prefix XPath prefix if needed
@return \Behat\Mink\Element\NodeElement[] Array with NodeEelments that match | [
"Find",
"page",
"objects",
"/",
"elements"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Helper/Xpath.php#L84-L92 |
ezsystems/BehatBundle | Helper/Xpath.php | Xpath.mergePrefixToXpath | public function mergePrefixToXpath( $prefix, $xpath )
{
if ( empty( $prefix ) )
{
return $xpath;
}
if ( $prefix[strlen( $prefix ) - 1] !== '/' )
{
$prefix .= '/';
}
return $prefix . implode( "| $prefix", explode( '|', $xpath ) );
} | php | public function mergePrefixToXpath( $prefix, $xpath )
{
if ( empty( $prefix ) )
{
return $xpath;
}
if ( $prefix[strlen( $prefix ) - 1] !== '/' )
{
$prefix .= '/';
}
return $prefix . implode( "| $prefix", explode( '|', $xpath ) );
} | [
"public",
"function",
"mergePrefixToXpath",
"(",
"$",
"prefix",
",",
"$",
"xpath",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"prefix",
")",
")",
"{",
"return",
"$",
"xpath",
";",
"}",
"if",
"(",
"$",
"prefix",
"[",
"strlen",
"(",
"$",
"prefix",
")",
"-",
"1",
"]",
"!==",
"'/'",
")",
"{",
"$",
"prefix",
".=",
"'/'",
";",
"}",
"return",
"$",
"prefix",
".",
"implode",
"(",
"\"| $prefix\"",
",",
"explode",
"(",
"'|'",
",",
"$",
"xpath",
")",
")",
";",
"}"
] | Merge/inject prefix into multiple case XPath
ex:
$xpath = '//h1 | //h2';
$prefix = '//article';
return "//article/.//h1 | //article/.//h2"
@param string $prefix XPath prefix
@param string $xpath Complete XPath
@return string XPath with prefixes (or original if no prefix passed) | [
"Merge",
"/",
"inject",
"prefix",
"into",
"multiple",
"case",
"XPath"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Helper/Xpath.php#L250-L263 |
ezsystems/BehatBundle | Context/Object/User.php | User.iHaveUser | public function iHaveUser( $username )
{
$email = $this->findNonExistingUserEmail( $username );
$password = $this->getUserManager()->getDefaultPassword();
$user = $this->getUserManager()->ensureUserExists( $username, $email, $password );
$this->addValuesToKeyMap( $email, $user->email );
} | php | public function iHaveUser( $username )
{
$email = $this->findNonExistingUserEmail( $username );
$password = $this->getUserManager()->getDefaultPassword();
$user = $this->getUserManager()->ensureUserExists( $username, $email, $password );
$this->addValuesToKeyMap( $email, $user->email );
} | [
"public",
"function",
"iHaveUser",
"(",
"$",
"username",
")",
"{",
"$",
"email",
"=",
"$",
"this",
"->",
"findNonExistingUserEmail",
"(",
"$",
"username",
")",
";",
"$",
"password",
"=",
"$",
"this",
"->",
"getUserManager",
"(",
")",
"->",
"getDefaultPassword",
"(",
")",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"getUserManager",
"(",
")",
"->",
"ensureUserExists",
"(",
"$",
"username",
",",
"$",
"email",
",",
"$",
"password",
")",
";",
"$",
"this",
"->",
"addValuesToKeyMap",
"(",
"$",
"email",
",",
"$",
"user",
"->",
"email",
")",
";",
"}"
] | @Given there is a User with name :username
Ensures a user with username ':username' exists, creating a new one if necessary.
@return \eZ\Publish\API\Repository\Values\User\User | [
"@Given",
"there",
"is",
"a",
"User",
"with",
"name",
":",
"username"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/User.php#L27-L33 |
ezsystems/BehatBundle | Context/Object/User.php | User.iHaveUserWithUsernameEmailAndPassword | public function iHaveUserWithUsernameEmailAndPassword( $username, $email, $password )
{
$this->getUserManager()->ensureUserExists( $username, $email, $password );
} | php | public function iHaveUserWithUsernameEmailAndPassword( $username, $email, $password )
{
$this->getUserManager()->ensureUserExists( $username, $email, $password );
} | [
"public",
"function",
"iHaveUserWithUsernameEmailAndPassword",
"(",
"$",
"username",
",",
"$",
"email",
",",
"$",
"password",
")",
"{",
"$",
"this",
"->",
"getUserManager",
"(",
")",
"->",
"ensureUserExists",
"(",
"$",
"username",
",",
"$",
"email",
",",
"$",
"password",
")",
";",
"}"
] | @Given there is a User with name :username, email :email and password :password
Ensures a user exists with given username/email/password, creating a new one if necessary.
@return \eZ\Publish\API\Repository\Values\User\User | [
"@Given",
"there",
"is",
"a",
"User",
"with",
"name",
":",
"username",
"email",
":",
"email",
"and",
"password",
":",
"password"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/User.php#L42-L45 |
ezsystems/BehatBundle | Context/Object/User.php | User.iHaveUserInGroup | public function iHaveUserInGroup( $username, $parentGroupName )
{
$email = $this->findNonExistingUserEmail( $username );
$password = $this->getUserManager()->getDefaultPassword();
$user = $this->getUserManager()->ensureUserExists( $username, $email, $password, $parentGroupName );
$this->addValuesToKeyMap( $email, $user->email );
} | php | public function iHaveUserInGroup( $username, $parentGroupName )
{
$email = $this->findNonExistingUserEmail( $username );
$password = $this->getUserManager()->getDefaultPassword();
$user = $this->getUserManager()->ensureUserExists( $username, $email, $password, $parentGroupName );
$this->addValuesToKeyMap( $email, $user->email );
} | [
"public",
"function",
"iHaveUserInGroup",
"(",
"$",
"username",
",",
"$",
"parentGroupName",
")",
"{",
"$",
"email",
"=",
"$",
"this",
"->",
"findNonExistingUserEmail",
"(",
"$",
"username",
")",
";",
"$",
"password",
"=",
"$",
"this",
"->",
"getUserManager",
"(",
")",
"->",
"getDefaultPassword",
"(",
")",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"getUserManager",
"(",
")",
"->",
"ensureUserExists",
"(",
"$",
"username",
",",
"$",
"email",
",",
"$",
"password",
",",
"$",
"parentGroupName",
")",
";",
"$",
"this",
"->",
"addValuesToKeyMap",
"(",
"$",
"email",
",",
"$",
"user",
"->",
"email",
")",
";",
"}"
] | @Given there is a User with name :username in :parentGroup group
Ensures a user with username ':username' exists as a child of ':parentGroup' user group, can create either one.
@return \eZ\Publish\API\Repository\Values\User\User | [
"@Given",
"there",
"is",
"a",
"User",
"with",
"name",
":",
"username",
"in",
":",
"parentGroup",
"group"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/User.php#L54-L60 |
ezsystems/BehatBundle | Context/Object/User.php | User.iHaveUserWithFields | public function iHaveUserWithFields( $username, TableNode $table )
{
$fieldsTable = $table->getTable();
array_shift( $fieldsTable );
$fields = array();
foreach ( $fieldsTable as $fieldRow )
{
$fields[ $fieldRow[0] ] = $fieldRow[1];
}
$password = isset( $fields['password'] ) ? $fields['password'] : $username;
$email = isset( $fields['email'] ) ? $fields['email'] : $this->findNonExistingUserEmail( $username );
// first, ensure the user exists
$user = $this->getUserManager()->ensureUserExists( $username, $email, $password );
// then, update with fields
$this->getUserManager()->updateUser( $user, $fields );
} | php | public function iHaveUserWithFields( $username, TableNode $table )
{
$fieldsTable = $table->getTable();
array_shift( $fieldsTable );
$fields = array();
foreach ( $fieldsTable as $fieldRow )
{
$fields[ $fieldRow[0] ] = $fieldRow[1];
}
$password = isset( $fields['password'] ) ? $fields['password'] : $username;
$email = isset( $fields['email'] ) ? $fields['email'] : $this->findNonExistingUserEmail( $username );
// first, ensure the user exists
$user = $this->getUserManager()->ensureUserExists( $username, $email, $password );
// then, update with fields
$this->getUserManager()->updateUser( $user, $fields );
} | [
"public",
"function",
"iHaveUserWithFields",
"(",
"$",
"username",
",",
"TableNode",
"$",
"table",
")",
"{",
"$",
"fieldsTable",
"=",
"$",
"table",
"->",
"getTable",
"(",
")",
";",
"array_shift",
"(",
"$",
"fieldsTable",
")",
";",
"$",
"fields",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"fieldsTable",
"as",
"$",
"fieldRow",
")",
"{",
"$",
"fields",
"[",
"$",
"fieldRow",
"[",
"0",
"]",
"]",
"=",
"$",
"fieldRow",
"[",
"1",
"]",
";",
"}",
"$",
"password",
"=",
"isset",
"(",
"$",
"fields",
"[",
"'password'",
"]",
")",
"?",
"$",
"fields",
"[",
"'password'",
"]",
":",
"$",
"username",
";",
"$",
"email",
"=",
"isset",
"(",
"$",
"fields",
"[",
"'email'",
"]",
")",
"?",
"$",
"fields",
"[",
"'email'",
"]",
":",
"$",
"this",
"->",
"findNonExistingUserEmail",
"(",
"$",
"username",
")",
";",
"// first, ensure the user exists",
"$",
"user",
"=",
"$",
"this",
"->",
"getUserManager",
"(",
")",
"->",
"ensureUserExists",
"(",
"$",
"username",
",",
"$",
"email",
",",
"$",
"password",
")",
";",
"// then, update with fields",
"$",
"this",
"->",
"getUserManager",
"(",
")",
"->",
"updateUser",
"(",
"$",
"user",
",",
"$",
"fields",
")",
";",
"}"
] | @Given there is a User with name :username with the following fields:
Ensures a user exists with the values provided in the fields/value table. example:
| Name | value |
| email | testuser@ez.no |
| password | testuser |
| first_name | Test |
| last_name | User |
@return \eZ\Publish\API\Repository\Values\User\User | [
"@Given",
"there",
"is",
"a",
"User",
"with",
"name",
":",
"username",
"with",
"the",
"following",
"fields",
":"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/User.php#L86-L104 |
ezsystems/BehatBundle | Context/Object/User.php | User.iHaveUserWithId | public function iHaveUserWithId( $id )
{
$name = $this->findNonExistingUserName();
$user = $this->getUserManager()->ensureUserExists( $name );
$this->addValuesToKeyMap( $id, $user->id );
} | php | public function iHaveUserWithId( $id )
{
$name = $this->findNonExistingUserName();
$user = $this->getUserManager()->ensureUserExists( $name );
$this->addValuesToKeyMap( $id, $user->id );
} | [
"public",
"function",
"iHaveUserWithId",
"(",
"$",
"id",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"findNonExistingUserName",
"(",
")",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"getUserManager",
"(",
")",
"->",
"ensureUserExists",
"(",
"$",
"name",
")",
";",
"$",
"this",
"->",
"addValuesToKeyMap",
"(",
"$",
"id",
",",
"$",
"user",
"->",
"id",
")",
";",
"}"
] | @Given there is a User with id :id
Makes user a user with (mapped) id ':id' exists | [
"@Given",
"there",
"is",
"a",
"User",
"with",
"id",
":",
"id"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/User.php#L131-L136 |
ezsystems/BehatBundle | Context/Object/User.php | User.iHaveUserWithIdInGroup | public function iHaveUserWithIdInGroup( $username, $id, $parentGroup )
{
$user = $this->getUserManager()->ensureUserExists( $username, $parentGroup );
$this->addValuesToMap( $id, $user->id );
} | php | public function iHaveUserWithIdInGroup( $username, $id, $parentGroup )
{
$user = $this->getUserManager()->ensureUserExists( $username, $parentGroup );
$this->addValuesToMap( $id, $user->id );
} | [
"public",
"function",
"iHaveUserWithIdInGroup",
"(",
"$",
"username",
",",
"$",
"id",
",",
"$",
"parentGroup",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getUserManager",
"(",
")",
"->",
"ensureUserExists",
"(",
"$",
"username",
",",
"$",
"parentGroup",
")",
";",
"$",
"this",
"->",
"addValuesToMap",
"(",
"$",
"id",
",",
"$",
"user",
"->",
"id",
")",
";",
"}"
] | @Given there is a User with name :username with id :id in :parentGroup group
Ensures a user with username ':username' and id ':id' exists as a child of ':parentGroup' user group, can create either one. | [
"@Given",
"there",
"is",
"a",
"User",
"with",
"name",
":",
"username",
"with",
"id",
":",
"id",
"in",
":",
"parentGroup",
"group"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/User.php#L143-L147 |
ezsystems/BehatBundle | Context/Object/User.php | User.iHaveTheFollowingUsers | public function iHaveTheFollowingUsers( TableNode $table )
{
$users = $table->getTable();
array_shift( $users );
foreach ( $users as $user )
{
// array( [0] => userName, [1] => groupName );
$this->getUserManager()->ensureUserExists( $user[0], $user[1] );
}
} | php | public function iHaveTheFollowingUsers( TableNode $table )
{
$users = $table->getTable();
array_shift( $users );
foreach ( $users as $user )
{
// array( [0] => userName, [1] => groupName );
$this->getUserManager()->ensureUserExists( $user[0], $user[1] );
}
} | [
"public",
"function",
"iHaveTheFollowingUsers",
"(",
"TableNode",
"$",
"table",
")",
"{",
"$",
"users",
"=",
"$",
"table",
"->",
"getTable",
"(",
")",
";",
"array_shift",
"(",
"$",
"users",
")",
";",
"foreach",
"(",
"$",
"users",
"as",
"$",
"user",
")",
"{",
"// array( [0] => userName, [1] => groupName );",
"$",
"this",
"->",
"getUserManager",
"(",
")",
"->",
"ensureUserExists",
"(",
"$",
"user",
"[",
"0",
"]",
",",
"$",
"user",
"[",
"1",
"]",
")",
";",
"}",
"}"
] | @Given there are the following Users:
Make sure that users in the provided table exist in their respective parent group. Example:
| username | parentGroup |
| testUser1 | Members |
| testUser2 | Editors |
| testUser3 | NewParent | # Both user and group should be created | [
"@Given",
"there",
"are",
"the",
"following",
"Users",
":"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/User.php#L158-L168 |
ezsystems/BehatBundle | Context/Object/User.php | User.assertUserWithNameExistsInGroup | public function assertUserWithNameExistsInGroup( $username, $parentGroup )
{
Assertion::assertTrue(
$this->getUserManager()->checkUserExistenceByUsername( $username, $parentGroup ),
"Couldn't find User with name '$username' in parent group '$parentGroup'."
);
} | php | public function assertUserWithNameExistsInGroup( $username, $parentGroup )
{
Assertion::assertTrue(
$this->getUserManager()->checkUserExistenceByUsername( $username, $parentGroup ),
"Couldn't find User with name '$username' in parent group '$parentGroup'."
);
} | [
"public",
"function",
"assertUserWithNameExistsInGroup",
"(",
"$",
"username",
",",
"$",
"parentGroup",
")",
"{",
"Assertion",
"::",
"assertTrue",
"(",
"$",
"this",
"->",
"getUserManager",
"(",
")",
"->",
"checkUserExistenceByUsername",
"(",
"$",
"username",
",",
"$",
"parentGroup",
")",
",",
"\"Couldn't find User with name '$username' in parent group '$parentGroup'.\"",
")",
";",
"}"
] | @Then User with name :username exists in group :parentGroup
@Then User with name :username exists in :parentGroup group
Checks that user ':username' exists as a child of group ':parentGroup' | [
"@Then",
"User",
"with",
"name",
":",
"username",
"exists",
"in",
"group",
":",
"parentGroup",
"@Then",
"User",
"with",
"name",
":",
"username",
"exists",
"in",
":",
"parentGroup",
"group"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/User.php#L203-L209 |
ezsystems/BehatBundle | Context/Object/User.php | User.assertUserWithNameDoesntExistInGroup | public function assertUserWithNameDoesntExistInGroup( $username, $parentGroup )
{
Assertion::assertFalse(
$this->getUserManager()->checkUserExistenceByUsername( $username, $parentGroup ),
"User with name '$username' was found in parent group '$parentGroup'."
);
} | php | public function assertUserWithNameDoesntExistInGroup( $username, $parentGroup )
{
Assertion::assertFalse(
$this->getUserManager()->checkUserExistenceByUsername( $username, $parentGroup ),
"User with name '$username' was found in parent group '$parentGroup'."
);
} | [
"public",
"function",
"assertUserWithNameDoesntExistInGroup",
"(",
"$",
"username",
",",
"$",
"parentGroup",
")",
"{",
"Assertion",
"::",
"assertFalse",
"(",
"$",
"this",
"->",
"getUserManager",
"(",
")",
"->",
"checkUserExistenceByUsername",
"(",
"$",
"username",
",",
"$",
"parentGroup",
")",
",",
"\"User with name '$username' was found in parent group '$parentGroup'.\"",
")",
";",
"}"
] | @Then User with name :username doesn't exist in group :parentGroup
@Then User with name :username doesn't exist in :parentGroup group
Checks that user ':username' does not exist as a child of group ':parentGroup' | [
"@Then",
"User",
"with",
"name",
":",
"username",
"doesn",
"t",
"exist",
"in",
"group",
":",
"parentGroup",
"@Then",
"User",
"with",
"name",
":",
"username",
"doesn",
"t",
"exist",
"in",
":",
"parentGroup",
"group"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/User.php#L217-L223 |
ezsystems/BehatBundle | Context/Object/User.php | User.assertUserWithNameDoesntExistInGroups | public function assertUserWithNameDoesntExistInGroups( $username, TableNode $table )
{
$groups = $table->getTable();
array_shift( $groups );
foreach ( $groups as $group )
{
$parentGroupName = $group[0];
Assertion::assertFalse(
$this->getUserManager()->checkUserExistenceByUsername( $username, $parentGroupName ),
"User with name '$username' was found in parent group '$parentGroupName'."
);
}
} | php | public function assertUserWithNameDoesntExistInGroups( $username, TableNode $table )
{
$groups = $table->getTable();
array_shift( $groups );
foreach ( $groups as $group )
{
$parentGroupName = $group[0];
Assertion::assertFalse(
$this->getUserManager()->checkUserExistenceByUsername( $username, $parentGroupName ),
"User with name '$username' was found in parent group '$parentGroupName'."
);
}
} | [
"public",
"function",
"assertUserWithNameDoesntExistInGroups",
"(",
"$",
"username",
",",
"TableNode",
"$",
"table",
")",
"{",
"$",
"groups",
"=",
"$",
"table",
"->",
"getTable",
"(",
")",
";",
"array_shift",
"(",
"$",
"groups",
")",
";",
"foreach",
"(",
"$",
"groups",
"as",
"$",
"group",
")",
"{",
"$",
"parentGroupName",
"=",
"$",
"group",
"[",
"0",
"]",
";",
"Assertion",
"::",
"assertFalse",
"(",
"$",
"this",
"->",
"getUserManager",
"(",
")",
"->",
"checkUserExistenceByUsername",
"(",
"$",
"username",
",",
"$",
"parentGroupName",
")",
",",
"\"User with name '$username' was found in parent group '$parentGroupName'.\"",
")",
";",
"}",
"}"
] | @Then User with name :username doesn't exist in the following groups:
Checks that user ':username' does not exist in any of the provided groups. Example:
| parentGroup |
| Partners |
| Anonymous Users |
| Editors |
| Administrator users | | [
"@Then",
"User",
"with",
"name",
":",
"username",
"doesn",
"t",
"exist",
"in",
"the",
"following",
"groups",
":"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/User.php#L235-L247 |
ezsystems/BehatBundle | Context/Object/User.php | User.assertUserWithNameExistsWithFields | public function assertUserWithNameExistsWithFields( $username, TableNode $table )
{
Assertion::assertTrue(
$this->getUserManager()->checkUserExistenceByUsername( $username ),
"Couldn't find User with name '$username'."
);
$user = $this->getUserManager()->loadUserByLogin( $username );
$fieldsTable = $table->getTable();
array_shift( $fieldsTable );
$updateFields = array();
foreach ( $fieldsTable as $fieldRow )
{
$fieldName = $fieldRow[0];
$expectedValue = $fieldRow[1];
$assertErrorMsg = "Field '$fieldName' did not contain expected value '$expectedValue'.";
switch ( $fieldName )
{
case 'email':
$fieldValue = $user->email;
break;
case 'password':
$fieldValue = $this->getUserManager()->verifyPasswordHash(
$username,
$expectedValue,
$user->hashAlgorithm,
$user->passwordHash
);
$assertErrorMsg = "Field '$fieldName' password hash '{$user->passwordHash}' did not validate against provided password '$expectedValue'";
$expectedValue = true;
break;
default:
$fieldValue = $user->getFieldValue( $fieldName );
}
Assertion::assertEquals(
$expectedValue,
$fieldValue,
$assertErrorMsg
);
}
} | php | public function assertUserWithNameExistsWithFields( $username, TableNode $table )
{
Assertion::assertTrue(
$this->getUserManager()->checkUserExistenceByUsername( $username ),
"Couldn't find User with name '$username'."
);
$user = $this->getUserManager()->loadUserByLogin( $username );
$fieldsTable = $table->getTable();
array_shift( $fieldsTable );
$updateFields = array();
foreach ( $fieldsTable as $fieldRow )
{
$fieldName = $fieldRow[0];
$expectedValue = $fieldRow[1];
$assertErrorMsg = "Field '$fieldName' did not contain expected value '$expectedValue'.";
switch ( $fieldName )
{
case 'email':
$fieldValue = $user->email;
break;
case 'password':
$fieldValue = $this->getUserManager()->verifyPasswordHash(
$username,
$expectedValue,
$user->hashAlgorithm,
$user->passwordHash
);
$assertErrorMsg = "Field '$fieldName' password hash '{$user->passwordHash}' did not validate against provided password '$expectedValue'";
$expectedValue = true;
break;
default:
$fieldValue = $user->getFieldValue( $fieldName );
}
Assertion::assertEquals(
$expectedValue,
$fieldValue,
$assertErrorMsg
);
}
} | [
"public",
"function",
"assertUserWithNameExistsWithFields",
"(",
"$",
"username",
",",
"TableNode",
"$",
"table",
")",
"{",
"Assertion",
"::",
"assertTrue",
"(",
"$",
"this",
"->",
"getUserManager",
"(",
")",
"->",
"checkUserExistenceByUsername",
"(",
"$",
"username",
")",
",",
"\"Couldn't find User with name '$username'.\"",
")",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"getUserManager",
"(",
")",
"->",
"loadUserByLogin",
"(",
"$",
"username",
")",
";",
"$",
"fieldsTable",
"=",
"$",
"table",
"->",
"getTable",
"(",
")",
";",
"array_shift",
"(",
"$",
"fieldsTable",
")",
";",
"$",
"updateFields",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"fieldsTable",
"as",
"$",
"fieldRow",
")",
"{",
"$",
"fieldName",
"=",
"$",
"fieldRow",
"[",
"0",
"]",
";",
"$",
"expectedValue",
"=",
"$",
"fieldRow",
"[",
"1",
"]",
";",
"$",
"assertErrorMsg",
"=",
"\"Field '$fieldName' did not contain expected value '$expectedValue'.\"",
";",
"switch",
"(",
"$",
"fieldName",
")",
"{",
"case",
"'email'",
":",
"$",
"fieldValue",
"=",
"$",
"user",
"->",
"email",
";",
"break",
";",
"case",
"'password'",
":",
"$",
"fieldValue",
"=",
"$",
"this",
"->",
"getUserManager",
"(",
")",
"->",
"verifyPasswordHash",
"(",
"$",
"username",
",",
"$",
"expectedValue",
",",
"$",
"user",
"->",
"hashAlgorithm",
",",
"$",
"user",
"->",
"passwordHash",
")",
";",
"$",
"assertErrorMsg",
"=",
"\"Field '$fieldName' password hash '{$user->passwordHash}' did not validate against provided password '$expectedValue'\"",
";",
"$",
"expectedValue",
"=",
"true",
";",
"break",
";",
"default",
":",
"$",
"fieldValue",
"=",
"$",
"user",
"->",
"getFieldValue",
"(",
"$",
"fieldName",
")",
";",
"}",
"Assertion",
"::",
"assertEquals",
"(",
"$",
"expectedValue",
",",
"$",
"fieldValue",
",",
"$",
"assertErrorMsg",
")",
";",
"}",
"}"
] | @Then User with name :username has the following fields:
@Then User with name :username exists with the following fields:
Checks that user ':username' exists with the values provided in the field/value table. example:
| Name | value |
| email | testuser@ez.no |
| password | testuser |
| first_name | Test |
| last_name | User | | [
"@Then",
"User",
"with",
"name",
":",
"username",
"has",
"the",
"following",
"fields",
":",
"@Then",
"User",
"with",
"name",
":",
"username",
"exists",
"with",
"the",
"following",
"fields",
":"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/User.php#L260-L302 |
ezsystems/BehatBundle | Context/Object/User.php | User.findNonExistingUserEmail | private function findNonExistingUserEmail( $username = 'User' )
{
$userManager = $this->getUserManager();
$email = "${username}@ez.no";
if ( $userManager->checkUserExistenceByEmail( $email ) )
{
return $email;
}
for ( $i = 0; $i < 20; $i++ )
{
$email = uniqid('User#', true) . '@ez.no';
if ( !$userManager->checkUserExistenceByEmail( $email ) )
{
return $email;
}
}
throw new \Exception( 'Possible endless loop when attempting to find a new email for User.' );
} | php | private function findNonExistingUserEmail( $username = 'User' )
{
$userManager = $this->getUserManager();
$email = "${username}@ez.no";
if ( $userManager->checkUserExistenceByEmail( $email ) )
{
return $email;
}
for ( $i = 0; $i < 20; $i++ )
{
$email = uniqid('User#', true) . '@ez.no';
if ( !$userManager->checkUserExistenceByEmail( $email ) )
{
return $email;
}
}
throw new \Exception( 'Possible endless loop when attempting to find a new email for User.' );
} | [
"private",
"function",
"findNonExistingUserEmail",
"(",
"$",
"username",
"=",
"'User'",
")",
"{",
"$",
"userManager",
"=",
"$",
"this",
"->",
"getUserManager",
"(",
")",
";",
"$",
"email",
"=",
"\"${username}@ez.no\"",
";",
"if",
"(",
"$",
"userManager",
"->",
"checkUserExistenceByEmail",
"(",
"$",
"email",
")",
")",
"{",
"return",
"$",
"email",
";",
"}",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"20",
";",
"$",
"i",
"++",
")",
"{",
"$",
"email",
"=",
"uniqid",
"(",
"'User#'",
",",
"true",
")",
".",
"'@ez.no'",
";",
"if",
"(",
"!",
"$",
"userManager",
"->",
"checkUserExistenceByEmail",
"(",
"$",
"email",
")",
")",
"{",
"return",
"$",
"email",
";",
"}",
"}",
"throw",
"new",
"\\",
"Exception",
"(",
"'Possible endless loop when attempting to find a new email for User.'",
")",
";",
"}"
] | Find a non existing User email
@return string A not used email
@throws \Exception Possible endless loop | [
"Find",
"a",
"non",
"existing",
"User",
"email"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/User.php#L311-L330 |
ezsystems/BehatBundle | Context/Object/User.php | User.findNonExistingUserName | private function findNonExistingUserName()
{
$userManager = $this->getUserManager();
for ( $i = 0; $i < 20; $i++ )
{
$username = substr(uniqid('User#', true), 0, 15);
if ( !$userManager->checkUserExistenceByUsername( $username ) )
{
return $username;
}
}
throw new \Exception( 'Possible endless loop when attempting to find a new name for User.' );
} | php | private function findNonExistingUserName()
{
$userManager = $this->getUserManager();
for ( $i = 0; $i < 20; $i++ )
{
$username = substr(uniqid('User#', true), 0, 15);
if ( !$userManager->checkUserExistenceByUsername( $username ) )
{
return $username;
}
}
throw new \Exception( 'Possible endless loop when attempting to find a new name for User.' );
} | [
"private",
"function",
"findNonExistingUserName",
"(",
")",
"{",
"$",
"userManager",
"=",
"$",
"this",
"->",
"getUserManager",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"20",
";",
"$",
"i",
"++",
")",
"{",
"$",
"username",
"=",
"substr",
"(",
"uniqid",
"(",
"'User#'",
",",
"true",
")",
",",
"0",
",",
"15",
")",
";",
"if",
"(",
"!",
"$",
"userManager",
"->",
"checkUserExistenceByUsername",
"(",
"$",
"username",
")",
")",
"{",
"return",
"$",
"username",
";",
"}",
"}",
"throw",
"new",
"\\",
"Exception",
"(",
"'Possible endless loop when attempting to find a new name for User.'",
")",
";",
"}"
] | Find a non existing User name
@return string A not used name
@throws \Exception Possible endless loop | [
"Find",
"a",
"non",
"existing",
"User",
"name"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/User.php#L339-L352 |
ezsystems/BehatBundle | Context/Object/ContentTypeGroup.php | ContentTypeGroup.ensureContentTypeGroupExists | public function ensureContentTypeGroupExists($identifier)
{
/** @var \eZ\Publish\API\Repository\ContentTypeService */
$contentTypeService = $this->contentTypeService;
$found = false;
// verify if the content type group exists
try {
$contentTypeGroup = $contentTypeService->loadContentTypeGroupByIdentifier($identifier);
$found = true;
} catch (ApiExceptions\NotFoundException $e) {
// other wise create it
$ContentTypeGroupCreateStruct = $contentTypeService->newContentTypeGroupCreateStruct($identifier);
$contentTypeGroup = $contentTypeService->createContentTypeGroup($ContentTypeGroupCreateStruct);
}
return array(
'found' => $found,
'contentTypeGroup' => $contentTypeGroup
);
} | php | public function ensureContentTypeGroupExists($identifier)
{
/** @var \eZ\Publish\API\Repository\ContentTypeService */
$contentTypeService = $this->contentTypeService;
$found = false;
// verify if the content type group exists
try {
$contentTypeGroup = $contentTypeService->loadContentTypeGroupByIdentifier($identifier);
$found = true;
} catch (ApiExceptions\NotFoundException $e) {
// other wise create it
$ContentTypeGroupCreateStruct = $contentTypeService->newContentTypeGroupCreateStruct($identifier);
$contentTypeGroup = $contentTypeService->createContentTypeGroup($ContentTypeGroupCreateStruct);
}
return array(
'found' => $found,
'contentTypeGroup' => $contentTypeGroup
);
} | [
"public",
"function",
"ensureContentTypeGroupExists",
"(",
"$",
"identifier",
")",
"{",
"/** @var \\eZ\\Publish\\API\\Repository\\ContentTypeService */",
"$",
"contentTypeService",
"=",
"$",
"this",
"->",
"contentTypeService",
";",
"$",
"found",
"=",
"false",
";",
"// verify if the content type group exists",
"try",
"{",
"$",
"contentTypeGroup",
"=",
"$",
"contentTypeService",
"->",
"loadContentTypeGroupByIdentifier",
"(",
"$",
"identifier",
")",
";",
"$",
"found",
"=",
"true",
";",
"}",
"catch",
"(",
"ApiExceptions",
"\\",
"NotFoundException",
"$",
"e",
")",
"{",
"// other wise create it",
"$",
"ContentTypeGroupCreateStruct",
"=",
"$",
"contentTypeService",
"->",
"newContentTypeGroupCreateStruct",
"(",
"$",
"identifier",
")",
";",
"$",
"contentTypeGroup",
"=",
"$",
"contentTypeService",
"->",
"createContentTypeGroup",
"(",
"$",
"ContentTypeGroupCreateStruct",
")",
";",
"}",
"return",
"array",
"(",
"'found'",
"=>",
"$",
"found",
",",
"'contentTypeGroup'",
"=>",
"$",
"contentTypeGroup",
")",
";",
"}"
] | @Given there is a Content Type Group with identifier :identifier
Ensures a content type group exists, creating a new one if it doesn't.
@return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup | [
"@Given",
"there",
"is",
"a",
"Content",
"Type",
"Group",
"with",
"identifier",
":",
"identifier"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/ContentTypeGroup.php#L48-L68 |
ezsystems/BehatBundle | Context/Object/ContentTypeGroup.php | ContentTypeGroup.ensureContentTypeGroupDoesntExist | public function ensureContentTypeGroupDoesntExist($identifier)
{
/** @var \eZ\Publish\API\Repository\ContentTypeService */
$contentTypeService = $this->contentTypeService;
// attempt to delete the content type group with the identifier
try {
$contentTypeService->deleteContentTypeGroup(
$contentTypeService->loadContentTypeGroupByIdentifier($identifier)
);
} catch (ApiExceptions\NotFoundException $e) {
// nothing to do
}
} | php | public function ensureContentTypeGroupDoesntExist($identifier)
{
/** @var \eZ\Publish\API\Repository\ContentTypeService */
$contentTypeService = $this->contentTypeService;
// attempt to delete the content type group with the identifier
try {
$contentTypeService->deleteContentTypeGroup(
$contentTypeService->loadContentTypeGroupByIdentifier($identifier)
);
} catch (ApiExceptions\NotFoundException $e) {
// nothing to do
}
} | [
"public",
"function",
"ensureContentTypeGroupDoesntExist",
"(",
"$",
"identifier",
")",
"{",
"/** @var \\eZ\\Publish\\API\\Repository\\ContentTypeService */",
"$",
"contentTypeService",
"=",
"$",
"this",
"->",
"contentTypeService",
";",
"// attempt to delete the content type group with the identifier",
"try",
"{",
"$",
"contentTypeService",
"->",
"deleteContentTypeGroup",
"(",
"$",
"contentTypeService",
"->",
"loadContentTypeGroupByIdentifier",
"(",
"$",
"identifier",
")",
")",
";",
"}",
"catch",
"(",
"ApiExceptions",
"\\",
"NotFoundException",
"$",
"e",
")",
"{",
"// nothing to do",
"}",
"}"
] | @Given there isn't a Content Type Group with identifier :identifier
Ensures a content type group does not exist, removing it if necessary. | [
"@Given",
"there",
"isn",
"t",
"a",
"Content",
"Type",
"Group",
"with",
"identifier",
":",
"identifier"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/ContentTypeGroup.php#L75-L89 |
ezsystems/BehatBundle | Context/Object/ContentTypeGroup.php | ContentTypeGroup.ensureContentTypeGroupsExists | public function ensureContentTypeGroupsExists(TableNode $table)
{
$contentTypeGroups = $table->getTable();
array_shift($contentTypeGroups);
foreach ($contentTypeGroups as $contentTypeGroup) {
$this->ensureContentTypeGroupExists($contentTypeGroup[0]);
}
} | php | public function ensureContentTypeGroupsExists(TableNode $table)
{
$contentTypeGroups = $table->getTable();
array_shift($contentTypeGroups);
foreach ($contentTypeGroups as $contentTypeGroup) {
$this->ensureContentTypeGroupExists($contentTypeGroup[0]);
}
} | [
"public",
"function",
"ensureContentTypeGroupsExists",
"(",
"TableNode",
"$",
"table",
")",
"{",
"$",
"contentTypeGroups",
"=",
"$",
"table",
"->",
"getTable",
"(",
")",
";",
"array_shift",
"(",
"$",
"contentTypeGroups",
")",
";",
"foreach",
"(",
"$",
"contentTypeGroups",
"as",
"$",
"contentTypeGroup",
")",
"{",
"$",
"this",
"->",
"ensureContentTypeGroupExists",
"(",
"$",
"contentTypeGroup",
"[",
"0",
"]",
")",
";",
"}",
"}"
] | @Given there are the following Content Type Groups:
Make sure that content type groups in the provided table exist, by identifier. Example:
| group |
| testContentTypeGroup1 |
| testContentTypeGroup2 |
| testContentTypeGroup3 | | [
"@Given",
"there",
"are",
"the",
"following",
"Content",
"Type",
"Groups",
":"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/ContentTypeGroup.php#L100-L108 |
ezsystems/BehatBundle | Context/Object/ContentTypeGroup.php | ContentTypeGroup.checkContentTypeGroupExistenceByIdentifier | public function checkContentTypeGroupExistenceByIdentifier($identifier)
{
/** @var \eZ\Publish\API\Repository\ContentTypeService */
$contentTypeService = $this->contentTypeService;
// attempt to load the content type group with the identifier
try {
$contentTypeService->loadContentTypeGroupByIdentifier($identifier);
return true;
} catch (ApiExceptions\NotFoundException $e) {
return false;
}
} | php | public function checkContentTypeGroupExistenceByIdentifier($identifier)
{
/** @var \eZ\Publish\API\Repository\ContentTypeService */
$contentTypeService = $this->contentTypeService;
// attempt to load the content type group with the identifier
try {
$contentTypeService->loadContentTypeGroupByIdentifier($identifier);
return true;
} catch (ApiExceptions\NotFoundException $e) {
return false;
}
} | [
"public",
"function",
"checkContentTypeGroupExistenceByIdentifier",
"(",
"$",
"identifier",
")",
"{",
"/** @var \\eZ\\Publish\\API\\Repository\\ContentTypeService */",
"$",
"contentTypeService",
"=",
"$",
"this",
"->",
"contentTypeService",
";",
"// attempt to load the content type group with the identifier",
"try",
"{",
"$",
"contentTypeService",
"->",
"loadContentTypeGroupByIdentifier",
"(",
"$",
"identifier",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"ApiExceptions",
"\\",
"NotFoundException",
"$",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}"
] | Checks if the ContentTypeGroup with $identifier exists
@param string $identifier Identifier of the possible content
@return boolean True if it exists | [
"Checks",
"if",
"the",
"ContentTypeGroup",
"with",
"$identifier",
"exists"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/ContentTypeGroup.php#L161-L173 |
ezsystems/BehatBundle | Context/Object/ContentTypeGroup.php | ContentTypeGroup.findNonExistingContentTypeGroupIdentifier | private function findNonExistingContentTypeGroupIdentifier()
{
$i = 0;
while ($i++ < 20) {
$identifier = 'ctg' . rand(10000, 99999);
if (!$this->checkContentTypeGroupExistenceByIdentifier($identifier)) {
return $identifier;
}
}
throw new \Exception('Possible endless loop when attempting to find a new identifier to ContentTypeGroups');
} | php | private function findNonExistingContentTypeGroupIdentifier()
{
$i = 0;
while ($i++ < 20) {
$identifier = 'ctg' . rand(10000, 99999);
if (!$this->checkContentTypeGroupExistenceByIdentifier($identifier)) {
return $identifier;
}
}
throw new \Exception('Possible endless loop when attempting to find a new identifier to ContentTypeGroups');
} | [
"private",
"function",
"findNonExistingContentTypeGroupIdentifier",
"(",
")",
"{",
"$",
"i",
"=",
"0",
";",
"while",
"(",
"$",
"i",
"++",
"<",
"20",
")",
"{",
"$",
"identifier",
"=",
"'ctg'",
".",
"rand",
"(",
"10000",
",",
"99999",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"checkContentTypeGroupExistenceByIdentifier",
"(",
"$",
"identifier",
")",
")",
"{",
"return",
"$",
"identifier",
";",
"}",
"}",
"throw",
"new",
"\\",
"Exception",
"(",
"'Possible endless loop when attempting to find a new identifier to ContentTypeGroups'",
")",
";",
"}"
] | Find a non existing ContentTypeGroup identifier
@return string A not used identifier
@throws \Exception Possible endless loop | [
"Find",
"a",
"non",
"existing",
"ContentTypeGroup",
"identifier"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/ContentTypeGroup.php#L182-L193 |
ezsystems/BehatBundle | Context/Object/UserGroup.php | UserGroup.iHaveUserGroupWithId | public function iHaveUserGroupWithId( $id )
{
$name = $this->findNonExistingUserGroupName();
$userGroup = $this->getUserGroupManager()->ensureUserGroupExists( $name );
$this->addValuesToKeyMap( $id, $userGroup->id );
} | php | public function iHaveUserGroupWithId( $id )
{
$name = $this->findNonExistingUserGroupName();
$userGroup = $this->getUserGroupManager()->ensureUserGroupExists( $name );
$this->addValuesToKeyMap( $id, $userGroup->id );
} | [
"public",
"function",
"iHaveUserGroupWithId",
"(",
"$",
"id",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"findNonExistingUserGroupName",
"(",
")",
";",
"$",
"userGroup",
"=",
"$",
"this",
"->",
"getUserGroupManager",
"(",
")",
"->",
"ensureUserGroupExists",
"(",
"$",
"name",
")",
";",
"$",
"this",
"->",
"addValuesToKeyMap",
"(",
"$",
"id",
",",
"$",
"userGroup",
"->",
"id",
")",
";",
"}"
] | @Given there is a User Group with id :id
Creates a new user group with a non-existent name, and maps it's id to ':id' | [
"@Given",
"there",
"is",
"a",
"User",
"Group",
"with",
"id",
":",
"id"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/UserGroup.php#L71-L77 |
ezsystems/BehatBundle | Context/Object/UserGroup.php | UserGroup.iHaveUserGroupWithIdInGroup | public function iHaveUserGroupWithIdInGroup( $name, $id, $parentGroup )
{
$userGroup = $this->getUserGroupManager()->ensureUserGroupExists( $name, $parentGroup );
$this->addValuesToMap( $id, $userGroup->id );
} | php | public function iHaveUserGroupWithIdInGroup( $name, $id, $parentGroup )
{
$userGroup = $this->getUserGroupManager()->ensureUserGroupExists( $name, $parentGroup );
$this->addValuesToMap( $id, $userGroup->id );
} | [
"public",
"function",
"iHaveUserGroupWithIdInGroup",
"(",
"$",
"name",
",",
"$",
"id",
",",
"$",
"parentGroup",
")",
"{",
"$",
"userGroup",
"=",
"$",
"this",
"->",
"getUserGroupManager",
"(",
")",
"->",
"ensureUserGroupExists",
"(",
"$",
"name",
",",
"$",
"parentGroup",
")",
";",
"$",
"this",
"->",
"addValuesToMap",
"(",
"$",
"id",
",",
"$",
"userGroup",
"->",
"id",
")",
";",
"}"
] | @Given there is a User Group with name :name with id :id in :parentGroup group
Ensures a user group with name ':name' exists as a child of group ':parentGroup', mapping it's id to ':id' | [
"@Given",
"there",
"is",
"a",
"User",
"Group",
"with",
"name",
":",
"name",
"with",
"id",
":",
"id",
"in",
":",
"parentGroup",
"group"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/UserGroup.php#L84-L88 |
ezsystems/BehatBundle | Context/Object/UserGroup.php | UserGroup.iHaveTheFollowingUserGroups | public function iHaveTheFollowingUserGroups( TableNode $table )
{
$userGroups = $table->getTable();
array_shift( $userGroups );
foreach ( $userGroups as $userGroup )
{
$this->getUserGroupManager()->ensureUserGroupExists( $userGroup[0], $userGroup[1] );
}
} | php | public function iHaveTheFollowingUserGroups( TableNode $table )
{
$userGroups = $table->getTable();
array_shift( $userGroups );
foreach ( $userGroups as $userGroup )
{
$this->getUserGroupManager()->ensureUserGroupExists( $userGroup[0], $userGroup[1] );
}
} | [
"public",
"function",
"iHaveTheFollowingUserGroups",
"(",
"TableNode",
"$",
"table",
")",
"{",
"$",
"userGroups",
"=",
"$",
"table",
"->",
"getTable",
"(",
")",
";",
"array_shift",
"(",
"$",
"userGroups",
")",
";",
"foreach",
"(",
"$",
"userGroups",
"as",
"$",
"userGroup",
")",
"{",
"$",
"this",
"->",
"getUserGroupManager",
"(",
")",
"->",
"ensureUserGroupExists",
"(",
"$",
"userGroup",
"[",
"0",
"]",
",",
"$",
"userGroup",
"[",
"1",
"]",
")",
";",
"}",
"}"
] | @Given there are the following User Groups:
Make sure that user groups in the provided table exist in their respective parent group. Example:
| childGroup | parentGroup |
| testUserGroup1 | Members | # should create.
| testUserGroup1 | Editors | # should create.
| testUserGroup3 | Test Parent | # parent and child should be created.
| innerGroup3-1 | testUserGroup3 | # should be created inside previous. | [
"@Given",
"there",
"are",
"the",
"following",
"User",
"Groups",
":"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/UserGroup.php#L100-L109 |
ezsystems/BehatBundle | Context/Object/UserGroup.php | UserGroup.assertUserGroupWithNameExistsInGroup | public function assertUserGroupWithNameExistsInGroup( $name, $parentGroup )
{
Assertion::assertTrue(
$this->getUserGroupManager()->checkUserGroupExistenceByName( $name, $parentGroup ),
"Couldn't find UserGroup with name '$name' in parent group '$parentGroup'."
);
} | php | public function assertUserGroupWithNameExistsInGroup( $name, $parentGroup )
{
Assertion::assertTrue(
$this->getUserGroupManager()->checkUserGroupExistenceByName( $name, $parentGroup ),
"Couldn't find UserGroup with name '$name' in parent group '$parentGroup'."
);
} | [
"public",
"function",
"assertUserGroupWithNameExistsInGroup",
"(",
"$",
"name",
",",
"$",
"parentGroup",
")",
"{",
"Assertion",
"::",
"assertTrue",
"(",
"$",
"this",
"->",
"getUserGroupManager",
"(",
")",
"->",
"checkUserGroupExistenceByName",
"(",
"$",
"name",
",",
"$",
"parentGroup",
")",
",",
"\"Couldn't find UserGroup with name '$name' in parent group '$parentGroup'.\"",
")",
";",
"}"
] | @Then User Group with name :name exists in group :parentGroup
@Then User Group with name :name exists in :parentGroup group
Checks that a user group with name ':name' exists as a child of ':parentGroup' | [
"@Then",
"User",
"Group",
"with",
"name",
":",
"name",
"exists",
"in",
"group",
":",
"parentGroup",
"@Then",
"User",
"Group",
"with",
"name",
":",
"name",
"exists",
"in",
":",
"parentGroup",
"group"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/UserGroup.php#L144-L150 |
ezsystems/BehatBundle | Context/Object/UserGroup.php | UserGroup.assertUserGroupWithNameDoesntExistInGroup | public function assertUserGroupWithNameDoesntExistInGroup( $name, $parentGroup )
{
Assertion::assertFalse(
$this->getUserGroupManager()->checkUserGroupExistenceByName( $name, $parentGroup ),
"UserGroup with name '$name' was found in parent group '$parentGroup'."
);
} | php | public function assertUserGroupWithNameDoesntExistInGroup( $name, $parentGroup )
{
Assertion::assertFalse(
$this->getUserGroupManager()->checkUserGroupExistenceByName( $name, $parentGroup ),
"UserGroup with name '$name' was found in parent group '$parentGroup'."
);
} | [
"public",
"function",
"assertUserGroupWithNameDoesntExistInGroup",
"(",
"$",
"name",
",",
"$",
"parentGroup",
")",
"{",
"Assertion",
"::",
"assertFalse",
"(",
"$",
"this",
"->",
"getUserGroupManager",
"(",
")",
"->",
"checkUserGroupExistenceByName",
"(",
"$",
"name",
",",
"$",
"parentGroup",
")",
",",
"\"UserGroup with name '$name' was found in parent group '$parentGroup'.\"",
")",
";",
"}"
] | @Then User Group with name :name doesn't exist in group :parentGroup
@Then User Group with name :name doesn't exist in :parentGroup group
Checks that a user group with name ':name' does not exist as a child of ':parentGroup' | [
"@Then",
"User",
"Group",
"with",
"name",
":",
"name",
"doesn",
"t",
"exist",
"in",
"group",
":",
"parentGroup",
"@Then",
"User",
"Group",
"with",
"name",
":",
"name",
"doesn",
"t",
"exist",
"in",
":",
"parentGroup",
"group"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/UserGroup.php#L158-L164 |
ezsystems/BehatBundle | Context/Object/UserGroup.php | UserGroup.findNonExistingUserGroupId | private function findNonExistingUserGroupId()
{
$userGroupManager = $this->getUserGroupManager();
for ( $i = 0; $i < 20; $i++ )
{
$id = uniqid('UserGroup#', true);
if ( !$userGroupManager()->checkUserGroupExistence( $id ) )
{
return $id;
}
}
throw new \Exception( 'Possible endless loop when attempting to find a new id for UserGroup.' );
} | php | private function findNonExistingUserGroupId()
{
$userGroupManager = $this->getUserGroupManager();
for ( $i = 0; $i < 20; $i++ )
{
$id = uniqid('UserGroup#', true);
if ( !$userGroupManager()->checkUserGroupExistence( $id ) )
{
return $id;
}
}
throw new \Exception( 'Possible endless loop when attempting to find a new id for UserGroup.' );
} | [
"private",
"function",
"findNonExistingUserGroupId",
"(",
")",
"{",
"$",
"userGroupManager",
"=",
"$",
"this",
"->",
"getUserGroupManager",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"20",
";",
"$",
"i",
"++",
")",
"{",
"$",
"id",
"=",
"uniqid",
"(",
"'UserGroup#'",
",",
"true",
")",
";",
"if",
"(",
"!",
"$",
"userGroupManager",
"(",
")",
"->",
"checkUserGroupExistence",
"(",
"$",
"id",
")",
")",
"{",
"return",
"$",
"id",
";",
"}",
"}",
"throw",
"new",
"\\",
"Exception",
"(",
"'Possible endless loop when attempting to find a new id for UserGroup.'",
")",
";",
"}"
] | Find an non existent UserGroup id
@return int Non existing id
@throws \Exception Possible endless loop | [
"Find",
"an",
"non",
"existent",
"UserGroup",
"id"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/UserGroup.php#L173-L186 |
ezsystems/BehatBundle | Context/Object/FieldType.php | FieldType.createContentTypeWithRequiredFieldType | public function createContentTypeWithRequiredFieldType( $fieldType, $name = null )
{
return $this->getFieldTypeManager()->createField( $fieldType, $name, true );
} | php | public function createContentTypeWithRequiredFieldType( $fieldType, $name = null )
{
return $this->getFieldTypeManager()->createField( $fieldType, $name, true );
} | [
"public",
"function",
"createContentTypeWithRequiredFieldType",
"(",
"$",
"fieldType",
",",
"$",
"name",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getFieldTypeManager",
"(",
")",
"->",
"createField",
"(",
"$",
"fieldType",
",",
"$",
"name",
",",
"true",
")",
";",
"}"
] | @Given a Content Type with a required :fieldType field exists
@Given a Content Type with a required :fieldType with field definition name :name exists
Creates a ContentType with only the desired FieldType | [
"@Given",
"a",
"Content",
"Type",
"with",
"a",
"required",
":",
"fieldType",
"field",
"exists",
"@Given",
"a",
"Content",
"Type",
"with",
"a",
"required",
":",
"fieldType",
"with",
"field",
"definition",
"name",
":",
"name",
"exists"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/FieldType.php#L37-L40 |
ezsystems/BehatBundle | Context/Object/FieldType.php | FieldType.createContentOfThisType | public function createContentOfThisType( $field = null, $value = null )
{
return $this->getFieldTypeManager()->createContent( $field, $value );
} | php | public function createContentOfThisType( $field = null, $value = null )
{
return $this->getFieldTypeManager()->createContent( $field, $value );
} | [
"public",
"function",
"createContentOfThisType",
"(",
"$",
"field",
"=",
"null",
",",
"$",
"value",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getFieldTypeManager",
"(",
")",
"->",
"createContent",
"(",
"$",
"field",
",",
"$",
"value",
")",
";",
"}"
] | @Given a Content of this type exists
@Given a Content of this type exists with :field Field Value set to :value
@And a Content of this type exists
@And a Content of this type exists with :field Field Value set to :value
Creates a Content with the previously defined ContentType | [
"@Given",
"a",
"Content",
"of",
"this",
"type",
"exists",
"@Given",
"a",
"Content",
"of",
"this",
"type",
"exists",
"with",
":",
"field",
"Field",
"Value",
"set",
"to",
":",
"value",
"@And",
"a",
"Content",
"of",
"this",
"type",
"exists",
"@And",
"a",
"Content",
"of",
"this",
"type",
"exists",
"with",
":",
"field",
"Field",
"Value",
"set",
"to",
":",
"value"
] | train | https://github.com/ezsystems/BehatBundle/blob/7d6d409545ec7cb69a3ab6636a59159df033695d/Context/Object/FieldType.php#L50-L53 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.