FeaturesBundleIntegrationTest.php in Features 8.3
File
tests/src/Kernel/Entity/FeaturesBundleIntegrationTest.php
View source
<?php
namespace Drupal\Tests\features\Kernel\Entity;
use Drupal\features\Entity\FeaturesBundle;
use Drupal\features\FeaturesBundleInterface;
use Drupal\KernelTests\KernelTestBase;
class FeaturesBundleIntegrationTest extends KernelTestBase {
public static $modules = [
'features',
];
public function testCrud() {
$bundle = FeaturesBundle::create([
'machine_name' => 'test',
'name' => 'Test',
]);
$bundle
->save();
$bundle = FeaturesBundle::load('test');
$this
->assertEquals('Test', $bundle
->getName());
}
public function testIsDefaultWithDefaultBundle() {
$bundle = FeaturesBundle::create([
'machine_name' => FeaturesBundleInterface::DEFAULT_BUNDLE,
]);
$this
->assertTrue($bundle
->isDefault());
}
public function testIsDefaultWithNonDefaultBundle() {
$bundle = FeaturesBundle::create([
'machine_name' => 'other',
]);
$this
->assertFalse($bundle
->isDefault());
}
public function testGetFullName() {
$this
->markTestSkipped('Not yet implemented');
}
public function testGetShortName() {
$this
->markTestSkipped('Not yet implemented');
}
public function testGetProfile() {
$bundle = FeaturesBundle::create([
'machine_name' => 'other',
'profile_name' => 'example',
'is_profile' => TRUE,
]);
$this
->assertEquals('example', $bundle
->getProfileName());
$bundle
->setProfileName('example2');
$this
->assertEquals('example2', $bundle
->getProfileName());
}
}