StockLocationTest.php in Commerce Stock 8
File
modules/local_storage/tests/src/Kernel/Entity/StockLocationTest.php
View source
<?php
namespace Drupal\Tests\commerce_stock_local\Kernel\Entity;
use Drupal\commerce_stock_local\Entity\StockLocation;
use Drupal\Tests\commerce_stock\Kernel\CommerceStockKernelTestBase;
class StockLocationTest extends CommerceStockKernelTestBase {
public static $modules = [
'commerce_stock_local',
];
protected $user;
protected function setUp() {
parent::setUp();
$this
->installEntitySchema('commerce_stock_location_type');
$this
->installEntitySchema('commerce_stock_location');
$this
->installConfig([
'commerce_stock',
]);
$this
->installConfig([
'commerce_stock_local',
]);
$user = $this
->createUser();
$this->user = $this
->reloadEntity($user);
}
public function testStockLocation() {
$location = StockLocation::create([
'type' => 'default',
]);
$location
->setName('TestName');
self::assertEquals('TestName', $location
->getName());
self::assertTrue($location
->isActive());
$location
->setActive(FALSE);
self::assertFalse($location
->isActive());
$location
->setActive(TRUE);
self::assertTrue($location
->isActive());
}
}