Beispiel #1
0
 protected function tearDown()
 {
     $filename = __DIR__ . '/../../_data/delete-users.csv';
     $id = $this->api->users()->postByCsv($filename);
     while (1) {
         $result = $this->api->csv()->result($id);
         if (!$result['done']) {
             continue;
         }
         if ($result['success']) {
             self::assertTrue(true);
         } else {
             self::fail($result['errorCode']);
         }
         break;
     }
     $filename = __DIR__ . '/../../_data/delete-groups.csv';
     $id = $this->api->groups()->postByCsv($filename);
     while (1) {
         $result = $this->api->csv()->result($id);
         if (!$result['done']) {
             continue;
         }
         if ($result['success']) {
             self::assertTrue(true);
         } else {
             self::fail($result['errorCode']);
         }
         break;
     }
 }
Beispiel #2
0
 public function testCsv()
 {
     $filename = __DIR__ . '/../../_data/groups.csv';
     $id = $this->api->groups()->postByCsv($filename);
     while (1) {
         $result = $this->api->csv()->result($id);
         if (!$result['done']) {
             continue;
         }
         if ($result['success']) {
             self::assertTrue(true);
         } else {
             self::fail($result['errorCode']);
         }
         break;
     }
     $content = $this->api->groups()->getByCsv();
     $path = __DIR__ . '/../../_output/export-groups1.csv';
     file_put_contents($path, $content);
     $getCsv = new Reader($path, 'r+', false);
     $flg1 = $flg2 = false;
     while ($row = $getCsv->getRow()) {
         if ("example-group1" == reset($row)) {
             $flg1 = true;
         }
         if ("example-group2" == reset($row)) {
             $flg2 = true;
         }
     }
     self::assertTrue($flg1 and $flg2);
     $filename = __DIR__ . '/../../_data/delete-groups.csv';
     $id = $this->api->groups()->postByCsv($filename);
     while (1) {
         $result = $this->api->csv()->result($id);
         if (!$result['done']) {
             continue;
         }
         if ($result['success']) {
             self::assertTrue(true);
         } else {
             self::fail($result['errorCode']);
         }
         break;
     }
 }
Beispiel #3
0
 public function testGroups()
 {
     self::assertTrue($this->api->groups() instanceof Groups);
 }