putObject($input, $options['bucket'], $uri); } } public static function testGetAll(Connector $s3, array $options): bool { $listing = $s3->getBucket($options['bucket'], static::PATH_PREFIX); static::assert(is_array($listing), "The files listing must be an array"); static::assert(count($listing) === 2100, "I am expecting to see 2100 files"); for ($i = 1; $i <= 2100; $i++) { $key = sprintf('%stest_%04u.dat', static::PATH_PREFIX, $i); static::assert(array_key_exists($key, $listing), sprintf('Results should list object %s', $key)); } return true; } public static function testGetHundred(Connector $s3, array $options): bool { $listing = $s3->getBucket($options['bucket'], static::PATH_PREFIX, null, 100); static::assert(is_array($listing), "The files listing must be an array"); static::assert(count($listing) === 100, "I am expecting to see 100 files"); for ($i = 1; $i <= 100; $i++) { $key = sprintf('%stest_%04u.dat', static::PATH_PREFIX, $i); static::assert(array_key_exists($key, $listing), sprintf('Results should list object %s', $key)); } return true; } public static function testGetElevenHundred(Connector $s3, array $options): bool { $listing = $s3->getBucket($options['bucket'], static::PATH_PREFIX, null, 1100); static::assert(is_array($listing), "The files listing must be an array"); static::assert(count($listing) === 1100, "I am expecting to see 1100 files"); for ($i = 1; $i <= 1100; $i++) { $key = sprintf('%stest_%04u.dat', static::PATH_PREFIX, $i); static::assert(array_key_exists($key, $listing), sprintf('Results should list object %s', $key)); } return true; } public static function testGetLastHundred(Connector $s3, array $options): bool { $listing = $s3->getBucket($options['bucket'], static::PATH_PREFIX . 'test_20', null); static::assert(is_array($listing), "The files listing must be an array"); static::assert(count($listing) === 100, "I am expecting to see 100 files"); for ($i = 2000; $i <= 2099; $i++) { $key = sprintf('%stest_%04u.dat', static::PATH_PREFIX, $i); static::assert(array_key_exists($key, $listing), sprintf('Results should list object %s', $key)); } return true; } }