public function testGetCountReturnsSpecifiedCount()
 {
     $this->connection->expects($this->once())->method('get')->with('http://storeurl' . $this->basePath . '/whatever', false)->will($this->returnValue((object) array('count' => 5)));
     Client::configure(array('store_url' => 'http://storeurl', 'username' => 'whatever', 'api_key' => 'whatever'));
     Client::setConnection($this->connection);
     // re-set the connection since Client::configure unsets it
     $count = Client::getCount('/whatever');
     $this->assertSame(5, $count);
 }
 /**
  * Dispatch resources refresh jobs for a base resource - i.e. one not dependent on another resource ID.
  *
  * @param String $resource The name of the resource to refresh
  * @return void
  */
 protected function dispatchResourceRefresh($resource)
 {
     $page_size = $this->page_size;
     $resource_count = Bigcommerce::getCount("/{$resource}/count");
     $this->info("{$resource_count} objects");
     $this->info("{$page_size} page size");
     $this->info(floor($resource_count / $page_size) + 1 . " pages to dispatch");
     $page = 1;
     $paging_resource_count = $resource_count;
     while ($paging_resource_count > 0) {
         $this->dispatcher->dispatch(new ResourceCacheJob($page, $resource));
         $paging_resource_count -= $page_size;
         $page++;
     }
     $this->info("Dispatched " . ($page - 1) . " pages of {$resource} refresh commands");
 }