addRule($lifecycleRule); $actions = array(); $actions[] = new LifecycleAction("Expiration", "Date", '2022-10-12T00:00:00.000Z'); $lifecycleRule = new LifecycleRule("delete temporary files", "temporary/", "Enabled", $actions); $lifecycleConfig->addRule($lifecycleRule); try { $this->ossClient->putBucketLifecycle($this->bucket, $lifecycleConfig); } catch (OssException $e) { $this->assertTrue(false); } try { Common::waitMetaSync(); $lifecycleConfig2 = $this->ossClient->getBucketLifecycle($this->bucket); $this->assertEquals($lifecycleConfig->serializeToXml(), $lifecycleConfig2->serializeToXml()); } catch (OssException $e) { $this->assertTrue(false); } try { Common::waitMetaSync(); $this->ossClient->deleteBucketLifecycle($this->bucket); } catch (OssException $e) { $this->assertTrue(false); } try { Common::waitMetaSync(); $lifecycleConfig3 = $this->ossClient->getBucketLifecycle($this->bucket); $this->assertNotEquals($lifecycleConfig->serializeToXml(), $lifecycleConfig3->serializeToXml()); } catch (OssException $e) { $this->assertTrue(false); } } }