File tree Expand file tree Collapse file tree 4 files changed +47
-3
lines changed Expand file tree Collapse file tree 4 files changed +47
-3
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ public function update($values)
75
75
76
76
foreach ($ values as $ colName => $ value ) {
77
77
$ entry .= sprintf (
78
- '<gsx:%s>%s </gsx:%s> ' ,
78
+ '<gsx:%s><![CDATA[%s]]> </gsx:%s> ' ,
79
79
$ colName ,
80
80
$ value ,
81
81
$ colName
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ public function insert($row)
68
68
$ entry = '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gsx="http://schemas.google.com/spreadsheets/2006/extended"> ' ;
69
69
foreach ($ row as $ colName => $ value ) {
70
70
$ entry .= sprintf (
71
- '<gsx:%s>%s </gsx:%s> ' ,
71
+ '<gsx:%s><![CDATA[%s]]> </gsx:%s> ' ,
72
72
$ colName ,
73
73
$ value ,
74
74
$ colName
Original file line number Diff line number Diff line change
1
+ <?php
2
+ namespace Google \Spreadsheet ;
3
+
4
+ use PHPUnit_Framework_TestCase ;
5
+
6
+ class ListEntryTest extends PHPUnit_Framework_TestCase
7
+ {
8
+
9
+ public function testGetEditUrl ()
10
+ {
11
+ $ xml = file_get_contents (__DIR__ .'/xml/list-feed.xml ' );
12
+ $ listFeed = new ListFeed ($ xml );
13
+ $ listEntry = current ($ listFeed ->getEntries ());
14
+
15
+ $ this ->assertEquals (
16
+ 'https://spreadsheets.google.com/feeds/list/G3345eEsfsk60/od6/private/full/cokwr/bnkj8i7jo6c ' ,
17
+ $ listEntry ->getEditUrl ()
18
+ );
19
+ }
20
+
21
+ public function testUpdate ()
22
+ {
23
+ $ mockServiceRequest = $ this ->getMockBuilder ('Google\Spreadsheet\DefaultServiceRequest ' )
24
+ ->setMethods (array ("put " ))
25
+ ->disableOriginalConstructor ()
26
+ ->getMock ();
27
+
28
+ $ mockServiceRequest ->expects ($ this ->once ())
29
+ ->method ('put ' )
30
+ ->with (
31
+ $ this ->equalTo ('https://spreadsheets.google.com/feeds/list/G3345eEsfsk60/od6/private/full/cokwr/bnkj8i7jo6c ' ),
32
+ $ this ->stringContains ('<gsx:nname><![CDATA[Asim]]></gsx:nname> ' )
33
+ );
34
+
35
+ ServiceRequestFactory::setInstance ($ mockServiceRequest );
36
+
37
+ $ listFeed = new ListFeed (file_get_contents (__DIR__ .'/xml/list-feed.xml ' ));
38
+ $ entry = current ($ listFeed ->getEntries ());
39
+ $ data = $ entry ->getValues ();
40
+ $ data ["nname " ] = "Asim " ;
41
+ $ entry ->update ($ data );
42
+ }
43
+
44
+ }
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public function testInsert()
28
28
->method ('post ' )
29
29
->with (
30
30
$ this ->equalTo ('https://spreadsheets.google.com/feeds/list/G3345eEsfsk60/od6/private/full ' ),
31
- $ this ->stringContains ('<gsx:occupation>software engineer</gsx:occupation> ' )
31
+ $ this ->stringContains ('<gsx:occupation><![CDATA[ software engineer]]> </gsx:occupation> ' )
32
32
);
33
33
34
34
ServiceRequestFactory::setInstance ($ mockServiceRequest );
You can’t perform that action at this time.
0 commit comments