testDiscovery = $test_discovery; $this->privateKey = $private_key; } /** * {@inheritdoc} */ public static function getLabel() { return t('Test discovery'); } /** * {@inheritdoc} */ public function getContext() { if (empty($this->hash)) { $tests = $this->testDiscovery->getTestClasses(); $this->hash = $this->hash(serialize($tests)); } return $this->hash; } /** * {@inheritdoc} */ public function getCacheableMetadata() { return new CacheableMetadata(); } /** * Hashes the given string. * * @param string $identifier * The string to be hashed. * * @return string * The hash. */ protected function hash($identifier) { return hash('sha256', $this->privateKey->get() . Settings::getHashSalt() . $identifier); } }