Пример #1
0
 /**
  * @covers Mozu\Api\Resources\Commerce\Catalog\Admin\ProductResource::getProducts
  * @todo Implement testGetProducts().
  */
 public function testGetProductsAsync()
 {
     $promise = $this->object->getProductInventoryAsync("AC-99");
     $promise->then(function ($mozuResult) {
         var_dump($mozuResult);
     }, function ($apiException) {
         parent::printError($apiException);
         $this->fail($apiException->getMessage());
     });
 }
Пример #2
0
 public function testUpdateDocumentContent()
 {
     $file = file_get_contents("C:\\files\\phpdownload.jpg");
     $promise = $this->object->updateDocumentContentAsync($file, "files@mozu", "a487bccd-7ee3-4fef-af9b-91b454559f7d", "image/jpg");
     $promise->then(function ($mozuResult) {
         printf($mozuResult->correlationId);
     }, function ($apiException) {
         parent::printError($apiException);
         $this->fail($apiException->getMessage());
     });
     $promise->wait();
 }
Пример #3
0
 /**
  * @covers Mozu\Api\Resources\Content\Documentlists\DocumentResource::getDocumentContent
  * @todo Implement testGetDocumentContent().
  */
 public function testGetOrdersAsync()
 {
     $filters = urlencode("submittedDate gt 2013-12-15T12:21:24z");
     $promise = $this->object->getOrdersAsync('0', 100, null, $filters, null, null);
     $promise->then(function ($mozuResult) {
         $collection = $mozuResult->json();
         var_dump($collection);
     }, function ($apiException) {
         parent::printError($apiException);
         $this->fail($apiException->getMessage());
     });
     $promise->wait();
 }
 /**
  * @covers Mozu\Api\Security\Authentication::getAccessToken
  * @todo Implement testGetAccessToken().
  */
 public function testCustomerLogin()
 {
     try {
         $userAuthInfo = new CustomerUserAuthInfo();
         $userAuthInfo->username = $this->customerUserName;
         $userAuthInfo->password = $this->customerPassword;
         $authenticationProfile = CustomerAuthenticator::authenticate($userAuthInfo, $this->tenantId, $this->siteId);
         $this->assertNotNull($authenticationProfile->authTicket);
         $this->assertNotNull($authenticationProfile->customerAccount);
     } catch (Exception $e) {
         parent::printError($e);
         $this->fail($e->getMessage());
     }
 }
Пример #5
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     printf("Getting tenant");
     $tenantResource = new TenantResource();
     $tenantPromise = $tenantResource->getTenantAsync($this->tenantId);
     $tenantPromise->then(function ($mozuResult) {
         $apiContext = new ApiContext($mozuResult->json());
         $this->object = new ProductResource($apiContext, DataViewMode::LIVE);
     }, function ($apiException) {
         parent::printError($apiException);
         throw $apiException;
     });
     $tenantPromise->wait();
 }
 public function testDeveloperLogin()
 {
     try {
         $userAuthInfo = new UserAuthInfo();
         $userAuthInfo->emailAddress = $this->emailAddress;
         $userAuthInfo->password = $this->password;
         $authenticationProfile = UserAuthenticator::authenticate($userAuthInfo, AuthenticationScope::DEVELOEPR);
         $this->assertNotNull($authenticationProfile->authTicket);
         $this->assertNotNull($authenticationProfile->authorizedScopes);
         UserAuthenticator::logout($authenticationProfile->authTicket);
     } catch (Exception $e) {
         parent::printError($e);
         $this->fail($e->getMessage());
     }
 }
Пример #7
0
 public function testGetTenantAsync()
 {
     try {
         $promise = $this->object->getTenantAsync($this->tenantId);
         $tenant = $promise->wait()->json();
         $this->assertSame($tenant->id, $this->tenantId);
     } catch (Exception $e) {
         parent::printError($e);
         $this->fail($e->getMessage());
     }
     /*$promise->then(function($mozuResult) {
           $tenant = $mozuResult->json();
           printf("TenantId : ". $tenant->id);
           $this->assertSame($tenant->id, $this->tenantId);
       }, function($e) {
           parent::printError($e);
           $this->fail($e->getMessage());
       });
       $promise->wait();*/
 }