Skip to content
Snippets Groups Projects
Commit dc14efec authored by Pranali  Kalavadia's avatar Pranali Kalavadia Committed by Yas Naoi
Browse files

Issue #3118425 by Pranali.addweb, yas: Refactor $this->assertText to...

Issue #3118425 by Pranali.addweb, yas: Refactor $this->assertText to $this->assertSession()->pageTextContains (3) (Cloud Budget)
parent 92e6dec2
No related branches found
No related tags found
No related merge requests found
...@@ -48,12 +48,12 @@ class CloudCreditTest extends CloudBudgetTestCase { ...@@ -48,12 +48,12 @@ class CloudCreditTest extends CloudBudgetTestCase {
$this->t('Save') $this->t('Save')
); );
$this->assertResponse(200); $this->assertResponse(200);
$this->assertText($this->t('The Cloud Credit "@name" has been created.', ['@name' => $name])); $this->assertSession()->pageTextContains($this->t('The Cloud Credit "@name" has been created.', ['@name' => $name]));
// Make sure listing. // Make sure listing.
$this->drupalGet("/clouds/budget/$cloud_context/credit"); $this->drupalGet("/clouds/budget/$cloud_context/credit");
$this->assertResponse(200); $this->assertResponse(200);
$this->assertText($name); $this->assertSession()->pageTextContains($name);
} }
// Edit a Cloud Credit. // Edit a Cloud Credit.
...@@ -70,7 +70,7 @@ class CloudCreditTest extends CloudBudgetTestCase { ...@@ -70,7 +70,7 @@ class CloudCreditTest extends CloudBudgetTestCase {
$name = explode(' ', $add[$i]['user[0][target_id]'])[0]; $name = explode(' ', $add[$i]['user[0][target_id]'])[0];
$this->assertResponse(200); $this->assertResponse(200);
$this->assertText($this->t( $this->assertSession()->pageTextContains($this->t(
'The Cloud Credit "@name" has been saved.', 'The Cloud Credit "@name" has been saved.',
['@name' => $name] ['@name' => $name]
)); ));
...@@ -87,7 +87,7 @@ class CloudCreditTest extends CloudBudgetTestCase { ...@@ -87,7 +87,7 @@ class CloudCreditTest extends CloudBudgetTestCase {
$this->t('Delete') $this->t('Delete')
); );
$this->assertResponse(200); $this->assertResponse(200);
$this->assertText($this->t( $this->assertSession()->pageTextContains($this->t(
'The Cloud Credit "@name" has been deleted.', 'The Cloud Credit "@name" has been deleted.',
['@name' => $name] ['@name' => $name]
)); ));
......
...@@ -66,10 +66,10 @@ trait CloudBudgetTestEntityTrait { ...@@ -66,10 +66,10 @@ trait CloudBudgetTestEntityTrait {
] ]
); );
$this->assertText($message); $this->assertSession()->pageTextContains($message);
foreach ($entities_data as $entity_data) { foreach ($entities_data as $entity_data) {
$entity_name = $entity_data->label(); $entity_name = $entity_data->label();
$this->assertText($entity_name); $this->assertSession()->pageTextContains($entity_name);
} }
// Operation. // Operation.
...@@ -83,13 +83,11 @@ trait CloudBudgetTestEntityTrait { ...@@ -83,13 +83,11 @@ trait CloudBudgetTestEntityTrait {
$this->assertResponse(200); $this->assertResponse(200);
foreach ($entities_data as $entity_data) { foreach ($entities_data as $entity_data) {
$this->assertText( $this->assertSession()->pageTextContains($this->t('The @type "@label" has been @operation_passive.', [
$this->t('The @type "@label" has been @operation_passive.', [ '@type' => $entity_data->getEntityType()->getLabel(),
'@type' => $entity_data->getEntityType()->getLabel(), '@label' => $entity_data->label(),
'@label' => $entity_data->label(), '@operation_passive' => $operation_passive,
'@operation_passive' => $operation_passive, ]));
])
);
} }
$operation_passive_upper = ucfirst($operation_passive); $operation_passive_upper = ucfirst($operation_passive);
...@@ -103,7 +101,7 @@ trait CloudBudgetTestEntityTrait { ...@@ -103,7 +101,7 @@ trait CloudBudgetTestEntityTrait {
'@entity_count' => $entity_count, '@entity_count' => $entity_count,
]) ])
); );
$this->assertText($message); $this->assertSession()->pageTextContains($message);
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment