class SmsFrameworkUserAccountRegistrationServiceTest in SMS Framework 8
Same name and namespace in other branches
- 2.x modules/sms_user/tests/src/Kernel/SmsFrameworkUserAccountRegistrationServiceTest.php \Drupal\Tests\sms_user\Kernel\SmsFrameworkUserAccountRegistrationServiceTest
- 2.1.x modules/sms_user/tests/src/Kernel/SmsFrameworkUserAccountRegistrationServiceTest.php \Drupal\Tests\sms_user\Kernel\SmsFrameworkUserAccountRegistrationServiceTest
Tests account registration.
@group SMS Framework @coversDefaultClass \Drupal\sms_user\AccountRegistration
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses AssertContentTrait, AssertLegacyTrait, AssertHelperTrait, ConfigTestTrait, PhpunitCompatibilityTrait, RandomGeneratorTrait, TestRequirementsTrait
- class \Drupal\Tests\sms\Kernel\SmsFrameworkKernelBase uses SmsFrameworkTestTrait
- class \Drupal\Tests\sms_user\Kernel\SmsFrameworkUserAccountRegistrationServiceTest uses AssertMailTrait
- class \Drupal\Tests\sms\Kernel\SmsFrameworkKernelBase uses SmsFrameworkTestTrait
Expanded class hierarchy of SmsFrameworkUserAccountRegistrationServiceTest
File
- modules/
sms_user/ tests/ src/ Kernel/ SmsFrameworkUserAccountRegistrationServiceTest.php, line 23
Namespace
Drupal\Tests\sms_user\KernelView source
class SmsFrameworkUserAccountRegistrationServiceTest extends SmsFrameworkKernelBase {
use AssertMailTrait;
/**
* {@inheritdoc}
*/
public static $modules = [
'system',
'sms',
'sms_user',
'sms_test_gateway',
'user',
'telephone',
'dynamic_entity_reference',
'field',
];
/**
* The account registration service.
*
* @var \Drupal\sms_user\AccountRegistrationInterface
*/
protected $accountRegistration;
/**
* The default SMS provider.
*
* @var \Drupal\sms\Provider\SmsProviderInterface
*/
protected $smsProvider;
/**
* A memory gateway.
*
* @var \Drupal\sms\Entity\SmsGatewayInterface
*/
protected $gateway;
/**
* A phone field ofr testing.
*
* @var \Drupal\field\FieldStorageConfigInterface
*/
protected $phoneField;
/**
* Phone number settings for user entity type.
*
* @var \Drupal\sms\Entity\PhoneNumberSettingsInterface
*/
protected $phoneNumberSettings;
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this
->installSchema('system', [
'sequences',
]);
$this
->installConfig('sms_user');
$this->accountRegistration = $this->container
->get('sms_user.account_registration');
$this->smsProvider = $this->container
->get('sms.provider');
$this->gateway = $this
->createMemoryGateway([
'skip_queue' => TRUE,
]);
$this
->setFallbackGateway($this->gateway);
$this
->installEntitySchema('user');
$this
->installEntitySchema('sms');
$this
->installEntitySchema('sms_result');
$this
->installEntitySchema('sms_report');
$this
->installEntitySchema('sms_phone_number_verification');
$this->phoneField = FieldStorageConfig::create([
'entity_type' => 'user',
'field_name' => Unicode::strtolower($this
->randomMachineName()),
'type' => 'telephone',
]);
$this->phoneField
->save();
FieldConfig::create([
'entity_type' => 'user',
'bundle' => 'user',
'field_name' => $this->phoneField
->getName(),
])
->save();
$this->phoneNumberSettings = PhoneNumberSettings::create();
$this->phoneNumberSettings
->setPhoneNumberEntityTypeId('user')
->setPhoneNumberBundle('user')
->setFieldName('phone_number', $this->phoneField
->getName())
->setVerificationMessage($this
->randomString())
->save();
$this
->config('system.mail')
->set('interface.default', 'test_mail_collector')
->save();
$this
->config('user.settings')
->set('notify.register_no_approval_required', TRUE)
->save();
}
/**
* Ensure incoming SMS does not create messages or users.
*/
public function testUnrecognisedOffNoCreateUser() {
$this
->config('sms_user.settings')
->set('account_registration.unrecognized_sender.status', 0)
->set('account_registration.unrecognized_sender.reply.status', 1)
->save();
$this
->sendIncomingMessage('+123', $this
->randomString());
$this
->assertEquals(0, count($this
->getTestMessages($this->gateway)), 'No messages were created');
$this
->assertEquals(0, $this
->countUsers(), 'No users exist.');
}
/**
* Test user is created if a unrecognised phone number is used as sender.
*/
public function testUnrecognisedCreateUser() {
$this
->config('sms_user.settings')
->set('account_registration.unrecognized_sender.status', 1)
->set('account_registration.unrecognized_sender.reply.status', 1)
->save();
$sender_number = '+123123123';
$this
->sendIncomingMessage($sender_number, $this
->randomString());
$user = $this
->getLastUser();
$this
->assertTrue($user instanceof UserInterface, 'One user created.');
$this
->assertEquals($sender_number, $user->{$this->phoneField
->getName()}->value, 'Phone number associated');
}
/**
* Test a user is not created if the sender phone number is already used.
*/
public function testUnrecognisedCreateUserPhoneNumberRecognised() {
$this
->config('sms_user.settings')
->set('account_registration.unrecognized_sender.status', 1)
->set('account_registration.unrecognized_sender.reply.status', 1)
->save();
$sender_number = '+123123123';
$this
->createEntityWithPhoneNumber($this->phoneNumberSettings, [
$sender_number,
]);
$this
->resetTestMessages();
$this
->assertEquals(1, $this
->countUsers());
$this
->sendIncomingMessage($sender_number, $this
->randomString());
$this
->assertEquals(1, $this
->countUsers());
$this
->assertEquals(0, count($this
->getTestMessages($this->gateway)));
}
/**
* Ensure no reply sent if turned off.
*/
public function testUnrecognisedNoReply() {
$reply_message = $this
->randomString();
$this
->config('sms_user.settings')
->set('account_registration.unrecognized_sender.status', TRUE)
->set('account_registration.unrecognized_sender.reply.status', FALSE)
->set('account_registration.unrecognized_sender.reply.message', $reply_message)
->save();
$this
->sendIncomingMessage('+123123123', $this
->randomString());
$this
->assertEquals(1, $this
->countUsers(), 'User created');
$this
->assertFalse($this
->inTestMessages($this->gateway, $reply_message));
}
/**
* Ensure reply sent if turned on.
*/
public function testUnrecognisedGotReply() {
$reply_message = $this
->randomString();
$this
->config('sms_user.settings')
->set('account_registration.unrecognized_sender.status', TRUE)
->set('account_registration.unrecognized_sender.reply.status', TRUE)
->set('account_registration.unrecognized_sender.reply.message', $reply_message)
->save();
$this
->sendIncomingMessage('+123123123', $this
->randomString());
$this
->assertEquals(1, $this
->countUsers(), 'User created');
$this
->assertTrue($this
->inTestMessages($this->gateway, $reply_message));
}
/**
* Test if a user is created despite no email address.
*/
public function testUnrecognisedNoEmail() {
$this
->config('sms_user.settings')
->set('account_registration.unrecognized_sender.status', 1)
->save();
$this
->assertEquals(0, $this
->countUsers());
$this
->sendIncomingMessage('+123123123', $this
->randomString());
$this
->assertFalse(empty($this
->getLastUser()
->getAccountName()));
$this
->assertTrue(empty($this
->getLastUser()
->getEmail()));
}
/**
* Test user is created from a incoming pattern message.
*/
public function testIncomingPatternUserCreated() {
$this
->config('sms_user.settings')
->set('account_registration.incoming_pattern.status', 1)
->set('account_registration.incoming_pattern.reply.status', 1)
->save();
$username = $this
->randomMachineName();
$email = 'email@email.com';
$sender_number = '+123123123';
$message = "E " . $email . "\nU " . $username;
$this
->sendIncomingMessage($sender_number, $message);
$user = user_load_by_name($username);
$this
->assertTrue($user instanceof UserInterface, 'User was created');
$this
->assertEquals($username, $user
->getAccountName());
$this
->assertEquals($email, $user
->getEmail());
$this
->assertEquals($sender_number, $user->{$this->phoneField
->getName()}->value, 'Phone number associated');
}
/**
* Test all placeholders make their way into the user object.
*/
public function testIncomingPatternPlaceholders() {
$this
->config('sms_user.settings')
->set('account_registration.incoming_pattern.status', 1)
->set('account_registration.incoming_pattern.reply.status', 1)
->set('account_registration.incoming_pattern.incoming_messages.0', "[email] [username] [password]")
->save();
$email = 'email@domain.tld';
$username = $this
->randomMachineName();
$password = $this
->randomMachineName();
$message = "{$email} {$username} {$password}";
$this
->sendIncomingMessage('+123123123', $message);
$user = $this
->getLastUser();
$this
->assertEquals($email, $user
->getEmail());
$this
->assertEquals($username, $user
->getAccountName());
// Ensure password is correct:
/** @var \Drupal\user\UserAuthInterface $userAuth */
$userAuth = \Drupal::service('user.auth');
$this
->assertNotFalse($userAuth
->authenticate($username, $password));
}
/**
* Test if a duplicated placeholder is confirmed.
*/
public function testIncomingPatternMultiplePlaceholderSuccess() {
$this
->config('sms_user.settings')
->set('account_registration.incoming_pattern.status', 1)
->set('account_registration.incoming_pattern.reply.status', 1)
->set('account_registration.incoming_pattern.incoming_messages.0', "[password] [username] [password]")
->save();
$username = $this
->randomMachineName();
$password = $this
->randomMachineName();
$message = "{$password} {$username} {$password}";
$this
->sendIncomingMessage('+123123123', $message);
}
/**
* Test if a duplicated placeholder is not confirmed.
*/
public function testIncomingPatternMultiplePlaceholderFailure() {
$this
->config('sms_user.settings')
->set('account_registration.incoming_pattern.status', 1)
->set('account_registration.incoming_pattern.reply.status', 1)
->set('account_registration.incoming_pattern.incoming_messages.0', "[password] [username] [password]")
->save();
$username = $this
->randomMachineName();
$password = $this
->randomMachineName();
$password2 = $this
->randomMachineName();
$message = "{$password} {$username} {$password2}";
$this
->sendIncomingMessage('+123123123', $message);
$this
->assertFalse(user_load_by_name($username) instanceof UserInterface, 'User was not created');
}
/**
* Test if a user is created despite no email address.
*/
public function testIncomingPatternNoEmail() {
$this
->config('sms_user.settings')
->set('account_registration.incoming_pattern.status', 1)
->set('account_registration.incoming_pattern.incoming_messages.0', "[username] [password]")
->save();
$this
->assertEquals(0, $this
->countUsers());
$username = $this
->randomMachineName();
$message = "{$username} " . $this
->randomMachineName();
$this
->sendIncomingMessage('+123123123', $message);
$this
->assertEquals($username, $this
->getLastUser()
->getAccountName());
$this
->assertTrue(empty($this
->getLastUser()
->getEmail()));
}
/**
* Test if a user is created despite no placeholders.
*/
public function testIncomingPatternNoPlaceholders() {
$incoming_message = $this
->randomString();
$this
->config('sms_user.settings')
->set('account_registration.incoming_pattern.status', 1)
->set('account_registration.incoming_pattern.incoming_messages.0', $incoming_message)
->set('account_registration.incoming_pattern.reply.status', TRUE)
->set('account_registration.incoming_pattern.reply.message', '[user:account-name] Foo [user:mail]')
->save();
$this
->assertEquals(0, $this
->countUsers());
$this
->sendIncomingMessage('+123123123', $incoming_message);
$this
->assertEquals(1, $this
->countUsers());
// Check reply contains randomly generated username, and empty email token.
$user = $this
->getLastUser();
$reply_message = $user
->getAccountName() . ' Foo ' . $user
->getEmail();
$reply = $this
->getLastTestMessage($this->gateway);
$this
->assertEquals($reply_message, $reply
->getMessage());
}
/**
* Ensure escaped delimiters.
*/
public function testIncomingPatternPlaceholderEscapedDelimiters() {
// AccountRegistration::createAccount uses '/' delimiters. Ensure that they
// are escaped otherwise a "preg_match_all(): Unknown modifier error" will
// be thrown.
$incoming_message = $this
->randomString() . '/';
$this
->config('sms_user.settings')
->set('account_registration.incoming_pattern.status', 1)
->set('account_registration.incoming_pattern.incoming_messages.0', $incoming_message)
->save();
$this
->sendIncomingMessage('+123123123', $this
->randomString());
}
/**
* Ensure no reply sent if turned off.
*/
public function testIncomingPatternNoReply() {
$reply_message = $this
->randomString();
$this
->config('sms_user.settings')
->set('account_registration.incoming_pattern.status', TRUE)
->set('account_registration.incoming_pattern.incoming_messages.0', "[username] [password]")
->set('account_registration.incoming_pattern.reply.status', FALSE)
->set('account_registration.incoming_pattern.reply.message', $reply_message)
->save();
$incoming_message = $this
->randomMachineName() . ' ' . $this
->randomMachineName();
$this
->sendIncomingMessage('+123123123', $incoming_message);
$this
->assertEquals(1, $this
->countUsers(), 'User created');
$this
->assertFalse($this
->inTestMessages($this->gateway, $reply_message));
}
/**
* Ensure reply sent if turned on.
*/
public function testIncomingPatternHasReply() {
$reply_message = $this
->randomString();
$this
->config('sms_user.settings')
->set('account_registration.incoming_pattern.status', TRUE)
->set('account_registration.incoming_pattern.incoming_messages.0', "[username] [password]")
->set('account_registration.incoming_pattern.reply.status', TRUE)
->set('account_registration.incoming_pattern.reply.message', $reply_message)
->save();
$incoming_message = $this
->randomMachineName() . ' ' . $this
->randomMachineName();
$this
->sendIncomingMessage('+123123123', $incoming_message);
$this
->assertEquals(1, $this
->countUsers(), 'User created');
$this
->assertTrue($this
->inTestMessages($this->gateway, $reply_message));
}
/**
* Ensure account activation email sent.
*/
public function testIncomingPatternActivateEmail() {
$this
->config('sms_user.settings')
->set('account_registration.incoming_pattern.status', TRUE)
->set('account_registration.incoming_pattern.incoming_messages.0', "E [email] U [username]")
->set('account_registration.incoming_pattern.send_activation_email', TRUE)
->save();
$subject = $this
->randomMachineName();
$this
->config('user.mail')
->set('register_no_approval_required.subject', $subject)
->set('register_no_approval_required.body', 'Foo [user:display-name] Bar')
->save();
$email = 'email@domain.tld';
$username = $this
->randomMachineName();
$this
->sendIncomingMessage('+123123123', 'E ' . $email . ' U ' . $username);
$emails = $this
->getMails();
$this
->assertEquals(1, count($emails), 'One email was sent.');
$this
->assertMailString('to', $email, 1);
$this
->assertMailString('subject', $subject, 1);
$this
->assertMailString('body', 'Foo ' . $username . ' Bar', 1);
}
/**
* Ensure no activation email sent.
*/
public function testIncomingPatternNoActivateEmail() {
$this
->config('sms_user.settings')
->set('account_registration.incoming_pattern.status', TRUE)
->set('account_registration.incoming_pattern.incoming_messages.0', "E [email] P [password]")
->set('account_registration.incoming_pattern.send_activation_email', TRUE)
->save();
$this
->config('user.mail')
->set('register_no_approval_required.subject', $this
->randomMachineName())
->set('register_no_approval_required.body', $this
->randomMachineName())
->save();
$email = 'email@domain.tld';
$password = $this
->randomMachineName();
$this
->sendIncomingMessage('+123123123', 'E ' . $email . ' P ' . $password);
$emails = $this
->getMails();
$this
->assertEquals(0, count($emails), 'Zero emails sent because incoming message contained password.');
}
/**
* Test error builder.
*
* @covers ::buildError
*/
public function testErrorBuilder() {
$failure_prefix = 'foo: ';
$this
->config('sms_user.settings')
->set('account_registration.incoming_pattern.status', 1)
->set('account_registration.incoming_pattern.incoming_messages.0', "[username] [email]")
->set('account_registration.incoming_pattern.reply.status', 1)
->set('account_registration.incoming_pattern.reply.message_failure', $failure_prefix . '[error]')
->save();
$username = $this
->randomMachineName();
$email = 'email@domain.tld';
User::create([
'name' => $username,
'mail' => $email,
])
->save();
$message = "{$username} " . $this
->randomMachineName();
$this
->sendIncomingMessage('+123123123', $message);
$expected_error = 'The username ' . $username . ' is already taken. This value is not a valid email address. ';
$actual = $this
->getLastTestMessage($this->gateway)
->getMessage();
$this
->assertEquals($failure_prefix . $expected_error, $actual);
}
/**
* Test unique username.
*
* @covers ::generateUniqueUsername
*/
public function testUniqueUsername() {
$this
->config('sms_user.settings')
->set('account_registration.unrecognized_sender.status', 1)
->save();
$this
->sendIncomingMessage('+123123123', $this
->randomString());
$user1 = $this
->getLastUser();
$this
->sendIncomingMessage('+456456456', $this
->randomString());
$user2 = $this
->getLastUser();
$this
->assertNotEquals($user1
->getAccountName(), $user2
->getAccountName());
}
/**
* Ensure non-global tokens and [user:password] are replaced in reply message.
*/
public function testReplyTokens() {
$this
->config('sms_user.settings')
->set('account_registration.incoming_pattern.status', TRUE)
->set('account_registration.incoming_pattern.incoming_messages.0', "[username] [password]")
->set('account_registration.incoming_pattern.reply.status', TRUE)
->set('account_registration.incoming_pattern.reply.message', 'Username is [user:account-name] Password is [user:password]')
->save();
$username = $this
->randomMachineName();
$password = $this
->randomMachineName();
$incoming_message = $username . ' ' . $password;
$this
->sendIncomingMessage('+123123123', $incoming_message);
$reply_message = 'Username is ' . $username . ' Password is ' . $password;
$this
->assertTrue($this
->inTestMessages($this->gateway, $reply_message));
}
/**
* Send an incoming SMS message.
*
* @param string $sender_number
* The sender phone number.
* @param string $message
* The message to send inwards.
*/
protected function sendIncomingMessage($sender_number, $message) {
/** @var \Drupal\sms\Entity\SmsMessage $incoming */
$incoming = SmsMessage::create()
->setSenderNumber($sender_number)
->setDirection(Direction::INCOMING)
->setMessage($message)
->addRecipients($this
->randomPhoneNumbers(1))
->setGateway($this->gateway);
$incoming
->setResult($this
->createMessageResult($incoming));
$this->smsProvider
->queue($incoming);
}
/**
* Count number of registered users.
*
* @return int
* Number of users in database.
*/
protected function countUsers() {
return count(User::loadMultiple());
}
/**
* Count number of registered users.
*
* @return \Drupal\user\UserInterface|null
* Get last created user, or NULL if no users in database.
*/
protected function getLastUser() {
$users = User::loadMultiple();
return $users ? end($users) : NULL;
}
/**
* Check if the message body can be found in the test message memory buffer.
*
* @param \Drupal\sms\Entity\SmsGatewayInterface $sms_gateway
* A gateway plugin instance.
* @param string $message
* The message to check.
*
* @return bool
* Whether message was found in any memory messages.
*/
public function inTestMessages(SmsGatewayInterface $sms_gateway, $message) {
foreach ($this
->getTestMessages($sms_gateway) as $sms_message) {
if ($sms_message
->getMessage() == $message) {
return TRUE;
}
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AssertContentTrait:: |
protected | property | The current raw content. | |
AssertContentTrait:: |
protected | property | The drupalSettings value from the current raw $content. | |
AssertContentTrait:: |
protected | property | The XML structure parsed from the current raw $content. | 1 |
AssertContentTrait:: |
protected | property | The plain-text content of raw $content (text nodes). | |
AssertContentTrait:: |
protected | function | Passes if the raw text IS found escaped on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists with the given name or ID. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists with the given ID and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists with the given name and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists in the current page by the given XPath. | |
AssertContentTrait:: |
protected | function | Asserts that a checkbox field in the current page is checked. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists in the current page with a given Xpath result. | |
AssertContentTrait:: |
protected | function | Passes if a link with the specified label is found. | |
AssertContentTrait:: |
protected | function | Passes if a link containing a given href (part) is found. | |
AssertContentTrait:: |
protected | function | Asserts that each HTML ID is used for just a single element. | |
AssertContentTrait:: |
protected | function | Passes if the raw text IS NOT found escaped on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist with the given name or ID. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist with the given ID and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist with the given name and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist or its value does not match, by XPath. | |
AssertContentTrait:: |
protected | function | Asserts that a checkbox field in the current page is not checked. | |
AssertContentTrait:: |
protected | function | Passes if a link with the specified label is not found. | |
AssertContentTrait:: |
protected | function | Passes if a link containing a given href (part) is not found. | |
AssertContentTrait:: |
protected | function | Passes if a link containing a given href is not found in the main region. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page does not exist. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page is not checked. | |
AssertContentTrait:: |
protected | function | Triggers a pass if the perl regex pattern is not found in raw content. | |
AssertContentTrait:: |
protected | function | Passes if the raw text is NOT found on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Passes if the page (with HTML stripped) does not contains the text. | |
AssertContentTrait:: |
protected | function | Pass if the page title is not the given string. | |
AssertContentTrait:: |
protected | function | Passes if the text is found MORE THAN ONCE on the text version of the page. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page exists. | |
AssertContentTrait:: |
protected | function | Asserts that a select option with the visible text exists. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page is checked. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page is checked. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page exists. | |
AssertContentTrait:: |
protected | function | Triggers a pass if the Perl regex pattern is found in the raw content. | |
AssertContentTrait:: |
protected | function | Passes if the raw text IS found on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Passes if the page (with HTML stripped) contains the text. | |
AssertContentTrait:: |
protected | function | Helper for assertText and assertNoText. | |
AssertContentTrait:: |
protected | function | Asserts that a Perl regex pattern is found in the plain-text content. | |
AssertContentTrait:: |
protected | function | Asserts themed output. | |
AssertContentTrait:: |
protected | function | Pass if the page title is the given string. | |
AssertContentTrait:: |
protected | function | Passes if the text is found ONLY ONCE on the text version of the page. | |
AssertContentTrait:: |
protected | function | Helper for assertUniqueText and assertNoUniqueText. | |
AssertContentTrait:: |
protected | function | Builds an XPath query. | |
AssertContentTrait:: |
protected | function | Helper: Constructs an XPath for the given set of attributes and value. | |
AssertContentTrait:: |
protected | function | Searches elements using a CSS selector in the raw content. | |
AssertContentTrait:: |
protected | function | Get all option elements, including nested options, in a select. | |
AssertContentTrait:: |
protected | function | Gets the value of drupalSettings for the currently-loaded page. | |
AssertContentTrait:: |
protected | function | Gets the current raw content. | |
AssertContentTrait:: |
protected | function | Get the selected value from a select field. | |
AssertContentTrait:: |
protected | function | Retrieves the plain-text content from the current raw content. | |
AssertContentTrait:: |
protected | function | Get the current URL from the cURL handler. | 1 |
AssertContentTrait:: |
protected | function | Parse content returned from curlExec using DOM and SimpleXML. | |
AssertContentTrait:: |
protected | function | Removes all white-space between HTML tags from the raw content. | |
AssertContentTrait:: |
protected | function | Sets the value of drupalSettings for the currently-loaded page. | |
AssertContentTrait:: |
protected | function | Sets the raw content (e.g. HTML). | |
AssertContentTrait:: |
protected | function | Performs an xpath search on the contents of the internal browser. | |
AssertHelperTrait:: |
protected static | function | Casts MarkupInterface objects into strings. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertTrue() instead. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertEquals() instead. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertSame() instead. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertEquals() instead. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertNotEquals() instead. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertNotSame() instead. | |
AssertLegacyTrait:: |
protected | function | Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertTrue() instead. | |
AssertLegacyTrait:: |
protected | function | ||
AssertMailTrait:: |
protected | function | Asserts that the most recently sent email message has the given value. | |
AssertMailTrait:: |
protected | function | Asserts that the most recently sent email message has the pattern in it. | |
AssertMailTrait:: |
protected | function | Asserts that the most recently sent email message has the string in it. | |
AssertMailTrait:: |
protected | function | Gets an array containing all emails sent during this test case. | |
AssertMailTrait:: |
protected | function | Outputs to verbose the most recent $count emails sent. | |
ConfigTestTrait:: |
protected | function | Returns a ConfigImporter object to import test configuration. | |
ConfigTestTrait:: |
protected | function | Copies configuration objects from source storage to target storage. | |
KernelTestBase:: |
protected | property | Back up and restore any global variables that may be changed by tests. | |
KernelTestBase:: |
protected | property | Back up and restore static class properties that may be changed by tests. | |
KernelTestBase:: |
protected | property | Contains a few static class properties for performance. | |
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | @todo Move into Config test base class. | 7 |
KernelTestBase:: |
protected static | property | An array of config object names that are excluded from schema checking. | |
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | Do not forward any global state from the parent process to the processes that run the actual tests. | |
KernelTestBase:: |
protected | property | The app root. | |
KernelTestBase:: |
protected | property | Kernel tests are run in separate processes because they allow autoloading of code from extensions. Running the test in a separate process isolates this behavior from other tests. Subclasses should not override this property. | |
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | Set to TRUE to strict check all configuration saved. | 6 |
KernelTestBase:: |
protected | property | The virtual filesystem root directory. | |
KernelTestBase:: |
protected | function | 1 | |
KernelTestBase:: |
protected | function | Bootstraps a basic test environment. | |
KernelTestBase:: |
private | function | Bootstraps a kernel for a test. | |
KernelTestBase:: |
protected | function | Configuration accessor for tests. Returns non-overridden configuration. | |
KernelTestBase:: |
protected | function | Disables modules for this test. | |
KernelTestBase:: |
protected | function | Enables modules for this test. | |
KernelTestBase:: |
protected | function | Gets the config schema exclusions for this test. | |
KernelTestBase:: |
protected | function | Returns the Database connection info to be used for this test. | 1 |
KernelTestBase:: |
public | function | ||
KernelTestBase:: |
private | function | Returns Extension objects for $modules to enable. | |
KernelTestBase:: |
private static | function | Returns the modules to enable for this test. | |
KernelTestBase:: |
protected | function | Initializes the FileCache component. | |
KernelTestBase:: |
protected | function | Installs default configuration for a given list of modules. | |
KernelTestBase:: |
protected | function | Installs the storage schema for a specific entity type. | |
KernelTestBase:: |
protected | function | Installs database tables from a module schema definition. | |
KernelTestBase:: |
protected | function | Returns whether the current test method is running in a separate process. | |
KernelTestBase:: |
protected | function | ||
KernelTestBase:: |
public | function |
Registers test-specific services. Overrides ServiceProviderInterface:: |
26 |
KernelTestBase:: |
protected | function | Renders a render array. | 1 |
KernelTestBase:: |
protected | function | Sets the install profile and rebuilds the container to update it. | |
KernelTestBase:: |
protected | function | Sets an in-memory Settings variable. | |
KernelTestBase:: |
public static | function | 1 | |
KernelTestBase:: |
protected | function | Sets up the filesystem, so things like the file directory. | 2 |
KernelTestBase:: |
protected | function | Stops test execution. | |
KernelTestBase:: |
protected | function | 6 | |
KernelTestBase:: |
public | function | @after | |
KernelTestBase:: |
protected | function | Dumps the current state of the virtual filesystem to STDOUT. | |
KernelTestBase:: |
public | function | BC: Automatically resolve former KernelTestBase class properties. | |
KernelTestBase:: |
public | function | Prevents serializing any properties. | |
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
RandomGeneratorTrait:: |
protected | property | The random generator. | |
RandomGeneratorTrait:: |
protected | function | Gets the random generator for the utility methods. | |
RandomGeneratorTrait:: |
protected | function | Generates a unique random string containing letters and numbers. | 1 |
RandomGeneratorTrait:: |
public | function | Generates a random PHP object. | |
RandomGeneratorTrait:: |
public | function | Generates a pseudo-random string of ASCII characters of codes 32 to 126. | |
RandomGeneratorTrait:: |
public | function | Callback for random string validation. | |
SmsFrameworkTestTrait:: |
protected | function | Creates an entity, and optionally adds phone numbers. | |
SmsFrameworkTestTrait:: |
protected | function | Creates a memory gateway. | |
SmsFrameworkTestTrait:: |
protected | function | Create a result and reports for a message. | |
SmsFrameworkTestTrait:: |
protected | function | Get all messages received by a gateway. | |
SmsFrameworkTestTrait:: |
protected | function | Get the last message sent to gateway. | |
SmsFrameworkTestTrait:: |
public | function | Get the last SMS message sent to 'Memory' gateway. | |
SmsFrameworkTestTrait:: |
protected | function | Gets the last SMS report for messages sent to 'Memory' gateway. | |
SmsFrameworkTestTrait:: |
protected | function | Gets the last phone number verification that was created. | |
SmsFrameworkTestTrait:: |
protected | function | Gets an SMS report for message with message ID. | |
SmsFrameworkTestTrait:: |
protected | function | Gets all SMS reports for messages sent to 'Memory' gateway. | |
SmsFrameworkTestTrait:: |
public | function | Get all SMS messages sent to a 'Memory' gateway. | |
SmsFrameworkTestTrait:: |
protected | function | Generates random phone numbers for tests. | |
SmsFrameworkTestTrait:: |
protected | function | Generates a random SMS message by the specified user. | |
SmsFrameworkTestTrait:: |
protected | function | Resets incoming messages stored in memory by gateway. | |
SmsFrameworkTestTrait:: |
protected | function | Resets the SMS reports stored in memory by 'Memory' gateway. | |
SmsFrameworkTestTrait:: |
public | function | Resets SMS messages stored in memory by 'Memory' gateway. | |
SmsFrameworkTestTrait:: |
protected | function | Sets the fallback gateway. | |
SmsFrameworkTestTrait:: |
protected | function | Forces verification of a phone number for an entity. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
protected | property | The account registration service. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
protected | property | A memory gateway. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public static | property |
Modules to enable. Overrides KernelTestBase:: |
|
SmsFrameworkUserAccountRegistrationServiceTest:: |
protected | property | A phone field ofr testing. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
protected | property | Phone number settings for user entity type. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
protected | property | The default SMS provider. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
protected | function | Count number of registered users. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
protected | function | Count number of registered users. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Check if the message body can be found in the test message memory buffer. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
protected | function | Send an incoming SMS message. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
protected | function |
Overrides SmsFrameworkKernelBase:: |
|
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Test error builder. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Ensure account activation email sent. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Ensure reply sent if turned on. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Test if a duplicated placeholder is not confirmed. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Test if a duplicated placeholder is confirmed. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Ensure no activation email sent. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Test if a user is created despite no email address. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Test if a user is created despite no placeholders. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Ensure no reply sent if turned off. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Ensure escaped delimiters. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Test all placeholders make their way into the user object. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Test user is created from a incoming pattern message. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Ensure non-global tokens and [user:password] are replaced in reply message. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Test unique username. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Test user is created if a unrecognised phone number is used as sender. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Test a user is not created if the sender phone number is already used. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Ensure reply sent if turned on. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Test if a user is created despite no email address. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Ensure no reply sent if turned off. | |
SmsFrameworkUserAccountRegistrationServiceTest:: |
public | function | Ensure incoming SMS does not create messages or users. | |
StorageCopyTrait:: |
protected static | function | Copy the configuration from one storage to another and remove stale items. | |
TestRequirementsTrait:: |
private | function | Checks missing module requirements. | |
TestRequirementsTrait:: |
protected | function | Check module requirements for the Drupal use case. | 1 |
TestRequirementsTrait:: |
protected static | function | Returns the Drupal root directory. |