private function verifyqueryEntitiesWorker($ret, $options) { $this->assertNotNull($ret->getEntities(), 'getTables'); $expectedData = array(); foreach (self::$entitiesInTable as $e) { array_push($expectedData, $e); } sort($expectedData); $projected = false; if (!is_null($options->getNextPartitionKey()) && !is_null($options->getNextRowKey())) { $expectedDataTmp = array(); foreach ($expectedData as $e) { if ($e->getPartitionKey() > $options->getNextPartitionKey() || $e->getPartitionKey() == $options->getNextPartitionKey() && $e->getRowKey() >= $options->getNextRowKey()) { array_push($expectedDataTmp, $e); } } $expectedData = $expectedDataTmp; } $q = $options->getQuery(); $expectedFilter = $q->getFilter(); $projected = count($q->getSelectFields()) != 0; $expectedData = TableServiceFunctionalTestUtils::filterEntityList($expectedFilter, $expectedData); if (!is_null($q->getTop()) && $q->getTop() < count($expectedData)) { $expectedDataTmp = array(); for ($i = 0; $i < $q->getTop(); $i++) { array_push($expectedDataTmp, $expectedData[$i]); } $expectedData = $expectedDataTmp; } $this->compareEntityLists($ret->getEntities(), $expectedData, $projected); }
public static function tmptostring($value) { if (is_null($value)) { return 'null'; } else { if (is_bool($value)) { return $value == true ? 'true' : 'false'; } else { if ($value instanceof \DateTime) { return Utilities::convertToEdmDateTime($value); } else { if ($value instanceof Entity) { return self::entityToString($value); } else { if (is_array($value)) { return self::entityPropsToString($value); } else { if ($value instanceof Filter) { return TableServiceFunctionalTestUtils::filtertoString($value); } else { return $value; } } } } } } }
/** * @covers MicrosoftAzure\Storage\Table\TableRestProxy::updateEntity */ private function createTargetEntity($table, $initialEnt, $concurType, $mutatePivot) { $targetEnt = TableServiceFunctionalTestUtils::cloneEntity($initialEnt); // Update the entity/table state to get the requested concurrency type error. switch ($concurType) { case ConcurType::NO_KEY_MATCH: // Mutate the keys to not match. $targetEnt->setRowKey(TableServiceFunctionalTestData::getNewKey()); break; case ConcurType::KEY_MATCH_NO_ETAG: $targetEnt->setETag(null); break; case ConcurType::KEY_MATCH_ETAG_MISMATCH: $newETag = $this->restProxy->updateEntity($table, $initialEnt)->getETag(); $initialEnt->setETag($newETag); // Now the $targetEnt ETag will not match. $this->assertTrue($targetEnt->getETag() != $initialEnt->getETag(), 'targetEnt->ETag(\'' . $targetEnt->getETag() . '\') != updated->ETag(\'' . $initialEnt->getETag() . '\')'); break; case ConcurType::KEY_MATCH_ETAG_MATCH: // Don't worry here. break; } // Mutate the properties. TableServiceFunctionalTestUtils::mutateEntity($targetEnt, $mutatePivot); return $targetEnt; }