Loading tests/src/Unit/Entity/EncryptionProfileTest.php +34 −5 Original line number Diff line number Diff line Loading @@ -84,7 +84,10 @@ class EncryptionProfileTest extends UnitTestCase { $this->keyRepository = $this->createMock('\Drupal\key\KeyRepository'); // Mock a plugin collection. $this->pluginCollection = $this->createMock('\Drupal\Core\Plugin\DefaultLazyPluginCollection'); $this->pluginCollection = $this->getMockBuilder('\Drupal\Core\Plugin\DefaultLazyPluginCollection') ->disableOriginalConstructor() ->setMethods(['get', 'set', 'addInstanceID']) ->getMock(); } /** Loading @@ -97,7 +100,16 @@ class EncryptionProfileTest extends UnitTestCase { */ public function testValidate($enc_method_id, $enc_key, $enc_method_def, $expected_errors) { // Set up a mock for the EncryptionProfile class to mock some methods. $encryption_profile = $this->createMock('\Drupal\encrypt\Entity\EncryptionProfile'); $encryption_profile = $this->getMockBuilder('\Drupal\encrypt\Entity\EncryptionProfile') ->setMethods([ 'getEncryptionMethod', 'getEncryptionMethodId', 'getEncryptionKey', 'getEncryptionKeyId', ] ) ->disableOriginalConstructor() ->getMock(); // Set expectations for the EncryptionMethod. $this->encryptionMethod->expects($this->any()) Loading Loading @@ -190,7 +202,14 @@ class EncryptionProfileTest extends UnitTestCase { */ public function testGetEncryptionMethod() { // Set up a mock for the EncryptionProfile class to mock some methods. $encryption_profile = $this->createMock('\Drupal\encrypt\Entity\EncryptionProfile'); $encryption_profile = $this->getMockBuilder('\Drupal\encrypt\Entity\EncryptionProfile') ->setMethods([ 'getPluginCollection', 'getEncryptionMethodId', ] ) ->disableOriginalConstructor() ->getMock(); // Set up expectations for plugin collection. $this->pluginCollection->expects($this->atLeastOnce()) Loading @@ -217,7 +236,10 @@ class EncryptionProfileTest extends UnitTestCase { */ public function testSetEncryptionMethod() { // Set up a mock for the EncryptionProfile class to mock some methods. $encryption_profile = $this->createMock('\Drupal\encrypt\Entity\EncryptionProfile'); $encryption_profile = $this->getMockBuilder('\Drupal\encrypt\Entity\EncryptionProfile') ->setMethods(['getPluginCollection']) ->disableOriginalConstructor() ->getMock(); $this->pluginCollection->expects($this->once()) ->method('addInstanceID'); Loading @@ -242,7 +264,14 @@ class EncryptionProfileTest extends UnitTestCase { */ public function testGetEncryptionKey() { // Set up a mock for the EncryptionProfile class to mock some methods. $encryption_profile = $this->createMock('\Drupal\encrypt\Entity\EncryptionProfile'); $encryption_profile = $this->getMockBuilder('\Drupal\encrypt\Entity\EncryptionProfile') ->setMethods([ 'getKeyRepository', 'getEncryptionKeyId', ] ) ->disableOriginalConstructor() ->getMock(); $this->keyRepository->expects($this->any()) ->method('getKey') Loading Loading
tests/src/Unit/Entity/EncryptionProfileTest.php +34 −5 Original line number Diff line number Diff line Loading @@ -84,7 +84,10 @@ class EncryptionProfileTest extends UnitTestCase { $this->keyRepository = $this->createMock('\Drupal\key\KeyRepository'); // Mock a plugin collection. $this->pluginCollection = $this->createMock('\Drupal\Core\Plugin\DefaultLazyPluginCollection'); $this->pluginCollection = $this->getMockBuilder('\Drupal\Core\Plugin\DefaultLazyPluginCollection') ->disableOriginalConstructor() ->setMethods(['get', 'set', 'addInstanceID']) ->getMock(); } /** Loading @@ -97,7 +100,16 @@ class EncryptionProfileTest extends UnitTestCase { */ public function testValidate($enc_method_id, $enc_key, $enc_method_def, $expected_errors) { // Set up a mock for the EncryptionProfile class to mock some methods. $encryption_profile = $this->createMock('\Drupal\encrypt\Entity\EncryptionProfile'); $encryption_profile = $this->getMockBuilder('\Drupal\encrypt\Entity\EncryptionProfile') ->setMethods([ 'getEncryptionMethod', 'getEncryptionMethodId', 'getEncryptionKey', 'getEncryptionKeyId', ] ) ->disableOriginalConstructor() ->getMock(); // Set expectations for the EncryptionMethod. $this->encryptionMethod->expects($this->any()) Loading Loading @@ -190,7 +202,14 @@ class EncryptionProfileTest extends UnitTestCase { */ public function testGetEncryptionMethod() { // Set up a mock for the EncryptionProfile class to mock some methods. $encryption_profile = $this->createMock('\Drupal\encrypt\Entity\EncryptionProfile'); $encryption_profile = $this->getMockBuilder('\Drupal\encrypt\Entity\EncryptionProfile') ->setMethods([ 'getPluginCollection', 'getEncryptionMethodId', ] ) ->disableOriginalConstructor() ->getMock(); // Set up expectations for plugin collection. $this->pluginCollection->expects($this->atLeastOnce()) Loading @@ -217,7 +236,10 @@ class EncryptionProfileTest extends UnitTestCase { */ public function testSetEncryptionMethod() { // Set up a mock for the EncryptionProfile class to mock some methods. $encryption_profile = $this->createMock('\Drupal\encrypt\Entity\EncryptionProfile'); $encryption_profile = $this->getMockBuilder('\Drupal\encrypt\Entity\EncryptionProfile') ->setMethods(['getPluginCollection']) ->disableOriginalConstructor() ->getMock(); $this->pluginCollection->expects($this->once()) ->method('addInstanceID'); Loading @@ -242,7 +264,14 @@ class EncryptionProfileTest extends UnitTestCase { */ public function testGetEncryptionKey() { // Set up a mock for the EncryptionProfile class to mock some methods. $encryption_profile = $this->createMock('\Drupal\encrypt\Entity\EncryptionProfile'); $encryption_profile = $this->getMockBuilder('\Drupal\encrypt\Entity\EncryptionProfile') ->setMethods([ 'getKeyRepository', 'getEncryptionKeyId', ] ) ->disableOriginalConstructor() ->getMock(); $this->keyRepository->expects($this->any()) ->method('getKey') Loading