Asserts task item progress bar.
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.
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'));
}