1*a1a3b679SAndreas Boehler<?php 2*a1a3b679SAndreas Boehler 3*a1a3b679SAndreas Boehlernamespace Sabre\DAV; 4*a1a3b679SAndreas Boehler 5*a1a3b679SAndreas Boehlerclass SyncTokenPropertyTest extends \Sabre\DAVServerTest { 6*a1a3b679SAndreas Boehler 7*a1a3b679SAndreas Boehler /** 8*a1a3b679SAndreas Boehler * The assumption in these tests is that a PROPFIND is going on, and to 9*a1a3b679SAndreas Boehler * fetch the sync-token, the event handler is just able to use the existing 10*a1a3b679SAndreas Boehler * result. 11*a1a3b679SAndreas Boehler * 12*a1a3b679SAndreas Boehler * @dataProvider data 13*a1a3b679SAndreas Boehler */ 14*a1a3b679SAndreas Boehler function testAlreadyThere1($name, $value) { 15*a1a3b679SAndreas Boehler 16*a1a3b679SAndreas Boehler $propFind = new PropFind('foo', [ 17*a1a3b679SAndreas Boehler '{http://calendarserver.org/ns/}getctag', 18*a1a3b679SAndreas Boehler $name, 19*a1a3b679SAndreas Boehler ]); 20*a1a3b679SAndreas Boehler 21*a1a3b679SAndreas Boehler $propFind->set($name, $value); 22*a1a3b679SAndreas Boehler $corePlugin = new CorePlugin(); 23*a1a3b679SAndreas Boehler $corePlugin->propFindLate($propFind, new SimpleCollection('hi')); 24*a1a3b679SAndreas Boehler 25*a1a3b679SAndreas Boehler $this->assertEquals("hello", $propFind->get('{http://calendarserver.org/ns/}getctag')); 26*a1a3b679SAndreas Boehler 27*a1a3b679SAndreas Boehler } 28*a1a3b679SAndreas Boehler 29*a1a3b679SAndreas Boehler /** 30*a1a3b679SAndreas Boehler * In these test-cases, the plugin is forced to do a local propfind to 31*a1a3b679SAndreas Boehler * fetch the items. 32*a1a3b679SAndreas Boehler * 33*a1a3b679SAndreas Boehler * @dataProvider data 34*a1a3b679SAndreas Boehler */ 35*a1a3b679SAndreas Boehler function testRefetch($name, $value) { 36*a1a3b679SAndreas Boehler 37*a1a3b679SAndreas Boehler $this->server->tree = new Tree( 38*a1a3b679SAndreas Boehler new SimpleCollection('root', [ 39*a1a3b679SAndreas Boehler new Mock\PropertiesCollection( 40*a1a3b679SAndreas Boehler 'foo', 41*a1a3b679SAndreas Boehler [], 42*a1a3b679SAndreas Boehler [$name => $value] 43*a1a3b679SAndreas Boehler ) 44*a1a3b679SAndreas Boehler ]) 45*a1a3b679SAndreas Boehler ); 46*a1a3b679SAndreas Boehler $propFind = new PropFind('foo', [ 47*a1a3b679SAndreas Boehler '{http://calendarserver.org/ns/}getctag', 48*a1a3b679SAndreas Boehler $name, 49*a1a3b679SAndreas Boehler ]); 50*a1a3b679SAndreas Boehler 51*a1a3b679SAndreas Boehler $corePlugin = $this->server->getPlugin('core'); 52*a1a3b679SAndreas Boehler $corePlugin->propFindLate($propFind, new SimpleCollection('hi')); 53*a1a3b679SAndreas Boehler 54*a1a3b679SAndreas Boehler $this->assertEquals("hello", $propFind->get('{http://calendarserver.org/ns/}getctag')); 55*a1a3b679SAndreas Boehler 56*a1a3b679SAndreas Boehler } 57*a1a3b679SAndreas Boehler 58*a1a3b679SAndreas Boehler function testNoData() { 59*a1a3b679SAndreas Boehler 60*a1a3b679SAndreas Boehler $this->server->tree = new Tree( 61*a1a3b679SAndreas Boehler new SimpleCollection('root', [ 62*a1a3b679SAndreas Boehler new Mock\PropertiesCollection( 63*a1a3b679SAndreas Boehler 'foo', 64*a1a3b679SAndreas Boehler [], 65*a1a3b679SAndreas Boehler [] 66*a1a3b679SAndreas Boehler ) 67*a1a3b679SAndreas Boehler ]) 68*a1a3b679SAndreas Boehler ); 69*a1a3b679SAndreas Boehler 70*a1a3b679SAndreas Boehler $propFind = new PropFind('foo', [ 71*a1a3b679SAndreas Boehler '{http://calendarserver.org/ns/}getctag', 72*a1a3b679SAndreas Boehler ]); 73*a1a3b679SAndreas Boehler 74*a1a3b679SAndreas Boehler $corePlugin = $this->server->getPlugin('core'); 75*a1a3b679SAndreas Boehler $corePlugin->propFindLate($propFind, new SimpleCollection('hi')); 76*a1a3b679SAndreas Boehler 77*a1a3b679SAndreas Boehler $this->assertNull($propFind->get('{http://calendarserver.org/ns/}getctag')); 78*a1a3b679SAndreas Boehler 79*a1a3b679SAndreas Boehler } 80*a1a3b679SAndreas Boehler 81*a1a3b679SAndreas Boehler function data() { 82*a1a3b679SAndreas Boehler 83*a1a3b679SAndreas Boehler return [ 84*a1a3b679SAndreas Boehler [ 85*a1a3b679SAndreas Boehler '{http://sabredav.org/ns}sync-token', 86*a1a3b679SAndreas Boehler "hello" 87*a1a3b679SAndreas Boehler ], 88*a1a3b679SAndreas Boehler [ 89*a1a3b679SAndreas Boehler '{DAV:}sync-token', 90*a1a3b679SAndreas Boehler "hello" 91*a1a3b679SAndreas Boehler ], 92*a1a3b679SAndreas Boehler [ 93*a1a3b679SAndreas Boehler '{DAV:}sync-token', 94*a1a3b679SAndreas Boehler new Xml\Property\Href(Sync\Plugin::SYNCTOKEN_PREFIX . "hello", false) 95*a1a3b679SAndreas Boehler ] 96*a1a3b679SAndreas Boehler ]; 97*a1a3b679SAndreas Boehler 98*a1a3b679SAndreas Boehler } 99*a1a3b679SAndreas Boehler 100*a1a3b679SAndreas Boehler} 101