Asserts the task item progress bar.
string $row: Identifier for the row.
int $untranslated: The amount of untranslated items.
int $translated: The amount of translated items.
int $completed: The amount of completed items.
protected function assertTaskItemProgress($row, $untranslated, $translated, $completed) {
$result = $this
->xpath('//*[@id="edit-items"]/div/div/table/tbody/tr[td//text()[contains(., :row)]]/td[2]', [
':row' => $row,
])[0];
$div_number = 1;
if ($untranslated > 0) {
$this
->assertEquals('tmgmt-local-progress-untranslated', $result
->find('css', "div > div:nth-child({$div_number})")
->getAttribute('class'));
$div_number++;
}
else {
$this
->assertNotEquals('tmgmt-local-progress-untranslated', $result
->find('css', "div > div:nth-child({$div_number})")
->getAttribute('class'));
}
if ($translated > 0) {
$this
->assertEquals('tmgmt-local-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-local-progress-translated');
}
if ($completed > 0) {
$this
->assertEquals('tmgmt-local-progress-completed', $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-local-progress-completed');
}
$title = t('Untranslated: @untranslated, translated: @translated, completed: @completed.', array(
'@untranslated' => $untranslated,
'@translated' => $translated,
'@completed' => $completed,
));
$this
->assertEquals($title, $result
->find('css', 'div')
->getAttribute('title'));
}