Skip to content

Commit

Permalink
ci: update real use test to use SiteClient
Browse files Browse the repository at this point in the history
This should allow us to test both the SiteClient and the Client at once
  • Loading branch information
EmilePerron committed Mar 4, 2023
1 parent b6ed035 commit cb93272
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/real_use_ci_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

require_once __DIR__ . '/../vendor/autoload.php';

use Koalati\Webflow\Api\Client;
use Koalati\Webflow\Api\SiteClient;
use Koalati\Webflow\Model\Cms\CollectionItem;

// The API access token is passed as the 1st CLI argument
Expand All @@ -13,12 +13,12 @@
// The current commit hash is passed as the 2nd CLI argument
$commitHash = $argv[2] ?? 'none';

$client = new Client($accessToken);
$client = new SiteClient($accessToken, '63feb744e9d846589ba06c75');
$sites = $client->listSites();
$testSite = $client->getSite($sites[0]->getId());
$testSite = $client->getSite('63feb744e9d846589ba06c75');

// List all collections for a site
$collections = $client->listCollections($testSite);
$collections = $client->listCollections();
$testCollection = $client->getCollection($collections[0]->getId());

// Create a test item
Expand Down Expand Up @@ -55,11 +55,11 @@
$client->removeCollectionItem($testCollection, $deletionTestItem, false);

// Membership user tests
$accessGroups = $client->listAccessGroups($testSite);
$users = $client->listUsers($testSite);
$user = $client->getUser($testSite, $users[0]->id);
$accessGroups = $client->listAccessGroups();
$users = $client->listUsers();
$user = $client->getUser($users[0]->id);
$user->setData('country', ($user->data['country'] ?? null) === 'Canada' ? 'Wonderland' : 'Canada');
$client->updateUser($testSite, $user);
$client->updateUser($user);

// Publish the site
$client->publishSite($testSite);
$client->publishSite();

0 comments on commit cb93272

Please sign in to comment.