mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-08-19 21:03:44 -07:00
Added array keys for space and file listing
This commit is contained in:
parent
f9b49002c7
commit
cfea1967ab
11 changed files with 41 additions and 27 deletions
|
@ -20,7 +20,7 @@ class FileTest extends TestCase
|
|||
$spaces = new Spaces($_ENV['SPACES_KEY'], $_ENV['SPACES_SECRET']);
|
||||
|
||||
try {
|
||||
$spaces->space('spaces-api-test')->destroySpace();
|
||||
$spaces->space('spaces-api-test')->destroy();
|
||||
} catch (SpaceDoesntExistException $e) {
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ class FileTest extends TestCase
|
|||
|
||||
public static function tearDownAfterClass(): void
|
||||
{
|
||||
(new Spaces($_ENV['SPACES_KEY'], $_ENV['SPACES_SECRET']))->space('spaces-api-test')->destroySpace();
|
||||
(new Spaces($_ENV['SPACES_KEY'], $_ENV['SPACES_SECRET']))->space('spaces-api-test')->destroy();
|
||||
}
|
||||
|
||||
public function testCanUpdatePrivacy()
|
||||
|
|
|
@ -20,7 +20,7 @@ class SpaceTest extends TestCase
|
|||
$spaces = new Spaces($_ENV['SPACES_KEY'], $_ENV['SPACES_SECRET']);
|
||||
|
||||
try {
|
||||
$spaces->space('spaces-api-test')->destroySpace();
|
||||
$spaces->space('spaces-api-test')->destroy();
|
||||
} catch (SpaceDoesntExistException $e) {
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ class SpaceTest extends TestCase
|
|||
|
||||
public static function tearDownAfterClass(): void
|
||||
{
|
||||
// (new Spaces($_ENV['SPACES_KEY'], $_ENV['SPACES_SECRET']))->space('spaces-api-test')->destroySpace();
|
||||
// (new Spaces($_ENV['SPACES_KEY'], $_ENV['SPACES_SECRET']))->space('spaces-api-test')->destroy();
|
||||
}
|
||||
|
||||
public function testCanUpdateSpacePrivacy()
|
||||
|
@ -102,7 +102,11 @@ class SpaceTest extends TestCase
|
|||
$files = self::$space->listFiles()['files'];
|
||||
$this->assertIsArray($files);
|
||||
$this->assertCount(2, $files);
|
||||
$this->assertInstanceOf(File::class, $files[0]);
|
||||
$this->assertInstanceOf(File::class, $files[array_key_first($files)]);
|
||||
|
||||
foreach ($files as $filename => $file) {
|
||||
$this->assertEquals($file->filename, $filename);
|
||||
}
|
||||
|
||||
foreach ($files as $file) {
|
||||
$file->delete();
|
||||
|
|
|
@ -17,14 +17,14 @@ class SpacesTest extends TestCase
|
|||
$dotenv->required(['SPACES_KEY', 'SPACES_SECRET']);
|
||||
|
||||
try {
|
||||
(new Spaces($_ENV['SPACES_KEY'], $_ENV['SPACES_SECRET']))->space('spaces-api-test')->destroySpace();
|
||||
(new Spaces($_ENV['SPACES_KEY'], $_ENV['SPACES_SECRET']))->space('spaces-api-test')->destroy();
|
||||
} catch (SpaceDoesntExistException $e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass(): void
|
||||
{
|
||||
(new Spaces($_ENV['SPACES_KEY'], $_ENV['SPACES_SECRET']))->space('spaces-api-test')->destroySpace();
|
||||
(new Spaces($_ENV['SPACES_KEY'], $_ENV['SPACES_SECRET']))->space('spaces-api-test')->destroy();
|
||||
}
|
||||
|
||||
public function testAuthenticationCanFail()
|
||||
|
@ -68,8 +68,8 @@ class SpacesTest extends TestCase
|
|||
$this->assertIsArray($list);
|
||||
|
||||
$spaceFound = false;
|
||||
foreach ($list as $space) {
|
||||
if ($space->getName() == 'spaces-api-test') {
|
||||
foreach ($list as $name => $space) {
|
||||
if ($name == 'spaces-api-test' && $space->getName() == 'spaces-api-test') {
|
||||
$spaceFound = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue