private function TMGMTUiTest::assertJobProgress in Translation Management Tool 8
Asserts task item progress bar.
Parameters
int $row: The row of the item you want to check.
int $pending: The amount of pending items.
int $reviewed: The amount of reviewed items.
int $translated: The amount of translated items.
int $accepted: The amount of accepted items.
1 call to TMGMTUiTest::assertJobProgress()
- TMGMTUiTest::testProgress in tests/
src/ Functional/ TMGMTUiTest.php - Tests of the job item review process.
File
- tests/
src/ Functional/ TMGMTUiTest.php, line 1103
Class
- TMGMTUiTest
- Verifies basic functionality of the user interface
Namespace
Drupal\Tests\tmgmt\FunctionalCode
private function assertJobProgress($row, $pending, $translated, $reviewed, $accepted) {
$result = $this
->xpath('//table/tbody/tr[' . $row . ']/td[6]')[0];
$div_number = 1;
if ($pending > 0) {
$this
->assertEquals('tmgmt-progress tmgmt-progress-pending', $result
->find('css', "div > div:nth-child({$div_number})")
->getAttribute('class'));
$div_number++;
}
else {
$this
->assertNotEquals('tmgmt-progress tmgmt-progress-pending', $result
->find('css', "div > div:nth-child({$div_number})")
->getAttribute('class'));
}
if ($translated > 0) {
$this
->assertEquals('tmgmt-progress tmgmt-progress-translated', $result
->find('css', "div > div:nth-child({$div_number})")
->getAttribute('class'));
$div_number++;
}
else {
$child = $result
->find('css', "div > div:nth-child({$div_number})");
$this
->assertTrue(!$child || $child
->getAttribute('class') != 'tmgmt-progress tmgmt-progress-translated');
}
if ($reviewed > 0) {
$this
->assertEquals('tmgmt-progress tmgmt-progress-reviewed', $result
->find('css', "div > div:nth-child({$div_number})")
->getAttribute('class'));
$div_number++;
}
else {
$child = $result
->find('css', "div > div:nth-child({$div_number})");
$this
->assertTrue(!$child || $child
->getAttribute('class') != 'tmgmt-progress tmgmt-progress-reviewed');
}
if ($accepted > 0) {
$this
->assertEquals('tmgmt-progress tmgmt-progress-accepted', $result
->find('css', "div > div:nth-child({$div_number})")
->getAttribute('class'));
}
else {
$child = $result
->find('css', "div > div:nth-child({$div_number})");
$this
->assertTrue(!$child || $child
->getAttribute('class') != 'tmgmt-progress tmgmt-progress-accepted');
}
$title = t('Pending: @pending, translated: @translated, reviewed: @reviewed, accepted: @accepted.', array(
'@pending' => $pending,
'@translated' => $translated,
'@reviewed' => $reviewed,
'@accepted' => $accepted,
));
$this
->assertEquals($title, $result
->find('css', 'div')
->getAttribute('title'));
}