mirror of
https://github.com/nextcloud/tables.git
synced 2026-01-14 03:17:18 +00:00
33 lines
906 B
PHP
33 lines
906 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace OCA\Tables\Tests\Unit\Db;
|
|
|
|
use OCA\Tables\Db\Row2;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class Row2Test extends TestCase {
|
|
public function testToResponseArrayMergesMetaButJsonSerializeDoesNot(): void {
|
|
$row = new Row2();
|
|
$row->setTableId(1);
|
|
|
|
$row->setData([
|
|
['columnId' => 57, 'value' => 'foo'],
|
|
['columnId' => 58, 'value' => 'bar'],
|
|
]);
|
|
|
|
$json = $row->jsonSerialize();
|
|
$this->assertArrayNotHasKey('columnName', $json['data'][0]);
|
|
|
|
$row->addCellMeta(57, ['columnName' => 'Title 57']);
|
|
|
|
$resp = $row->toResponseArray();
|
|
$this->assertArrayHasKey('columnName', $resp['data'][0]);
|
|
$this->assertSame('Title 57', $resp['data'][0]['columnName']);
|
|
|
|
$json2 = $row->jsonSerialize();
|
|
$this->assertArrayNotHasKey('columnName', $json2['data'][0]);
|
|
}
|
|
}
|