public function UpgradeRectorUiTest::testUiAfterScan in Upgrade Rector 8
Test the user interface after running rector.
File
- tests/
src/ Functional/ UpgradeRectorUiTest.php, line 49
Class
- UpgradeRectorUiTest
- Tests the UI before and after running scans.
Namespace
Drupal\Tests\upgrade_rector\FunctionalCode
public function testUiAfterScan() {
$edit = [
'custom[data][project]' => 'upgrade_rector_test_error',
];
$this
->drupalPostForm('admin/reports/upgrade-rector', $edit, 'Run rector');
$page = $this
->getSession()
->getPage();
$assert_session = $this
->assertSession();
$assert_session
->buttonExists('Run rector');
// One module result exists.
$this
->assertCount(3, $this
->getSession()
->getPage()
->findAll('css', 'details'));
$this
->assertCount(1, $this
->getSession()
->getPage()
->findAll('css', 'details#edit-custom-data-upgrade-rector-test-error'));
// Find patch portion for drupal_set_message().
//$this->assertSession()->responseMatches("!- drupal_set_message.'Sample message'.;!");
//$this->assertSession()->responseMatches("!\+ .Drupal::messenger..->addStatus.'Sample message'.;!");
// At least two files should be processed.
$this
->assertSession()
->responseMatches("!upgrade_rector_test_error.module!");
$this
->assertSession()
->responseMatches("!UpgradeRectorTestErrorForm.php!");
// This rector should have been executed.
$this
->assertSession()
->responseMatches("!DrupalRector\\\\Rector\\\\Deprecation\\\\DrupalSetMessageRector!");
}