File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ function commerce_order_add_order_items_field(OrderTypeInterface $order_type) {
140140 ->setLabel('Order items')
141141 ->setCardinality(BundleFieldDefinition::CARDINALITY_UNLIMITED)
142142 ->setRequired(TRUE)
143- ->setSetting('target_type', 'commerce_order_type ')
143+ ->setSetting('target_type', 'commerce_order_item ')
144144 ->setSetting('handler', 'default')
145145 ->setDisplayOptions('form', [
146146 'type' => 'inline_entity_form_complex',
Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ public function testDefaultOrderType() {
2626 * Tests creating an order Type programaticaly and through the add form.
2727 */
2828 public function testCreateOrderType () {
29+ // Remove the default order type to be able to test creating the
30+ // order_items field anew.
31+ OrderType::load ('default ' )->delete ();
32+
2933 // Create an order type programmaticaly.
3034 $ type = $ this ->createEntity ('commerce_order_type ' , [
3135 'id ' => 'kitten ' ,
@@ -48,6 +52,10 @@ public function testCreateOrderType() {
4852
4953 $ type_exists = (bool ) OrderType::load ($ values ['id ' ]);
5054 $ this ->assertNotEmpty ($ type_exists , 'The new order type has been created in the database. ' );
55+
56+ // Testing the target type of the order_items field.
57+ $ settings = $ this ->config ('field.storage.commerce_order.order_items ' )->get ('settings ' );
58+ $ this ->assertEquals ('commerce_order_item ' , $ settings ['target_type ' ], t ('Order item field target type is correct. ' ));
5159 }
5260
5361 /**
@@ -69,7 +77,7 @@ public function testDraftOrderRefreshSettings() {
6977 }
7078
7179 /**
72- * Tests deleting an order Type programmaticaly and through the form.
80+ * Tests deleting an order Type through the form.
7381 */
7482 public function testDeleteOrderType () {
7583 // Create an order type programmaticaly.
You can’t perform that action at this time.
0 commit comments