Loading modules/cloud_service_providers/vmware/tests/src/Functional/VmwareTestBase.php +98 Changes for modules/cloud_service_providers/vmware/tests/src/Functional/VmwareTestBase.php: 98 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Drupal\Tests\vmware\Functional; use Drupal\cloud\Entity\CloudConfig; use Drupal\cloud\Entity\CloudContentEntityBase; use Drupal\Tests\cloud\Functional\CloudTestBase; use Drupal\Tests\vmware\Traits\VmwareTestEntityTrait; use Drupal\Tests\vmware\Traits\VmwareTestFormDataTrait; use Drupal\Tests\vmware\Traits\VmwareTestMockTrait; /** * Base Test Case class for Vmware. */ abstract class VmwareTestBase extends CloudTestBase { use VmwareTestEntityTrait; use VmwareTestFormDataTrait; use VmwareTestMockTrait; /** * Modules to enable. * * @var array */ public static $modules = [ 'cloud', 'vmware', ]; /** * Set up test. * * @throws \Drupal\Core\Entity\EntityStorageException */ protected function setUp() { parent::setUp(); $this->init(__CLASS__, $this); } /** * Create cloud context. * * @param string $bundle * The CloudConfig Bundle Type ('vmware'). * * @return \Drupal\cloud\Entity\CloudConfig * The cloud service provider (CloudConfig) entity. */ protected function createCloudContext($bundle = 'vmware'): CloudContentEntityBase { $random = $this->random; $this->cloudContext = $random->name(8); return $this->createTestEntity(CloudConfig::class, [ 'type' => $bundle, 'cloud_context' => $this->cloudContext, 'name' => sprintf('Vmware - %s - %s', date('Y/m/d H:i:s'), $random->name(8, TRUE)), 'field_vcenter_url' => $random->name(32, TRUE), 'field_vcenter_username' => $random->name(32, TRUE), 'field_vcenter_password' => $random->name(32, TRUE), ]); } /** * Test bulk operation for entities. * * @param string $type * The name of the entity type. For example, instance. * @param array $entities * The data of entities. * @param string $operation * The operation. * @param string $passive_operation * The passive voice of operation. * @param string $path_prefix * The URL path of prefix. * * @throws \Behat\Mink\Exception\ExpectationException * @throws \Behat\Mink\Exception\ResponseTextException */ protected function runTestEntityBulk( $type, array $entities, $operation = 'delete', $passive_operation = 'deleted', $path_prefix = '/clouds/vmware'): void { $this->runTestEntityBulkImpl( $type, $entities, $operation, $passive_operation, $path_prefix ); } } modules/cloud_service_providers/vmware/tests/src/Functional/VmwareVmTest.php +45 Changes for modules/cloud_service_providers/vmware/tests/src/Functional/VmwareVmTest.php: 45 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Drupal\Tests\vmware\Functional; use Drupal\Tests\cloud\Traits\CloudConfigTestEntityTrait; /** * Tests Vmware VM. * * @group Vmware */ class VmwareVmTest extends VmwareTestBase { use CloudConfigTestEntityTrait; public const VMWARE_VM_REPEAT_COUNT = 1; /** * {@inheritdoc} */ protected function getPermissions(): array { return [ 'list vmware vm', 'add vmware vm', 'view vmware vm', 'edit vmware vm', 'delete vmware vm', ]; } /** * Tests CRUD for VM. * * @throws \Behat\Mink\Exception\ResponseTextException * @throws \Behat\Mink\Exception\ExpectationException */ public function testVm(): void { $cloud_context = $this->cloudContext; // List VM for VMware. $this->drupalGet("/clouds/vmware/$cloud_context/vm"); $this->assertNoErrorMessage(); } } modules/cloud_service_providers/vmware/tests/src/Traits/VmwareTestEntityTrait.php +14 Changes for modules/cloud_service_providers/vmware/tests/src/Traits/VmwareTestEntityTrait.php: 14 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Drupal\Tests\vmware\Traits; use Drupal\Tests\cloud\Traits\CloudTestEntityTrait; /** * The trait creating test entity for vmware testing. */ trait VmwareTestEntityTrait { use CloudTestEntityTrait; } modules/cloud_service_providers/vmware/tests/src/Traits/VmwareTestMockTrait.php +10 Changes for modules/cloud_service_providers/vmware/tests/src/Traits/VmwareTestMockTrait.php: 10 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Drupal\Tests\vmware\Traits; /** * The trait creating mock data for vmware testing. */ trait VmwareTestMockTrait { } Loading
modules/cloud_service_providers/vmware/tests/src/Functional/VmwareTestBase.php +98 Changes for modules/cloud_service_providers/vmware/tests/src/Functional/VmwareTestBase.php: 98 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Drupal\Tests\vmware\Functional; use Drupal\cloud\Entity\CloudConfig; use Drupal\cloud\Entity\CloudContentEntityBase; use Drupal\Tests\cloud\Functional\CloudTestBase; use Drupal\Tests\vmware\Traits\VmwareTestEntityTrait; use Drupal\Tests\vmware\Traits\VmwareTestFormDataTrait; use Drupal\Tests\vmware\Traits\VmwareTestMockTrait; /** * Base Test Case class for Vmware. */ abstract class VmwareTestBase extends CloudTestBase { use VmwareTestEntityTrait; use VmwareTestFormDataTrait; use VmwareTestMockTrait; /** * Modules to enable. * * @var array */ public static $modules = [ 'cloud', 'vmware', ]; /** * Set up test. * * @throws \Drupal\Core\Entity\EntityStorageException */ protected function setUp() { parent::setUp(); $this->init(__CLASS__, $this); } /** * Create cloud context. * * @param string $bundle * The CloudConfig Bundle Type ('vmware'). * * @return \Drupal\cloud\Entity\CloudConfig * The cloud service provider (CloudConfig) entity. */ protected function createCloudContext($bundle = 'vmware'): CloudContentEntityBase { $random = $this->random; $this->cloudContext = $random->name(8); return $this->createTestEntity(CloudConfig::class, [ 'type' => $bundle, 'cloud_context' => $this->cloudContext, 'name' => sprintf('Vmware - %s - %s', date('Y/m/d H:i:s'), $random->name(8, TRUE)), 'field_vcenter_url' => $random->name(32, TRUE), 'field_vcenter_username' => $random->name(32, TRUE), 'field_vcenter_password' => $random->name(32, TRUE), ]); } /** * Test bulk operation for entities. * * @param string $type * The name of the entity type. For example, instance. * @param array $entities * The data of entities. * @param string $operation * The operation. * @param string $passive_operation * The passive voice of operation. * @param string $path_prefix * The URL path of prefix. * * @throws \Behat\Mink\Exception\ExpectationException * @throws \Behat\Mink\Exception\ResponseTextException */ protected function runTestEntityBulk( $type, array $entities, $operation = 'delete', $passive_operation = 'deleted', $path_prefix = '/clouds/vmware'): void { $this->runTestEntityBulkImpl( $type, $entities, $operation, $passive_operation, $path_prefix ); } }
modules/cloud_service_providers/vmware/tests/src/Functional/VmwareVmTest.php +45 Changes for modules/cloud_service_providers/vmware/tests/src/Functional/VmwareVmTest.php: 45 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Drupal\Tests\vmware\Functional; use Drupal\Tests\cloud\Traits\CloudConfigTestEntityTrait; /** * Tests Vmware VM. * * @group Vmware */ class VmwareVmTest extends VmwareTestBase { use CloudConfigTestEntityTrait; public const VMWARE_VM_REPEAT_COUNT = 1; /** * {@inheritdoc} */ protected function getPermissions(): array { return [ 'list vmware vm', 'add vmware vm', 'view vmware vm', 'edit vmware vm', 'delete vmware vm', ]; } /** * Tests CRUD for VM. * * @throws \Behat\Mink\Exception\ResponseTextException * @throws \Behat\Mink\Exception\ExpectationException */ public function testVm(): void { $cloud_context = $this->cloudContext; // List VM for VMware. $this->drupalGet("/clouds/vmware/$cloud_context/vm"); $this->assertNoErrorMessage(); } }
modules/cloud_service_providers/vmware/tests/src/Traits/VmwareTestEntityTrait.php +14 Changes for modules/cloud_service_providers/vmware/tests/src/Traits/VmwareTestEntityTrait.php: 14 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Drupal\Tests\vmware\Traits; use Drupal\Tests\cloud\Traits\CloudTestEntityTrait; /** * The trait creating test entity for vmware testing. */ trait VmwareTestEntityTrait { use CloudTestEntityTrait; }
modules/cloud_service_providers/vmware/tests/src/Traits/VmwareTestMockTrait.php +10 Changes for modules/cloud_service_providers/vmware/tests/src/Traits/VmwareTestMockTrait.php: 10 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Drupal\Tests\vmware\Traits; /** * The trait creating mock data for vmware testing. */ trait VmwareTestMockTrait { }