File tree 2 files changed +10
-2
lines changed
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) {
140
140
->setLabel('Order items')
141
141
->setCardinality(BundleFieldDefinition::CARDINALITY_UNLIMITED)
142
142
->setRequired(TRUE)
143
- ->setSetting('target_type', 'commerce_order_type ')
143
+ ->setSetting('target_type', 'commerce_order_item ')
144
144
->setSetting('handler', 'default')
145
145
->setDisplayOptions('form', [
146
146
'type' => 'inline_entity_form_complex',
Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ public function testDefaultOrderType() {
26
26
* Tests creating an order Type programaticaly and through the add form.
27
27
*/
28
28
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
+
29
33
// Create an order type programmaticaly.
30
34
$ type = $ this ->createEntity ('commerce_order_type ' , [
31
35
'id ' => 'kitten ' ,
@@ -48,6 +52,10 @@ public function testCreateOrderType() {
48
52
49
53
$ type_exists = (bool ) OrderType::load ($ values ['id ' ]);
50
54
$ 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. ' ));
51
59
}
52
60
53
61
/**
@@ -69,7 +77,7 @@ public function testDraftOrderRefreshSettings() {
69
77
}
70
78
71
79
/**
72
- * Tests deleting an order Type programmaticaly and through the form.
80
+ * Tests deleting an order Type through the form.
73
81
*/
74
82
public function testDeleteOrderType () {
75
83
// Create an order type programmaticaly.
You can’t perform that action at this time.
0 commit comments