-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathRow2Test.php
More file actions
32 lines (23 loc) · 810 Bytes
/
Row2Test.php
File metadata and controls
32 lines (23 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?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]);
}
}