public function testCommonMethods() { $instance = new ThingDescription(); $this->assertEquals('', $instance->getQueryString()); $this->assertEquals(false, $instance->isSingleton()); $this->assertEquals(array(), $instance->getPrintRequests()); $this->assertEquals(0, $instance->getSize()); $this->assertEquals(0, $instance->getDepth()); $this->assertEquals(0, $instance->getQueryFeatures()); }
/** * Recursively restrict query to a maximal size and depth as given. * Returns a possibly changed description that should be used as a replacement. * Reduce values of parameters to account for the returned descriptions size. * Default implementation for non-nested descriptions of size 1. * The parameter $log contains a list of all pruned conditions, updated when some * description was reduced. * * @note Objects must not do changes on $this during pruning, since $this can be * reused in multiple places of one or many queries. Make new objects to reflect * changes! */ public function prune(&$maxsize, &$maxDepth, &$log) { if ($maxsize < $this->getSize() || $maxDepth < $this->getDepth()) { $log[] = $this->getQueryString(); $result = new ThingDescription(); $result->setPrintRequests($this->getPrintRequests()); return $result; } $maxsize = $maxsize - $this->getSize(); $maxDepth = $maxDepth - $this->getDepth(); return $this; }