getRowsMetadata() public method

Returns an array containing the requested metadata value of each row.
public getRowsMetadata ( string $name ) : array
$name string The metadata column to return.
return array
 public function test_filter_shouldUrlEncodeValues()
 {
     $mapping = array(1 => 'Core tests', 3 => 'plugins tästs');
     $this->table->filter($this->filter, array('segmentName', $mapping));
     $metadata = $this->table->getRowsMetadata('segment');
     $expected = array('segmentName==Core+tests', false, 'segmentName==plugins+t%C3%A4sts', false, false, false);
     $this->assertSame($expected, $metadata);
 }
 public function test_filter_IfMultipleSegmentsAreGiven_IfShouldBePossibleToIgnorePartsByUsingAnEmptyStringAsSegmentName()
 {
     // must result in 3 exploded parts city, region and country
     $this->table->filter($this->filter, array(array('city', '', 'country'), $delimiter = ' '));
     $segmentValues = $this->table->getRowsMetadata('segment');
     $expected = array(false, false, false, false, false, 'city==play;country==movie', false, false);
     $this->assertSame($expected, $segmentValues);
 }
 public function test_filter_shouldRemoveAllMetadataEntriesHavingTheGivenName_EvenIfOnlySomeRowsHaveThatMetadataName()
 {
     $this->table->filter($this->filter, array('other'));
     $metadata = $this->table->getRowsMetadata('other');
     $this->assertSame(array(false, false, false, false, false), $metadata);
     $metadata = $this->table->getRowsMetadata('test');
     $expected = array('1', '2', '3', '1', '4');
     $this->assertSame($expected, $metadata);
 }
 public function test_filter_shouldOnlyPrependIfAMetadataNameIsSet()
 {
     $this->table->filter($this->filter, array('other', 'prependme'));
     $metadata = $this->table->getRowsMetadata('other');
     $this->assertSame(array(false, 'prependmevalue', false, 'prependmevalue', 'prependme'), $metadata);
     // should still be the same
     $metadata = $this->table->getRowsMetadata('test');
     $this->assertSame(array('1', '2', '3', '1', '4'), $metadata);
 }
 public function test_filter_shouldRemoveAllMetadataEntriesHavingTheGivenName()
 {
     $prepend = 'city=test;';
     $this->table->filter($this->filter, array($prepend));
     $metadata = $this->table->getRowsMetadata('segment');
     $this->assertSame(array(false, $prepend . 'country=NZ', false, $prepend . 'country=AU', $prepend), $metadata);
     // should be still the same
     $metadata = $this->table->getRowsMetadata('test');
     $this->assertSame(array('1', '2', '3', '1', '4'), $metadata);
 }
Esempio n. 6
0
 public function test_filter_shouldNotGenerateASegmentValueIfReturnValueIsFalse()
 {
     $this->table->filter($this->filter, array(function ($label) {
         if ($label === false) {
             return 'was false';
         }
         return false;
     }));
     $segmentValues = $this->table->getRowsMetadata('segmentValue');
     $expected = array(false, false, false, false, 'was false', false, 'was false', false);
     $this->assertSame($expected, $segmentValues);
 }
 public function test_filter()
 {
     $dataTable = new DataTable();
     $dataTable->addRowsFromArray(array(array(Row::COLUMNS => array('label' => 'val1', 'nb_visits' => 120)), array(Row::COLUMNS => array('nb_visits' => 90)), array(Row::COLUMNS => array('label' => 'val2 5w ö?', 'nb_visits' => 99)), array(Row::COLUMNS => array('label' => Archiver::LABEL_CUSTOM_VALUE_NOT_DEFINED, 'nb_visits' => 99))));
     $dataTable->filter($this->filter, array($idDimension = 5));
     $metadata = $dataTable->getRowsMetadata('segment');
     $expected = array('dimension5==val1', false, 'dimension5==val2+5w+%C3%B6%3F', 'dimension5==');
     $this->assertSame($expected, $metadata);
 }
 private function assertSegmentValues($expectedSegmentValues)
 {
     $segmentValues = $this->table->getRowsMetadata('segmentValue');
     $this->assertSame($expectedSegmentValues, $segmentValues);
 }