File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,21 @@ public function getMetapropertyOptions($query)
131
131
);
132
132
}
133
133
134
+ /**
135
+ * Gets a list of metaproperty options.
136
+ *
137
+ * @param string $propertyId Metaproperty id
138
+ * @param array $query Associative array of parameters to filter the results.
139
+ * @return \GuzzleHttp\Promise\Promise
140
+ * @throws \GuzzleHttp\Exception\RequestException
141
+ */
142
+ public function getMetapropertyOptionsById ($ propertyId , $ query )
143
+ {
144
+ return $ this ->requestHandler ->sendRequestAsync ('GET ' , 'api/v4/metaproperties/ ' . $ propertyId . '/options/ ' ,
145
+ ['query ' => $ query ]
146
+ );
147
+ }
148
+
134
149
/**
135
150
* Gets a list of all meta property option dependencies (globally).
136
151
*
Original file line number Diff line number Diff line change @@ -463,6 +463,35 @@ public function testGetMetapropertyOptions()
463
463
self ::assertEquals ($ result , ['query ' ]);
464
464
}
465
465
466
+ /**
467
+ * Test if we call getMetapropertyOptionsById it will use the correct params for the request and returns successfully.
468
+ *
469
+ * @covers \Bynder\Api\Impl\AssetBankManager::getMetapropertyOptionsById()
470
+ * @throws \Exception
471
+ */
472
+ public function testGetMetapropertyOptionsById ()
473
+ {
474
+ $ stub = $ this ->getMockBuilder ('Bynder\Api\Impl\OAuth2\RequestHandler ' )
475
+ ->disableOriginalConstructor ()
476
+ ->getMock ();
477
+
478
+ $ propertyId = '00000000-0000-0000-0000000000000000 ' ;
479
+ $ optionId = '00000000-0000-0000-0000000000000001 ' ;
480
+ $ query = ['ids ' => $ optionId ];
481
+
482
+ $ stub ->method ('sendRequestAsync ' )
483
+ ->with ('GET ' , 'api/v4/metaproperties/ ' . $ propertyId . '/options/ ' , [
484
+ 'query ' => $ query
485
+ ])
486
+ ->willReturn (['query ' ]);
487
+
488
+ $ assetBankManager = new AssetBankManager ($ stub );
489
+ $ result = $ assetBankManager ->getMetapropertyOptionsById ($ propertyId , $ query );
490
+
491
+ self ::assertNotNull ($ result );
492
+ self ::assertEquals ($ result , ['query ' ]);
493
+ }
494
+
466
495
/**
467
496
* Test if we call getMetapropetryGlobalOptionDependencies it will use the correct params for the request and
468
497
* returns successfully.
You can’t perform that action at this time.
0 commit comments