/** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::deleteEntity * @covers MicrosoftAzure\Storage\Table\TableRestProxy::insertEntity */ public function testDeleteEntityTroublesomeRowKey() { // The service does not allow the following common characters in keys: // 35 '#' // 47 '/' // 63 '?' // 92 '\' // In addition, the following values are not allowed, as they make the URL bad: // 0-31, 127-159 // That still leaves several options for making troublesome keys // spaces // single quotes // Unicode // These need to be properly encoded when passed on the URL, else there will be trouble $table = TableServiceFunctionalTestData::$testTableNames[0]; $e = new Entity(); $e->setRowKey('row\'Key\''); $e->setPartitionKey('niceKey'); $this->restProxy->insertEntity($table, $e); $this->restProxy->deleteEntity($table, $e->getPartitionKey(), $e->getRowKey()); $qopts = new QueryEntitiesOptions(); $qopts->setFilter(Filter::applyEq(Filter::applyPropertyName('RowKey'), Filter::applyConstant($e->getRowKey(), EdmType::STRING))); $queryres = $this->restProxy->queryEntities($table, $qopts); $this->assertEquals(0, count($queryres->getEntities()), 'entities returned'); $e = new Entity(); $e->setRowKey('row Key'); $e->setPartitionKey('niceKey'); $this->restProxy->insertEntity($table, $e); $this->restProxy->deleteEntity($table, $e->getPartitionKey(), $e->getRowKey()); $qopts = new QueryEntitiesOptions(); $qopts->setFilter(Filter::applyEq(Filter::applyPropertyName('RowKey'), Filter::applyConstant($e->getRowKey(), EdmType::STRING))); $queryres = $this->restProxy->queryEntities($table, $qopts); $this->assertEquals(0, count($queryres->getEntities()), 'entities returned'); $e = new Entity(); $e->setRowKey('row ' . TableServiceFunctionalTestData::getUnicodeString()); $e->setPartitionKey('niceKey'); $this->restProxy->insertEntity($table, $e); $this->restProxy->deleteEntity($table, $e->getPartitionKey(), $e->getRowKey()); $qopts = new QueryEntitiesOptions(); $qopts->setFilter(Filter::applyEq(Filter::applyPropertyName('RowKey'), Filter::applyConstant($e->getRowKey(), EdmType::STRING))); $queryres = $this->restProxy->queryEntities($table, $qopts); $this->assertEquals(0, count($queryres->getEntities()), 'entities returned'); $this->clearTable($table); }