-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathContentArticleWidgetTest.php
More file actions
77 lines (64 loc) · 2.5 KB
/
ContentArticleWidgetTest.php
File metadata and controls
77 lines (64 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/**
* This file is part of MetaModels/attribute_translatedcontentarticle.
*
* (c) 2012-2024 The MetaModels team.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* This project is provided in good faith and hope to be usable by anyone.
*
* @package MetaModels
* @subpackage AttributeTranslatedContentArticle
* @author Stefan Heimes <stefan_heimes@hotmail.com>
* @author Sven Baumann <baumann.sv@gmail.com>
* @author Ingolf Steinhardt <info@e-spin.de>
* @copyright 2012-2024 The MetaModels team.
* @license https://github.com/MetaModels/attribute_translatedcontentarticle/blob/master/LICENSE LGPL-3.0-or-later
* @filesource
*/
declare(strict_types=1);
namespace Widgets;
use Contao\Config;
use Contao\CoreBundle\Framework\Adapter;
use ContaoCommunityAlliance\DcGeneral\Contao\Compatibility\DcCompat;
use Doctrine\DBAL\Connection;
use MetaModels\AttributeTranslatedContentArticleBundle\Widgets\ContentArticleWidget;
use PHPUnit\Framework\TestCase;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* @covers \MetaModels\AttributeTranslatedContentArticleBundle\Widgets\ContentArticleWidget
*/
class ContentArticleWidgetTest extends TestCase
{
public function testNewInstance(): void
{
$dcCompat = $this->getMockBuilder(DcCompat::class)
->disableOriginalConstructor()
->getMock();
$connection = $this->createMock(Connection::class);
$input = $this->getMockBuilder(Adapter::class)
->disableOriginalConstructor()
->addMethods(['get'])
->getMock();
$input
->expects(self::once())
->method('get')
->willReturn(1);
$translator = $this->getMockBuilder(TranslatorInterface::class)
->getMock();
$widget = $this->getMockBuilder(ContentArticleWidget::class)
->setConstructorArgs([null, $dcCompat, $connection, $input, $translator])
->onlyMethods(['import'])
->getMock();
$widget
->expects(self::any())
->method('import')
->willReturnCallback(function ($parameters) {
$this->assertInstanceof(Config::class, $parameters[0]);
$this->assertSame('Config', $parameters[1]);
});
self::assertEmpty($widget->getAttributes());
}
}