View source
<?php
namespace Drupal\Tests\onlyone\Unit;
use Drupal\Tests\UnitTestCase;
use Drupal\onlyone\OnlyOnePrintAdminPage;
use Drupal\Tests\onlyone\Traits\OnlyOneUnitTestTrait;
class OnlyOnePrintAdminPageTest extends UnitTestCase {
use OnlyOneUnitTestTrait;
public function testGetContentTypesListForPrint(array $expected, array $content_types) {
$onlyOnePrintAdminPage = new OnlyOnePrintAdminPage();
$this
->assertEquals($expected, $onlyOnePrintAdminPage
->getContentTypesListForPrint($content_types));
}
public function providerGetContentTypesListForPrint() {
$content_types = $this
->getContentTypesObjectList();
$expected = [
[
'page' => 'Basic Page <strong>(En: 1 Node, Es: 1 Node)</strong>',
'blog' => 'Blog Post <strong>(0 Nodes)</strong>',
'car' => 'Car <strong>(Not specified: 1 Node, Not applicable: 2 Nodes, En: 1 Node)</strong>',
'article' => 'Article <strong>(Not specified: 1 Node, En: 2 Nodes, Es: 1 Node)</strong>',
],
[
'blog' => 'Blog Post <strong>(En: 1 Node)</strong>',
'car' => 'Car <strong>(0 Nodes)</strong>',
],
[
'page' => 'Basic Page <strong>(En: 1 Node, Es: 1 Node)</strong>',
'car' => 'Car <strong>(0 Nodes)</strong>',
'article' => 'Article <strong>(Es: 3 Nodes)</strong>',
],
[
'page' => 'Basic Page <strong>(1 Node)</strong>',
'blog' => 'Blog Post <strong>(2 Nodes)</strong>',
'car' => 'Car <strong>(0 Nodes)</strong>',
'article' => 'Article <strong>(5 Nodes)</strong>',
],
[
'blog' => 'Blog Post <strong>(0 Nodes)</strong>',
'car' => 'Car <strong>(1 Node)</strong>',
],
[
'page' => 'Basic Page <strong>(1 Node)</strong>',
'car' => 'Car <strong>(5 Nodes)</strong>',
'article' => 'Article <strong>(3 Nodes)</strong>',
],
];
$tests['multilingual 1'] = [
$expected[0],
$content_types[0],
];
$tests['multilingual 2'] = [
$expected[1],
$content_types[1],
];
$tests['multilingual 3'] = [
$expected[2],
$content_types[2],
];
$tests['non-multilingual 1'] = [
$expected[3],
$content_types[3],
];
$tests['non-multilingual 2'] = [
$expected[4],
$content_types[4],
];
$tests['non-multilingual 3'] = [
$expected[5],
$content_types[5],
];
return $tests;
}
}