/** * @covers WindowsAzure\Queue\Models\CreateQueueOptions::getMetadata */ public function testGetMetadata() { // Setup $queue = new CreateQueueOptions(); $expected = array('key1' => 'value1', 'key2' => 'value2'); $queue->setMetadata($expected); // Test $actual = $queue->getMetadata(); // Assert $this->assertEquals($expected, $actual); }
public static function getInterestingCreateQueueOptions() { $ret = array(); $options = new CreateQueueOptions(); array_push($ret, $options); $options = new CreateQueueOptions(); $options->setTimeout(10); array_push($ret, $options); $options = new CreateQueueOptions(); $options->setTimeout(-10); array_push($ret, $options); $options = new CreateQueueOptions(); $metadata = array(); $metadata['foo'] = 'bar'; $metadata['foo2'] = 'bar2'; $metadata['foo3'] = 'bar3'; $options->setMetadata($metadata); $options->setTimeout(10); array_push($ret, $options); $options = new CreateQueueOptions(); $metadata = array('foo' => 'bar'); $options->setMetadata($metadata); $options->setTimeout(-10); array_push($ret, $options); return $ret; }
/** * @covers WindowsAzure\Queue\QueueRestProxy::getQueueMetadata */ public function testGetQueueMetadata() { // Setup $name = 'getqueuemetadata'; $expectedCount = 0; $options = new CreateQueueOptions(); $expected = array('name1' => 'MyName1', 'mymetaname' => '12345', 'values' => 'Microsoft_'); $options->setMetadata($expected); $this->createQueue($name, $options); // Test $result = $this->restProxy->getQueueMetadata($name); // Assert $this->assertEquals($expectedCount, $result->getApproximateMessageCount()); $this->assertEquals($expected, $result->getMetadata()); }
public function testCheckCreateQueueOptions() { $options = new CreateQueueOptions(); $this->assertNull($options->getMetadata(), 'Default CreateQueueOptions->getMetadata'); $this->assertEquals(0, count($options->getMetadata()), 'Default CreateQueueOptions->getMetadata->size'); $this->assertNull($options->getTimeout(), 'Default CreateQueueOptions->getTimeout'); $metadata = array('foo' => 'bar', 'baz' => 'bat'); $options->setMetadata($metadata); $options->setTimeout(-10); $this->assertEquals($options->getMetadata(), $metadata, 'Set CreateQueueOptions->getMetadata'); $this->assertEquals(2, count($options->getMetadata()), 'Set CreateQueueOptions->getMetadata->size'); $this->assertEquals(-10, $options->getTimeout(), 'Set CreateQueueOptions->getTimeout'); $options->addMetadata('aaa', 'bbb'); $this->assertEquals(3, count($options->getMetadata()), 'Set CreateQueueOptions->getMetadata->size'); }
public function testCheckCreateQueueOptions() { $options = new CreateQueueOptions(); $this->assertNull($options->getMetadata(), 'Default CreateQueueOptions->getMetadata'); $this->assertEquals(0, count($options->getMetadata()), 'Default CreateQueueOptions->getMetadata->size'); // TODO: Uncomment when fixed. // https://github.com/WindowsAzure/azure-sdk-for-php/issues/59 // $this->assertNull($options->getTimeout(), 'Default CreateQueueOptions->getTimeout'); $metadata = array('foo' => 'bar', 'baz' => 'bat'); $options->setMetadata($metadata); // TODO: Uncomment when fixed. // https://github.com/WindowsAzure/azure-sdk-for-php/issues/59 //$options->setTimeout(-10); $this->assertEquals($options->getMetadata(), $metadata, 'Set CreateQueueOptions->getMetadata'); $this->assertEquals(2, count($options->getMetadata()), 'Set CreateQueueOptions->getMetadata->size'); // TODO: Uncomment when fixed. // https://github.com/WindowsAzure/azure-sdk-for-php/issues/59 // $this->assertEquals(-10, $options->getTimeout(), 'Set CreateQueueOptions->getTimeout'); $options->addMetadata('aaa', 'bbb'); $this->assertEquals(3, count($options->getMetadata()), 'Set CreateQueueOptions->getMetadata->size'); }
public static function getInterestingCreateQueueOptions() { $ret = array(); $options = new CreateQueueOptions(); array_push($ret, $options); // Uncomment when fixed // https://github.com/WindowsAzure/azure-sdk-for-php/issues/59 // $options = new CreateQueueOptions(); // $options->setTimeout(10); // array_push($ret, $options); // // $options = new CreateQueueOptions(); // $options->setTimeout(-10); // array_push($ret, $options); $options = new CreateQueueOptions(); $metadata = array(); // TODO: Uncomment when fixed: // https://github.com/WindowsAzure/azure-sdk-for-php/issues/105 // $metadata['foo'] = 'bar'; $metadata['foo2'] = 'bar2'; $metadata['foo3'] = 'bar3'; $options->setMetadata($metadata); // Uncomment when fixed // https://github.com/WindowsAzure/azure-sdk-for-php/issues/59 // $options->setTimeout(10); array_push($ret, $options); $options = new CreateQueueOptions(); $metadata = array('foo' => 'bar'); $options->setMetadata($metadata); // Uncomment when fixed // https://github.com/WindowsAzure/azure-sdk-for-php/issues/59 // $options->setTimeout(-10); array_push($ret, $options); return $ret; }