public function OnlyOneTest::setUp in Allow a content type only once (Only One) 8
Overrides UnitTestCase::setUp
File
- tests/
src/ Unit/ OnlyOneTest.php, line 61
Class
- OnlyOneTest
- Tests the OnlyOne class methods.
Namespace
Drupal\Tests\onlyone\UnitCode
public function setUp() {
parent::setUp();
// Entity type manager mock.
$this->entityTypeManager = $this
->createMock('Drupal\\Core\\Entity\\EntityTypeManagerInterface');
// Connection mock.
$this->connection = $this
->createMock('Drupal\\Core\\Database\\Connection');
// Language manager mock.
$this->languageManager = $this
->createMock('Drupal\\Core\\Language\\LanguageManagerInterface');
// Config factory mock.
$this->configFactory = $this
->createMock('Drupal\\Core\\Config\\ConfigFactoryInterface');
// Creating the object.
$this->onlyOne = new OnlyOne($this->entityTypeManager, $this->connection, $this->languageManager, $this->configFactory, $this
->getStringTranslationStub());
}