sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
protected function addToDummyFileList($uniqueFileName) { $relativeFileName = $this->getPathRelativeToUploadDirectory($uniqueFileName); $this->dummyFiles[$relativeFileName] = $relativeFileName; }
Adds a file name to $this->dummyFiles. @param string $uniqueFileName file name to add, must be the unique name of a dummy file, must not be empty @return void
entailment
public function deleteDummyFile($fileName) { $absolutePathToFile = $this->getUploadFolderPath() . $fileName; $fileExists = file_exists($absolutePathToFile); if (!isset($this->dummyFiles[$fileName])) { throw new \InvalidArgumentException( 'The file "' . $absoluteP...
Deletes the dummy file specified by the first parameter $fileName. @param string $fileName the path to the file to delete relative to $this->uploadFolderPath, must not be empty @return void @throws \InvalidArgumentException @throws Exception
entailment
public function createDummyFolder($folderName) { $this->createDummyUploadFolder(); $uniqueFolderName = $this->getUniqueFileOrFolderPath($folderName); if (!GeneralUtility::mkdir($uniqueFolderName)) { throw new Exception('The folder ' . $uniqueFolderName . ' could not be created.'...
Creates a dummy folder with a unique folder name in the calling extension's upload directory. @param string $folderName name of the dummy folder to create relative to $this->uploadFolderPath, must not be empty @return string the absolute path of the created dummy folder, will not be empty @throws Exception
entailment
public function deleteDummyFolder($folderName) { $absolutePathToFolder = $this->getUploadFolderPath() . $folderName; if (!is_dir($absolutePathToFolder)) { throw new \InvalidArgumentException( 'The folder "' . $absolutePathToFolder . '" which you are trying to delete does...
Deletes the dummy folder specified in the first parameter $folderName. The folder must be empty (no files or subfolders). @param string $folderName the path to the folder to delete relative to $this->uploadFolderPath, must not be empty @return void @throws \InvalidArgumentException @throws Exception
entailment
protected function createDummyUploadFolder() { $uploadFolderPath = $this->getUploadFolderPath(); if (is_dir($uploadFolderPath)) { return; } $creationSuccessful = GeneralUtility::mkdir($uploadFolderPath); if (!$creationSuccessful) { throw new \RuntimeE...
Creates the upload folder if it does not exist yet. @return void @throws \RuntimeException
entailment
public function setUploadFolderPath($absolutePath) { if (!empty($this->dummyFiles) || !empty($this->dummyFolders)) { throw new Exception( 'The upload folder path must not be changed if there are already dummy files or folders.', 1334439424 ); }...
Sets the upload folder path. @param string $absolutePath absolute path to the folder where to work on during the tests, can be either an existing folder which will be cleaned up after the tests or a path of a folder to be created as soon as it is needed and deleted during cleanUp, must end with a trailing slash @retu...
entailment
public function getPathRelativeToUploadDirectory($absolutePath) { if (!preg_match( '/^' . str_replace('/', '\\/', $this->getUploadFolderPath()) . '.*$/', $absolutePath ) ) { throw new \InvalidArgumentException( 'The first parameter $absolut...
Returns the path relative to the calling extension's upload directory for a path given in the first parameter $absolutePath. throws \InvalidArgumentException if the first parameter $absolutePath is not within the calling extension's upload directory @param string $absolutePath the absolute path to process, must be wi...
entailment
public function getUniqueFileOrFolderPath($path) { if ($path === '') { throw new \InvalidArgumentException('The first parameter $path must not be empty.', 1476054696353); } $pathInformation = pathinfo($path); $fileNameWithoutExtension = $pathInformation['filename']; ...
Returns a unique absolute path of a file or folder. @param string $path the path of a file or folder relative to the calling extension's upload directory, must not be empty @return string the unique absolute path of a file or folder @throws \InvalidArgumentException
entailment
public function createFakeFrontEnd($pageUid = 0) { if ($pageUid < 0) { throw new \InvalidArgumentException('$pageUid must be >= 0.', 1334439467); } $this->suppressFrontEndCookies(); $this->discardFakeFrontEnd(); $this->registerNullPageCache(); if (\TYPO3...
Fakes a TYPO3 front end, using $pageUid as front-end page ID if provided. If $pageUid is zero, the UID of the start page of the current domain will be used as page UID. This function creates $GLOBALS['TSFE'] and $GLOBALS['TT']. Note: This function does not set TYPO3_MODE to "FE" (because the value of a constant cann...
entailment
public function discardFakeFrontEnd() { if (!$this->hasFakeFrontEnd()) { return; } $this->logoutFrontEndUser(); $GLOBALS['TSFE'] = null; $GLOBALS['TT'] = null; unset( $GLOBALS['TYPO3_CONF_VARS']['FE']['dontSetCookie'], $GLOBALS['T...
Discards the fake front end. This function nulls out $GLOBALS['TSFE'] and $GLOBALS['TT']. In addition, any logged-in front-end user will be logged out. The page record for the current front end will _not_ be deleted by this function, though. If no fake front end has been created, this function does nothing. @return...
entailment
public function loginFrontEndUser($userId) { if ((int)$userId === 0) { throw new \InvalidArgumentException('The user ID must be > 0.', 1334439475); } if (!$this->hasFakeFrontEnd()) { throw new Exception('Please create a front end before calling loginFrontEndUser.', 13...
Fakes that a front-end user has logged in. If a front-end user currently is logged in, he/she will be logged out first. Note: To set the logged-in users group data properly, the front-end user and his groups must actually exist in the database. @param int $userId UID of the FE user, must not necessarily exist in the...
entailment
public function logoutFrontEndUser() { if (!$this->hasFakeFrontEnd()) { throw new Exception('Please create a front end before calling logoutFrontEndUser.', 1334439488); } if (!$this->isLoggedIn()) { return; } $this->suppressFrontEndCookies(); ...
Logs out the current front-end user. If no front-end user is logged in, this function does nothing. @throws Exception if no front end has been created @return void
entailment
public function isLoggedIn() { if (!$this->hasFakeFrontEnd()) { throw new Exception('Please create a front end before calling isLoggedIn.', 1334439494); } return isset($GLOBALS['TSFE']) && is_object($GLOBALS['TSFE']) && is_array($GLOBALS['TSFE']->fe_user->user); ...
Checks whether a FE user is logged in. @throws Exception if no front end has been created @return bool TRUE if a FE user is logged in, FALSE otherwise
entailment
protected function createListOfOwnAllowedTables() { $this->ownAllowedTables = []; $allTables = \Tx_Phpunit_Service_Database::getAllTableNames(); $length = strlen($this->tablePrefix); foreach ($allTables as $currentTable) { if (substr_compare($this->tablePrefix, $currentT...
Generates a list of allowed tables to which this instance of the testing framework has access to create/remove test records. The generated list is based on the list of all tables that TYPO3 can access (which will be all tables in this database), filtered by prefix of the extension to test. The array with the allowed ...
entailment
protected function createListOfAdditionalAllowedTables() { $allTables = implode(',', \Tx_Phpunit_Service_Database::getAllTableNames()); $additionalTablePrefixes = implode('|', $this->additionalTablePrefixes); $matches = []; preg_match_all( '/((' . $additionalTablePrefix...
Generates a list of additional allowed tables to which this instance of the testing framework has access to create/remove test records. The generated list is based on the list of all tables that TYPO3 can access (which will be all tables in this database), filtered by the prefixes of additional extensions. The array ...
entailment
public function getDummyColumnName($tableName) { $result = 'is_dummy_record'; if ($this->isSystemTableNameAllowed($tableName)) { $result = 'tx_phpunit_' . $result; } elseif ($this->isAdditionalTableNameAllowed($tableName)) { $result = $this->tablePrefix . '_' . $resu...
Returns the name of the column that marks a record as a dummy record. On most tables this is "is_dummy_record", but on system tables like "pages" or "fe_users", the column is called "tx_phpunit_dummy_record". On additional tables, the column is built using $this->tablePrefix as prefix e.g. "tx_seminars_is_dummy_recor...
entailment
public function countRecords($tableName, $whereClause = '') { if (!$this->isTableNameAllowed($tableName)) { throw new \InvalidArgumentException( 'The given table name is invalid. This means it is either empty or not in the list of allowed tables.', 1334439501 ...
Counts the dummy records in the table given by the first parameter $tableName that match a given WHERE clause. @param string $tableName the name of the table to query, must not be empty @param string $whereClause the WHERE part of the query, may be empty (all records will be counted in that case) @return int the numb...
entailment
public function resetAutoIncrement($tableName) { if (!$this->isTableNameAllowed($tableName)) { throw new \InvalidArgumentException( 'The given table name is invalid. This means it is either empty or not in the list of allowed tables.', 1334439521 ); ...
Eagerly resets the auto increment value for a given table to the highest existing UID + 1. @param string $tableName the name of the table on which we're going to reset the auto increment entry, must not be empty @see resetAutoIncrementLazily @return void @throws \InvalidArgumentException @throws \Tx_Phpunit_Excepti...
entailment
public function resetAutoIncrementLazily($tableName) { if (!$this->isTableNameAllowed($tableName)) { throw new \InvalidArgumentException( 'The given table name is invalid. This means it is either empty or not in the list of allowed tables.', 1334439548 ...
Resets the auto increment value for a given table to the highest existing UID + 1 if the current auto increment value is higher than a certain threshold over the current maximum UID. The threshold is 100 by default and can be set using setResetAutoIncrementThreshold. @param string $tableName the name of the table on ...
entailment
public function getAutoIncrement($tableName) { if (!$this->isTableNameAllowed($tableName)) { throw new \InvalidArgumentException( 'The given table name is invalid. This means it is either empty or not in the list of allowed tables.', 1334439567 ); ...
Reads the current auto increment value for a given table. This function is only valid for tables that actually have an auto increment value. @param string $tableName the name of the table for which the auto increment value should be retrieved, must not be empty @return int the current auto_increment value of table $...
entailment
public function markTableAsDirty($tableNames) { foreach (GeneralUtility::trimExplode(',', $tableNames) as $currentTable) { if ($this->isNoneSystemTableNameAllowed($currentTable)) { $this->dirtyTables[$currentTable] = $currentTable; } elseif ($this->isSystemTableNameAl...
Puts one or multiple table names on the list of dirty tables (which represents a list of tables that were used for testing and contain dummy records and thus are called "dirty" until the next clean up). @param string $tableNames the table name or a comma-separated list of table names to put on the list of dirty tables...
entailment
public function getRelationSorting($tableName, $uidLocal) { if (!$this->relationSorting[$tableName][$uidLocal]) { $this->relationSorting[$tableName][$uidLocal] = 0; } $this->relationSorting[$tableName][$uidLocal]++; return $this->relationSorting[$tableName][$uidLocal]; ...
Returns the next sorting value of the relation table which should be used. Note: This function does not take already existing relations in the database (which were created without using the testing framework) into account. So you always should create new dummy records and create a relation between these two dummy reco...
entailment
public function increaseRelationCounter($tableName, $uid, $fieldName) { if (!$this->isTableNameAllowed($tableName)) { throw new \InvalidArgumentException( 'The table name "' . $tableName . '" is invalid. This means it is either empty or not in the list of allowed ...
Updates an int field of a database table by one. This is mainly needed for counting up the relation counter when creating a database relation. The field to update must be of type int. @param string $tableName name of the table, must not be empty @param int $uid the UID of the record to modify, must be > 0 @param stri...
entailment
protected function getHooks() { if (!self::$hooksHaveBeenRetrieved) { $hookClasses = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['phpunit']['FrameworkCleanUp']; if (is_array($hookClasses)) { foreach ($hookClasses as $hookClass) { self::$hooks[] = Genera...
Gets all hooks for this class. @return \Tx_Phpunit_Interface_FrameworkCleanupHook[] the hook objects, will be empty if no hooks have been set
entailment
public function validate($value, Constraint $constraint) { /**@var $constraint CodeUnit */ if (!in_array($value, $this->codes)) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $value) ->addViolation(); } }
Checks if the passed value is valid. @param mixed $value The value that should be validated @param Constraint $constraint The constraint for the validation
entailment
private static function retrievePageForEnableFields() { if (!is_object(self::$pageForEnableFields)) { if (isset($GLOBALS['TSFE']) && is_object($GLOBALS['TSFE']->sys_page) ) { self::$pageForEnableFields = $GLOBALS['TSFE']->sys_page; } else {...
Makes sure that self::$pageForEnableFields is a page object. @return void
entailment
public static function createRecursivePageList($startPages, $recursionDepth = 0) { if ($recursionDepth < 0) { throw new \InvalidArgumentException('$recursionDepth must be >= 0.', 1331315492); } if ($recursionDepth === 0) { return (string)$startPages; } ...
Recursively creates a comma-separated list of subpage UIDs from a list of pages. The result also includes the original pages. The maximum level of recursion can be limited: 0 = no recursion (the default value, will return $startPages), 1 = only direct child pages, ..., 250 = all descendants for all sane cases Note: Th...
entailment
public static function delete($tableName, $whereClause) { if ($tableName === '') { throw new \InvalidArgumentException('The table name must not be empty.', 1331315508); } self::enableQueryLogging(); $dbResult = self::getDatabaseConnection()->exec_DELETEquery( ...
Executes a DELETE query. @param string $tableName the name of the table from which to delete, must not be empty @param string $whereClause the WHERE clause to select the records, may be empty @return int the number of affected rows, might be 0 @throws \InvalidArgumentException @throws \Tx_Phpunit_Exception_Database ...
entailment
public static function update($tableName, $whereClause, array $fields) { if ($tableName === '') { throw new \InvalidArgumentException('The table name must not be empty.', 1331315523); } self::enableQueryLogging(); $dbResult = self::getDatabaseConnection()->exec_UPDATEque...
Executes an UPDATE query. @param string $tableName the name of the table to change, must not be empty @param string $whereClause the WHERE clause to select the records, may be empty @param array $fields key/value pairs of the fields to change, may be empty @return int the number of affected rows, might be 0 @throws ...
entailment
public static function insert($tableName, array $recordData) { if ($tableName === '') { throw new \InvalidArgumentException('The table name must not be empty.', 1331315544); } if (empty($recordData)) { throw new \InvalidArgumentException('$recordData must not be empty...
Executes an INSERT query. @param string $tableName the name of the table in which the record should be created, must not be empty @param array $recordData key/value pairs of the record to insert, must not be empty @return int the UID of the created record, will be 0 if the table has no UID column @throws \InvalidArg...
entailment
public static function selectColumnForMultiple( $fieldName, $tableNames, $whereClause = '', $groupBy = '', $orderBy = '', $limit = '' ) { $rows = self::selectMultiple( $fieldName, $tableNames, $whereClause, $grou...
Executes a SELECT query and returns one column from the result rows as a one-dimensional numeric array. If there is more than one matching record, only one will be returned. @param string $fieldName name of the field to select, must not be empty @param string $tableNames comma-separated list of tables from which to s...
entailment
public static function count($tableNames, $whereClause = '') { $isOnlyOneTable = ((strpos($tableNames, ',') === false) && (stripos(trim($tableNames), ' JOIN ') === false)); if ($isOnlyOneTable && self::tableHasColumnUid($tableNames)) { // Counting only the "uid" column is fas...
Counts the number of matching records in the database for a particular WHERE clause. @param string $tableNames comma-separated list of existing tables from which to count, can also be a JOIN, must not be empty @param string $whereClause WHERE clause, may be empty @return int the number of matching records, will be >=...
entailment
public static function existsRecordWithUid( $tableName, $uid, $additionalWhereClause = '' ) { if ($uid <= 0) { throw new \InvalidArgumentException('$uid must be > 0.', 1331315624); } return self::count($tableName, 'uid = ' . $uid . $additionalWhereClause)...
Checks whether there is a record in the table given by the first parameter $tableName that has the given UID. Important: This function also returns TRUE if there is a deleted or hidden record with that particular UID. @param string $tableName the name of the table to query, must not be empty @param int $uid the UID o...
entailment
public static function existsTable($tableName) { if ($tableName === '') { throw new \InvalidArgumentException('The table name must not be empty.', 1331315636); } self::retrieveTableNames(); return isset(self::$tableNameCache[$tableName]); }
Checks whether a database table exists. @param string $tableName the name of the table to check for, must not be empty @return bool TRUE if the table $tableName exists, FALSE otherwise @throws \InvalidArgumentException
entailment
public static function getColumnDefinition($tableName, $column) { self::retrieveColumnsForTable($tableName); return self::$tableColumnCache[$tableName][$column]; }
Gets the column definition for a field in $tableName. @param string $tableName the name of the table for which the column names should be retrieved, must not be empty @param string $column the name of the field of which to retrieve the definition, must not be empty @return array the field definition for the field in ...
entailment
private static function retrieveColumnsForTable($tableName) { if (!isset(self::$tableColumnCache[$tableName])) { if (!self::existsTable($tableName)) { throw new \BadMethodCallException('The table "' . $tableName . '" does not exist.', 1331315659); } self:...
Retrieves and caches the column data for the table $tableName. If the column data for that table already is cached, this function does nothing. @param string $tableName the name of the table for which the column names should be retrieved, must not be empty @return void @throws \BadMethodCallException
entailment
public static function tableHasColumn($tableName, $column) { if ($column === '') { return false; } self::retrieveColumnsForTable($tableName); return isset(self::$tableColumnCache[$tableName][$column]); }
Checks whether a table has a column with a particular name. To get a boolean TRUE as result, the table must contain a column with the given name. @param string $tableName the name of the table to check, must not be empty @param string $column the column name to check, must not be empty @return bool TRUE if the colum...
entailment
public static function getTcaForTable($tableName) { if (isset(self::$tcaCache[$tableName])) { return self::$tcaCache[$tableName]; } if (!self::existsTable($tableName)) { throw new \BadMethodCallException('The table "' . $tableName . '" does not exist.', 1331315679); ...
Returns the TCA for a certain table. @param string $tableName the table name to look up, must not be empty @return array[] associative array with the TCA description for this table @throws \BadMethodCallException
entailment
public function getGroupMembers($groupId, array $filters = []) { return $this->sendRequest( $this->createRequest('GET', sprintf('groups/%d/members', $groupId), [ 'query' => $filters ]) ); }
getGroupMembers - Gets members associated for a specific group @param int $groupId - The ID of the group to get information on @param array $filters - Available filters: page, per_page @return @see Client::sendRequest
entailment
public function getGroupMember($groupId, $memberId) { return $this->sendRequest( $this->createRequest('GET', sprintf('groups/%d/members/%d', $groupId, $memberId)) ); }
getGroupMembers - Gets a specific member information for a specific group @param int $groupId - The ID of the group to get information on @param int $memberId - The ID of the member in the group to get information on @return @see Client::sendRequest
entailment
public function render() { $content = $this->renderForm($this->renderSelect()); $this->outputService->output($content); }
Renders the content of the view helper and pushes it to the output service. @return void
entailment
protected function renderForm($formContent) { $formContentWithAdditionalElements = $formContent . $this->renderHiddenFields() . $this->renderSubmitButton($this->translate('run_all_tests')); $formContentWithinParagraph = $this->renderTag('p', [], $formContentWithAdditionalElements); ...
Renders the form with submit button around some content. @param string $formContent @return string the final form
entailment
protected function renderSelect() { $options = $this->getOptions(); $selectedExtensionStyle = ''; $renderedOptionTags = []; foreach ($options as $option) { if (isset($option['selected']) && $option['selected'] === 'selected') { $selectedExtensionStyle = ...
Renders the select box as HTML. @return string the rendered select tag
entailment
protected function getOptions() { $options = []; $allExtensionOption = [ 'class' => 'alltests', 'value' => \Tx_Phpunit_Testable::ALL_EXTENSIONS, ]; if ($this->isOptionSelected(\Tx_Phpunit_Testable::ALL_EXTENSIONS)) { $allExtensionOption['selected'...
Gets all options rendered as an array @return array[] all options, will not be empty
entailment
public function cache($key, callable $cachedCallable, $ttl, callable $onNoStaleCacheCallable = null) { $value = $this->getValue($key); if ($value->hasResult() && !$value->isStale()) { return $value->getResult(); } if (!($ttl instanceof Ttl)) { $ttl = new Ttl...
Caches specified closure/method/function for specified time. As a third argument - instead of integer - you can pass Ttt object to define grace tll and lock ttl (both optional). @param string @param callable @param int|\Metaphore\Ttl @param callable
entailment
public function setResult($key, $result, $ttl) { if (!($ttl instanceof Ttl)) { $ttl = new Ttl($ttl); } $expirationTimestamp = time() + $ttl->getTtl(); $value = new Value($result, $expirationTimestamp); $this->valueStore->set($key, $value, $ttl->getRealTtl()); ...
Sets result. Does not use anti-dogpile-effect mechanism. Use cache() instead for this. @param string @param mixed @param int|\Metaphore\Ttl
entailment
public function getCollectorsForSurvey($surveyId, array $filters = []) { return $this->sendRequest( $this->createRequest('GET', sprintf('surveys/%s/collectors', $surveyId), [ 'query' => $filters ]) ); }
getCollectorsForSurvey @param int $surveyId @param array $filters - Available filters: page, per_page, sort_by, sort_order, name, start_date, end_date, include @return @see Client::sendRequest
entailment
public function createCollectorForSurvey($surveyId, array $data = []) { return $this->sendRequest( $this->createRequest('POST', sprintf('surveys/%s/collectors', $surveyId), [], $data) ); }
createCollectorForSurvey @param int $surveyId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function updateCollector($collectorId, array $data = []) { return $this->sendRequest( $this->createRequest('PATCH', sprintf('collectors/%s', $collectorId), [], $data) ); }
updateCollector @param int $collectorId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function replaceCollector($collectorId, array $data = []) { return $this->sendRequest( $this->createRequest('PUT', sprintf('collectors/%s', $collectorId), [], $data) ); }
replaceCollector @param int $collectorId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function getCollectorMessages($collectorId, array $filters = []) { return $this->sendRequest( $this->createRequest('GET', sprintf('collectors/%s/messages', $collectorId), [ 'query' => $filters ]) ); }
getCollectorMessages @param int $collectorId @param array $filters - Available filters: page, per_page @return @see Client::sendRequest
entailment
public function createCollectorMessage($collectorId, array $data = []) { return $this->sendRequest( $this->createRequest('POST', sprintf('collectors/%s/messages', $collectorId), [], $data) ); }
createCollectorMessage @param int $collectorId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function copyCollectorMessage($collectorId, $fromCollectorId, $fromMessageId, $includeRecipients = false) { return $this->sendRequest( $this->createRequest('POST', sprintf('collectors/%s/messages', $collectorId), [ 'query' => [ 'from_collector_id' => $fromCollectorId, 'from_message_id' => ...
copyCollectorMessage @param int $fromCollectorId @param int $fromMessageId @param bool $includeRecipients @return @see Client::sendRequest
entailment
public function getCollectorMessage($collectorId, $messageId) { return $this->sendRequest( $this->createRequest('GET', sprintf('collectors/%s/messages/%s', $collectorId, $messageId)) ); }
getCollectorMessage @param int $collectorId @param int $messageId @return @see Client::sendRequest
entailment
public function updateCollectorMessage($collectorId, $messageId, array $data = []) { return $this->sendRequest( $this->createRequest('PATCH', sprintf('collectors/%s/messages/%s', $collectorId, $messageId), [], $data) ); }
updateCollectorMessage @param int $collectorId @param int $messageId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function replaceCollectorMessage($collectorId, $messageId, array $data = []) { return $this->sendRequest( $this->createRequest('PUT', sprintf('collectors/%s/messages/%s', $collectorId, $messageId), [], $data) ); }
replaceCollectorMessage @param int $collectorId @param int $messageId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function deleteCollectorMessage($collectorId, $messageId) { return $this->sendRequest( $this->createRequest('DELETE', sprintf('collectors/%s/messages/%s', $collectorId, $messageId)) ); }
deleteCollectorMessage @param int $collectorId @param int $messageId @return @see Client::sendRequest
entailment
public function sendCollectorMessage($collectorId, $messageId, \DateTime $scheduledDate = null) { $data = $scheduledDate ? [ 'scheduled_date' => $scheduledDate->format(DATE_ATOM) ] : []; return $this->sendRequest( $this->createRequest('POST', sprintf('collectors/%s/messages/%s/send', $collectorId, $messageId...
sendCollectorMessage @param int $collectorId @param int $messageId @param DateTime|null $scheduledDate @return @see Client::sendRequest
entailment
public function getCollectorMessageRecipients($collectorId, $messageId, array $filters = []) { return $this->sendRequest( $this->createRequest('GET', sprintf('collectors/%s/messages/%s/recipients', $collectorId, $messageId), [ 'query' => $filters ]) ); }
getCollectorMessageRecipients @param int $collectorId @param int $messageId @param array $filters - Available filters: page, per_page @return @see Client::sendRequest
entailment
public function createCollectorMessageRecipient($collectorId, $messageId, array $data = []) { return $this->sendRequest( $this->createRequest('POST', sprintf('collectors/%s/messages/%s/recipients', $collectorId, $messageId), [], $data) ); }
createCollectorMessageRecipient @param int $collectorId @param int $messageId @param array $data - See API docs for available fields @link https://developer.surveymonkey.com/api/v3/#collectors-id-messages-id-recipients Documentation for creating recipient @return @see Client::sendRequest
entailment
public function createCollectorMessageRecipientBulk($collectorId, $messageId, $data = []) { return $this->sendRequest( $this->createRequest('POST', sprintf('collectors/%s/messages/%s/recipients/bulk', $collectorId, $messageId), [], $data) ); }
createCollectorMessageRecipientBulk @param int $collectorId @param int $messageId @param array $data - See API docs for available fields @link https://developer.surveymonkey.net/api/v3/#collectors-id-messages-id-recipients-bulk Documentation for creating recipients in bulk @return @see Client::sendRequest
entailment
public function getCollectorRecipients($collectorId, array $filters = []) { return $this->sendRequest( $this->createRequest('GET', sprintf('collectors/%s/recipients', $collectorId), [ 'query' => $filters ]) ); }
getCollectorRecipients @param int $collectorId @param array $filters - Available filters: page, per_page @return @see Client::sendRequest
entailment
public function getCollectorRecipient($collectorId, $recipientId) { return $this->sendRequest( $this->createRequest('GET', sprintf('collectors/%s/recipients/%s', $collectorId, $recipientId)) ); }
getCollectorRecipient @param int $collectorId @param int $recipientId @return @see Client::sendRequest
entailment
public function deleteCollectorRecipient($collectorId, $recipientId) { return $this->sendRequest( $this->createRequest('DELETE', sprintf('collectors/%s/recipients/%s', $collectorId, $recipientId)) ); }
deleteCollectorRecipient @param int $collectorId @param int $recipientId @return @see Client::sendRequest
entailment
protected function getField($key) { return !empty($this->response[$key]) ? $this->response[$key] : null; }
Helper for getting user data @param string $key @return mixed|null
entailment
public function setObject(WeavedInterface $object, \ReflectionMethod $method) { $this->object = $object; $this->method = $method->name; }
Set dependencies
entailment
public function getAnnotations() : array { /** @var AbstractWeave $object */ $object = $this->object; $annotations = unserialize($object->methodAnnotations); if (array_key_exists($this->method, $annotations)) { return $annotations[$this->method]; } return...
{@inheritdoc}
entailment
public function getAnnotation(string $annotationName) { $annotations = $this->getAnnotations(); foreach ($annotations as $annotation) { if ($annotation instanceof $annotationName) { return $annotation; } } }
{@inheritdoc}
entailment
public function matchesClass(\ReflectionClass $class, array $arguments) : bool { list($startsWith) = $arguments; return strpos($class->name, $startsWith) === 0; }
{@inheritdoc}
entailment
public function matchesMethod(\ReflectionMethod $method, array $arguments) : bool { list($startsWith) = $arguments; return strpos($method->name, $startsWith) === 0; }
{@inheritdoc}
entailment
public function render() { $attributes = array_merge( $this->additionalAttributes, [ 'type' => $this->type, 'value' => $this->value, ] ); return $this->renderTag( $this->tagName, $attributes ...
Renders the input field with the set attributes and value @return string
entailment
public function annotatedWith($annotationName) : AbstractMatcher { if (! class_exists($annotationName)) { throw new InvalidAnnotationException($annotationName); } return new AnnotatedMatcher(__FUNCTION__, [$annotationName]); }
{@inheritdoc} @throws \ReflectionException
entailment
public function subclassesOf($superClass) : AbstractMatcher { if (! class_exists($superClass)) { throw new InvalidArgumentException($superClass); } return new BuiltinMatcher(__FUNCTION__, [$superClass]); }
{@inheritdoc} @throws \ReflectionException
entailment
public function matchesMethod(\ReflectionMethod $method, array $arguments) : bool { return $this->matcher->matchesMethod($method, $arguments); }
{@inheritdoc}
entailment
public function ajaxBroker(array $unused, AjaxRequestHandler $ajax) { $state = (bool)GeneralUtility::_POST('state'); $checkbox = GeneralUtility::_POST('checkbox'); if (in_array($checkbox, $this->validCheckboxKeys, true)) { $ajax->setContentFormat('json'); $this->user...
Used to broker incoming requests to other calls. Called by typo3/ajax.php @param array $unused additional parameters (not used) @param AjaxRequestHandler $ajax the AJAX object for this request @return void
entailment
public function matchesMethod(\ReflectionMethod $method, array $arguments) : bool { unset($arguments); return ! ($this->isMagicMethod($method->name) || $this->isBuiltinMethod($method->name)); }
{@inheritdoc}
entailment
public function set($key, $value, $ttl) { $fileName = $this->getFileName($key); $data = $this->prepareTtl($ttl).'|'.serialize($value); return file_put_contents($fileName, $data); }
{@inheritdoc}
entailment
public function get($key) { $fileName = $this->getFileName($key); if (!file_exists($fileName)) { return false; } $data = file_get_contents($fileName); list($ttl, $serializedValue) = explode('|', $data, 2); if ($ttl < time()) { return false; ...
{@inheritdoc}
entailment
public function add($key, $value, $ttl) { if ($this->get($key) !== false) { return false; } return $this->set($key, $value, $ttl); }
{@inheritdoc}
entailment
public function getMidSummerDay($year, $timezone) { $date = new \DateTime($year.'-06-20', $timezone); for ($i = 0; $i < 7; $i++) { if ($date->format('w') == 6) { break; } $date->add(new \DateInterval('P1D')); } return $date; }
the Swedish midsummer day is the saturday between 20 and 26:th of June
entailment
public function dump(string $string): void { if ($this->handle === null) { $this->openFile(); } fwrite($this->handle, $string); }
{@inheritdoc}
entailment
private function clearHandle(): void { if ($this->handle !== null) { fclose($this->handle); $this->handle = null; } }
{@inheritdoc}
entailment
public function main() { LibraryLoader::includeAll(); $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class); $this->doc->backPath = $GLOBALS['BACK_PATH']; if ($GLOBALS['BE_USER']->user['admin']) { $this->doc->bodyTagAdditions = 'id="doc3"'; $th...
Main function of the module. Outputs all content directly instead of collecting it and doing the output later. @return void
entailment
protected function addAdditionalHeaderData() { /** @var PageRenderer $pageRenderer */ $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $pageRenderer->loadJquery(); $publicResourcesPath = $this->extensionPath . 'Resources/Public/'; $pageRenderer->addJsFile($p...
Adds some JavaScript and CSS stuff to header data. @return void
entailment
protected function createExtensionSelector() { $this->getAndSaveSelectedTestableKey(); /** @var \Tx_Phpunit_ViewHelpers_ExtensionSelectorViewHelper $extensionSelectorViewHelper */ $extensionSelectorViewHelper = GeneralUtility::makeInstance(\Tx_Phpunit_ViewHelpers_ExtensionSelect...
Creates the extension drop-down. @return void
entailment
protected function createCheckboxes() { $output = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tools_txphpunitbeM1')) . '" method="post">'; $output .= '<div class="phpunit-controls">'; $failureState = $this->userSettingsService->getAsBoolean('fail...
Renders the checkboxes for hiding or showing various test results. @return string HTML code with checkboxes and a surrounding form
entailment
protected function renderReRunButton() { $this->outputService->output( '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tools_txphpunitbeM1')) . '" method="post"> <p> <button type="submit" name="' . \Tx_Phpunit_Interface_Request::PARAMETER_NAMESPACE . ' [...
Renders and output the re-run button. @return void
entailment
protected function renderCodeCoverage() { $this->coverage->stop(); $codeCoverageDirectory = PATH_site . 'typo3temp/codecoverage/'; if (!is_readable($codeCoverageDirectory) && !is_dir($codeCoverageDirectory)) { GeneralUtility::mkdir($codeCoverageDirectory); } $co...
Renders and outputs the code coverage report. @return void
entailment
protected function renderProgressbar() { /** @var \Tx_Phpunit_ViewHelpers_ProgressBarViewHelper $progressBarViewHelper */ $progressBarViewHelper = GeneralUtility::makeInstance(\Tx_Phpunit_ViewHelpers_ProgressBarViewHelper::class); $progressBarViewHelper->injectOutputService($this->outputServ...
Renders DIVs which contain information and a progressbar to visualize the running tests. The actual information will be written via JS during the test runs. @return void
entailment
protected function createIconStyle($extensionKey) { if ($extensionKey === '') { throw new \Tx_Phpunit_Exception_NoTestsDirectory('$extensionKey must not be empty.', 1303503647); } if (!$this->testFinder->existsTestableForKey($extensionKey)) { throw new \Tx_Phpunit_Exc...
Creates the CSS style attribute content for an icon for the extension $extensionKey. @param string $extensionKey the key of a loaded extension, may also be "typo3" @return string the content for the "style" attribute, will not be empty @throws \Tx_Phpunit_Exception_NoTestsDirectory if there is not extension with tes...
entailment
protected function get($key) { $this->checkForNonEmptyKey($key); if (!$this->requestDataHasBeenRetrieved) { $this->retrieveRequestData(); } if (!isset($this->cachedRequestData[$key])) { return null; } return $this->cachedRequestData[$key]; ...
Returns the value stored for the key $key. @param string $key the key of the value to retrieve, must not be empty @return mixed the value for the given key, will be NULL if there is no value for the given key
entailment
protected function retrieveRequestData() { $this->cachedRequestData = GeneralUtility::_GP(\Tx_Phpunit_Interface_Request::PARAMETER_NAMESPACE); $this->requestDataHasBeenRetrieved = true; }
Retrieves the EM configuration for the PHPUnit extension. @return void
entailment
public function updateWebhook($webhookId, array $data = []) { return $this->sendRequest( $this->createRequest('PATCH', sprintf('webhooks/%d', $webhookId), [], $data) ); }
updateWebhook @param int $webhookId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
public function replaceWebhook($webhookId, array $data = []) { return $this->sendRequest( $this->createRequest('PUT', sprintf('webhooks/%d', $webhookId), [], $data) ); }
replaceWebhook @param int $webhookId @param array $data - See API docs for available fields @return @see Client::sendRequest
entailment
protected function getHolidays($year) { $christmas = new DateTime($year.'-12-25', $this->timezone); $thanksgiving = new DateTime('fourth Thursday of November '.$year, $this->timezone); $holidays = array( new Holiday(clone $christmas, 'Christmas', $this->timezone), ne...
The template method to be used in the between calculation. Returns an array of Holidays. @see between() @param int $year The year to get the holidays for. @return array
entailment
public function matchesClass(\ReflectionClass $class, array $arguments) : bool { list($superClass) = $arguments; return $class->isSubclassOf($superClass) || ($class->name === $superClass); }
{@inheritdoc}
entailment
public function trans($id, array $parameters = array(), $domain = null, $locale = null) { return $this->getValue($id); }
Translates the given message. @param string $id The message id (may also be an object that can be cast to string) @param array $parameters An array of parameters for the message @param string|null $domain The domain for the message or null to use the default @param string|null $locale The lo...
entailment
public function matchesClass(\ReflectionClass $class, array $arguments) : bool { list($contains) = $arguments; return strpos($class->name, $contains) !== false; }
{@inheritdoc}
entailment
public function matchesMethod(\ReflectionMethod $method, array $arguments) : bool { list($contains) = $arguments; return strpos($method->name, $contains) !== false; }
{@inheritdoc}
entailment
public function addAlternateUrl(string $locale, string $url): void { $this->alternateUrl[$locale] = $url; }
Add an alternate url to the current one. If you have multiple language versions of a URL, each language page in the set must use rel="alternate" hreflang="x" to identify all language versions including itself. For example, if your site provides content in French, English, and Spanish, the Spanish version must include ...
entailment