diff --git a/src/Tests/DepartureTest.php b/src/Tests/DepartureTest.php index 1f21b76..7b8301a 100644 --- a/src/Tests/DepartureTest.php +++ b/src/Tests/DepartureTest.php @@ -92,14 +92,19 @@ class DepartureTest extends EntityPilotTestBase { $this->assertField('passenger_list[0][target_type]', 'Found passenger field target type'); // Create some items to reference. - $item1 = entity_create('entity_test', array( - 'name' => 'item1', - )); - $item1->save(); - $item2 = entity_create('entity_test', array( - 'name' => 'item2', - )); - $item2->save(); + $item1 = $this->container->get('entity_type.manager') + ->getStorage('entity_test') + ->create(array( + 'name' => 'item1', + )) + ->save(); + $item2 = $this->container->get('entity_type.manager') + ->getStorage('entity_test') + ->create(array( + 'name' => 'item2', + )) + ->save(); + // Add some extra dynamic entity reference fields. $this->drupalPostAjaxForm(NULL, array(), array('passenger_list_add_more' => t('Add another item')), NULL, array(), array(), 'ep-departure-primary-form'); $this->drupalPostAjaxForm(NULL, array(), array('passenger_list_add_more' => t('Add another item')), NULL, array(), array(), 'ep-departure-primary-form'); @@ -272,5 +277,4 @@ class DepartureTest extends EntityPilotTestBase { $this->assertEqual($departure->getStatus(), FlightInterface::STATUS_LANDED); } } - -} +} \ No newline at end of file diff --git a/src/Tests/EntityPilotTestBase.php b/src/Tests/EntityPilotTestBase.php index 0f04ef5..8f7a832 100644 --- a/src/Tests/EntityPilotTestBase.php +++ b/src/Tests/EntityPilotTestBase.php @@ -77,15 +77,18 @@ abstract class EntityPilotTestBase extends WebTestBase { * Created Entity Pilot account. */ protected function createAccount($label, $carrier_id = NULL, $black_box_key = NULL, $description = NULL) { - $bundle = entity_create('ep_account', array( - 'id' => Unicode::strtolower($label), - 'label' => $label, - 'carrierId' => $carrier_id ?: $this->randomMachineName(), - 'blackBoxKey' => $black_box_key ?: $this->randomMachineName(), - 'description' => $description ?: $this->randomMachineName(), + $bundle = $this->container->get('entity_type.manager') + ->getStorage('ep_account') + ->create(array( + 'id' => Unicode::strtolower($label), + 'label' => $label, + 'carrierId' => $carrier_id ?: $this->randomMachineName(), + 'blackBoxKey' => $black_box_key ?: $this->randomMachineName(), + 'description' => $description ?: $this->randomMachineName(), 'secret' => "a22a0b2884fd73c4e211d68e1f031051", - )); - $bundle->save(); + )) + ->save(); + // $bundle->save(); return $bundle; } @@ -102,14 +105,17 @@ abstract class EntityPilotTestBase extends WebTestBase { * Created flight. */ protected function createDeparture($info = FALSE, $bundle = 'primary') { - if ($flight = entity_create('ep_departure', array( - 'info' => $info ?: $this->randomMachineName(), - 'account' => $bundle, - 'langcode' => 'en', - ))) { + if($flight = $this->container->get('entity_type.manager') + ->getStorage('ep_departure') + ->create(array( + 'info' => $info ?: $this->randomMachineName(), + 'account' => $bundle, + 'langcode' => 'en', + )) + ->save(); + ) { $flight->save(); } return $flight; } - -} +} \ No newline at end of file