Merge branch 'pu/2013.10-groupimport'
authorPhilipp Schüle <p.schuele@metaways.de>
Fri, 29 Aug 2014 17:17:17 +0000 (19:17 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 29 Aug 2014 17:17:17 +0000 (19:17 +0200)
509 files changed:
bin/tn.php
docs/ext-doc.xml
scripts/packaging/Univention/debian/etc/apache.conf
scripts/packaging/debian/etc/apache.conf
scripts/packaging/fedora/SOURCES/tine20-httpd.conf
tests/tine20/ActiveSync/Controller/CalendarTests.php
tests/tine20/Addressbook/Frontend/CardDAVTest.php
tests/tine20/AllTests.php
tests/tine20/Calendar/AllTests.php
tests/tine20/Calendar/Backend/SqlTest.php
tests/tine20/Calendar/Controller/EventGrantsTests.php
tests/tine20/Calendar/Controller/EventNotificationsTests.php
tests/tine20/Calendar/Controller/EventTests.php
tests/tine20/Calendar/Controller/MSEventFacadeTest.php
tests/tine20/Calendar/Controller/RecurTest.php
tests/tine20/Calendar/Controller/ResourceTest.php
tests/tine20/Calendar/Convert/Event/VCalendar/GenericTest.php
tests/tine20/Calendar/Export/ICalTest.php
tests/tine20/Calendar/Frontend/AllTests.php
tests/tine20/Calendar/Frontend/CalDAV/AllTests.php [new file with mode: 0644]
tests/tine20/Calendar/Frontend/CalDAV/PluginDefaultAlarmsTest.php [new file with mode: 0644]
tests/tine20/Calendar/Frontend/CalDAV/PluginManagedAttachmentsTest.php [new file with mode: 0644]
tests/tine20/Calendar/Frontend/CalDAV/ProxyTest.php [new file with mode: 0644]
tests/tine20/Calendar/Frontend/CalDAVTest.php
tests/tine20/Calendar/Frontend/WebDAV/AllTests.php
tests/tine20/Calendar/Frontend/WebDAV/ContainerTest.php
tests/tine20/Calendar/Frontend/WebDAV/EventTest.php
tests/tine20/Calendar/Import/CalDAV/ClientMock.php [new file with mode: 0644]
tests/tine20/Calendar/Import/CalDAVTest.php [new file with mode: 0644]
tests/tine20/Calendar/Import/ICalTest.php
tests/tine20/Calendar/Import/files/apple_caldendar_repeating.ics
tests/tine20/Calendar/Import/files/attender_empty_name.ics [new file with mode: 0644]
tests/tine20/Calendar/Import/files/empty_categories.ics [new file with mode: 0644]
tests/tine20/Calendar/Import/files/invalid_utf8.ics [new file with mode: 0644]
tests/tine20/Calendar/Import/files/iphone_longlocation.ics [new file with mode: 0644]
tests/tine20/Calendar/Import/files/iphone_longsummary.ics [new file with mode: 0644]
tests/tine20/Calendar/Import/files/outlook_bysetpos.ics [new file with mode: 0644]
tests/tine20/Calendar/Import/files/rrule_until_at_dtstart_allday.ics [new file with mode: 0644]
tests/tine20/Calendar/Import/files/utf8mb4_summary.ics [new file with mode: 0644]
tests/tine20/Calendar/JsonTests.php
tests/tine20/Calendar/Model/AttenderFilterTests.php
tests/tine20/Calendar/Model/AttenderTests.php
tests/tine20/Calendar/TestCase.php
tests/tine20/Courses/JsonTest.php
tests/tine20/Crm/Export/CsvTest.php
tests/tine20/Crm/JsonTest.php
tests/tine20/ExampleApplication/AllTests.php [new file with mode: 0644]
tests/tine20/ExampleApplication/JsonTest.php [new file with mode: 0644]
tests/tine20/ExampleApplication/TestCase.php [new file with mode: 0644]
tests/tine20/Felamimail/AllTests.php
tests/tine20/Felamimail/Controller/AccountTest.php
tests/tine20/Felamimail/Frontend/JsonTest.php [moved from tests/tine20/Felamimail/JsonTest.php with 99% similarity]
tests/tine20/Felamimail/Frontend/WebDAVTest.php [new file with mode: 0644]
tests/tine20/Filemanager/AllTests.php
tests/tine20/Filemanager/Controller/DownloadLinkTests.php [new file with mode: 0644]
tests/tine20/Filemanager/Frontend/JsonTests.php
tests/tine20/Filemanager/Frontend/WebDAVTest.php
tests/tine20/HumanResources/CliTests.php
tests/tine20/HumanResources/ControllerTests.php
tests/tine20/HumanResources/JsonTests.php
tests/tine20/HumanResources/TestCase.php
tests/tine20/Inventory/Import/CsvTest.php
tests/tine20/Inventory/JsonTest.php
tests/tine20/Phone/JsonTest.php
tests/tine20/Projects/JsonTest.php
tests/tine20/Sales/Backend/ContractTest.php
tests/tine20/Sales/Backend/NumberTest.php
tests/tine20/Sales/ControllerTest.php
tests/tine20/Sales/JsonTest.php
tests/tine20/Tasks/Convert/Task/VCalendar/EMClientTest.php
tests/tine20/Tasks/Convert/Task/VCalendar/MacOSXTest.php
tests/tine20/Tasks/Import/files/apple_valarm.ics [new file with mode: 0644]
tests/tine20/TestCase.php
tests/tine20/Timetracker/AbstractTest.php
tests/tine20/Timetracker/ExportTest.php
tests/tine20/Timetracker/JsonTest.php
tests/tine20/Tinebase/AllTests.php
tests/tine20/Tinebase/Frontend/AllTests.php
tests/tine20/Tinebase/Frontend/Json/PersistentFilterTest.php
tests/tine20/Tinebase/Frontend/JsonTest.php
tests/tine20/Tinebase/Frontend/WebDAV/RecordTest.php [new file with mode: 0644]
tests/tine20/Tinebase/PersistentFilterTest.php [new file with mode: 0644]
tests/tine20/Tinebase/Pluggable/ConcreteTest.php [new file with mode: 0644]
tests/tine20/Tinebase/Pluggable/DummyBackend.php [new file with mode: 0644]
tests/tine20/Tinebase/Pluggable/DummyController.php [new file with mode: 0644]
tests/tine20/Tinebase/Pluggable/DummyFrontend.php [new file with mode: 0644]
tests/tine20/Tinebase/Pluggable/Plugin/DummyPlugin.php [new file with mode: 0644]
tests/tine20/Tinebase/PreferenceTest.php
tests/tine20/Tinebase/Relation/RelationTest.php
tests/tine20/Tinebase/ScheduledImportTest.php [new file with mode: 0644]
tests/tine20/Tinebase/Scheduler/SchedulerTest.php
tests/tine20/Tinebase/WebDav/AllTests.php
tests/tine20/Tinebase/WebDav/Plugin/OwnCloudTest.php
tests/tine20/Tinebase/WebDav/Plugin/PrincipalSearchTest.php [new file with mode: 0644]
tests/tine20/Tinebase/WebDav/PrincipalBackendTest.php
tests/tine20/Tinebase/WebDav/RootTest.php
tine20/ActiveSync/Setup/setup.xml
tine20/Addressbook/Controller/List.php
tine20/Addressbook/Convert/Contact/Json.php
tine20/Addressbook/Frontend/CardDAV.php [deleted file]
tine20/Addressbook/Frontend/WebDAV.php
tine20/Addressbook/Frontend/WebDAV/Container.php
tine20/Addressbook/Import/definitions/adb_tine_import_csv.xml
tine20/Addressbook/Model/Contact.php
tine20/Addressbook/Model/List.php
tine20/Addressbook/Model/ListMemberFilter.php
tine20/Addressbook/Setup/Initialize.php
tine20/Addressbook/Setup/Update/Release3.php
tine20/Addressbook/css/Addressbook.css
tine20/Admin/Frontend/Json.php
tine20/Admin/Setup/DemoData.php
tine20/Admin/css/Admin.css
tine20/Calendar/Backend/Sql.php
tine20/Calendar/Controller/MSEventFacade.php
tine20/Calendar/Convert/Event/Json.php
tine20/Calendar/Convert/Event/VCalendar/Abstract.php
tine20/Calendar/Convert/Event/VCalendar/MacOSX.php
tine20/Calendar/Frontend/CalDAV.php [deleted file]
tine20/Calendar/Frontend/CalDAV/Cli.php [new file with mode: 0644]
tine20/Calendar/Frontend/CalDAV/Dropbox.php [new file with mode: 0644]
tine20/Calendar/Frontend/CalDAV/PluginDefaultAlarms.php [new file with mode: 0644]
tine20/Calendar/Frontend/CalDAV/PluginManagedAttachments.php [new file with mode: 0644]
tine20/Calendar/Frontend/Cli.php
tine20/Calendar/Frontend/WebDAV.php
tine20/Calendar/Frontend/WebDAV/Backend.php
tine20/Calendar/Frontend/WebDAV/Container.php
tine20/Calendar/Frontend/WebDAV/Event.php
tine20/Calendar/Import/CalDav/Client.php [new file with mode: 0644]
tine20/Calendar/Import/CalDav/Decorator/Abstract.php [new file with mode: 0644]
tine20/Calendar/Import/CalDav/Decorator/MacOSX.php [new file with mode: 0644]
tine20/Calendar/Import/CalDav/SabreAttachProperty.php [new file with mode: 0644]
tine20/Calendar/Import/Ical.php
tine20/Calendar/Model/Attender.php
tine20/Calendar/Model/Event.php
tine20/Calendar/Model/EventFilter.php
tine20/Calendar/Model/Rrule.php
tine20/Calendar/Preference.php
tine20/Calendar/Setup/Initialize.php
tine20/Calendar/Setup/Update/Release3.php
tine20/Calendar/Setup/Update/Release8.php
tine20/Calendar/Setup/setup.xml
tine20/Calendar/css/Calendar.css
tine20/Calendar/css/daysviewpanel.css
tine20/Calendar/css/monthviewpanel.css
tine20/Calendar/css/print.css
tine20/Calendar/js/CalDAVContainerPropertiesHookField.js
tine20/Calendar/js/EventUI.js
tine20/Calendar/js/MainScreenCenterPanel.js
tine20/Calendar/js/Model.js
tine20/Calendar/js/TreePanel.js
tine20/Calendar/translations/de.po
tine20/Calendar/translations/template.pot
tine20/Courses/Acl/Rights.php
tine20/Courses/Controller/Course.php
tine20/Courses/Setup/Initialize.php
tine20/Courses/Setup/Update/Release5.php
tine20/Crm/Controller/Lead.php
tine20/Crm/Frontend/Json.php
tine20/Crm/Model/Lead.php
tine20/Crm/Model/LeadFilter.php
tine20/Crm/Setup/Initialize.php
tine20/Crm/Setup/Update/Release3.php
tine20/Crm/Setup/Update/Release5.php
tine20/Crm/Setup/Update/Release8.php [new file with mode: 0644]
tine20/Crm/Setup/setup.xml
tine20/Crm/css/Crm.css
tine20/Crm/js/Crm.js
tine20/Crm/js/LeadEditDialog.js
tine20/Crm/js/LeadGridPanel.js
tine20/Crm/js/Model.js
tine20/Crm/js/Task.js
tine20/Crm/translations/de.po
tine20/Crm/translations/template.pot
tine20/ExampleApplication/Controller/ExampleRecord.php
tine20/ExampleApplication/ExampleApplication.jsb2
tine20/ExampleApplication/Frontend/Json.php
tine20/ExampleApplication/Model/ExampleRecord.php
tine20/ExampleApplication/Model/ExampleRecordFilter.php
tine20/ExampleApplication/js/Example.js [new file with mode: 0644]
tine20/ExampleApplication/js/ExampleDetailsPanel.js [moved from tine20/Tool/Application/templates/js/ExampleRecordDetailsPanel.js with 92% similarity]
tine20/ExampleApplication/js/ExampleGridPanel.js [moved from tine20/ExampleApplication/js/ExampleRecordGridPanel.js with 65% similarity]
tine20/ExampleApplication/js/ExampleRecordDetailsPanel.js [deleted file]
tine20/ExampleApplication/js/ExampleRecordEditDialog.js
tine20/Felamimail/Controller.php
tine20/Felamimail/Controller/Account.php
tine20/Felamimail/Frontend/WebDAV.php
tine20/Felamimail/Preference.php
tine20/Felamimail/Setup/Initialize.php
tine20/Felamimail/Setup/Update/Release3.php
tine20/Felamimail/css/Felamimail.css
tine20/Felamimail/js/sieve/RuleEditDialog.js
tine20/Felamimail/translations/de.po
tine20/Felamimail/translations/template.pot
tine20/Filemanager/Acl/Rights.php
tine20/Filemanager/Controller/DownloadLink.php [new file with mode: 0644]
tine20/Filemanager/Filemanager.jsb2
tine20/Filemanager/Frontend/Download.php [new file with mode: 0644]
tine20/Filemanager/Frontend/Json.php
tine20/Filemanager/Frontend/WebDAV.php
tine20/Filemanager/Model/DownloadLink.php [new file with mode: 0644]
tine20/Filemanager/Model/DownloadLinkFilter.php [new file with mode: 0644]
tine20/Filemanager/Setup/Update/Release8.php [moved from tine20/Tool/Application/templates/Setup/setup.xml with 57% similarity]
tine20/Filemanager/Setup/setup.xml
tine20/Filemanager/css/Filemanager.css
tine20/Filemanager/js/DownloadLinkDialog.js [new file with mode: 0644]
tine20/Filemanager/js/DownloadLinkGridPanel.js [new file with mode: 0644]
tine20/Filemanager/js/GridContextMenu.js
tine20/Filemanager/js/Model.js
tine20/Filemanager/js/NodeEditDialog.js
tine20/Filemanager/js/NodeGridPanel.js
tine20/Filemanager/js/NodeTreePanel.js
tine20/Filemanager/translations/de.po
tine20/Filemanager/translations/template.pot
tine20/Filemanager/views/file.phtml [new file with mode: 0644]
tine20/Filemanager/views/folder.phtml [new file with mode: 0644]
tine20/Filemanager/views/notfound.phtml [new file with mode: 0644]
tine20/HumanResources/Config.php
tine20/HumanResources/Exception/ContractNotEditable.php
tine20/HumanResources/Frontend/Json.php
tine20/HumanResources/Frontend/WebDAV.php [new file with mode: 0644]
tine20/HumanResources/Frontend/WebDAV/Container.php [new file with mode: 0644]
tine20/HumanResources/Frontend/WebDAV/Directory.php [new file with mode: 0644]
tine20/HumanResources/Frontend/WebDAV/File.php [new file with mode: 0644]
tine20/HumanResources/Model/Account.php
tine20/HumanResources/Model/Employee.php
tine20/HumanResources/Setup/DemoData.php
tine20/HumanResources/Setup/Initialize.php
tine20/HumanResources/Setup/Update/Release6.php
tine20/HumanResources/Setup/Update/Release7.php
tine20/HumanResources/Setup/Update/Release8.php
tine20/HumanResources/Setup/setup.xml
tine20/HumanResources/js/AccountEditDialog.js
tine20/HumanResources/js/DatePicker.js
tine20/HumanResources/js/EmployeeEditDialog.js
tine20/HumanResources/js/ExceptionHandler.js
tine20/HumanResources/js/FreeTimeGridPanel.js
tine20/Inventory/Frontend/Json.php
tine20/Inventory/Model/InventoryItem.php
tine20/Inventory/Setup/Initialize.php
tine20/Inventory/Setup/Update/Release7.php
tine20/Phone/Setup/Initialize.php
tine20/Phone/Setup/Update/Release7.php
tine20/Phone/Setup/setup.xml
tine20/Projects/Model/Project.php
tine20/Projects/Setup/Initialize.php
tine20/Projects/Setup/Update/Release1.php
tine20/RequestTracker/css/RequestTracker.css
tine20/Sales/Acl/Rights.php
tine20/Sales/Backend/CostCenter.php
tine20/Sales/Backend/Division.php
tine20/Sales/Backend/Number.php
tine20/Sales/Backend/Product.php [moved from tine20/Tool/Application/templates/Backend/ExampleRecord.php with 50% similarity]
tine20/Sales/Config.php
tine20/Sales/Controller/Contract.php
tine20/Sales/Controller/CostCenter.php
tine20/Sales/Controller/Division.php
tine20/Sales/Controller/NumberableAbstract.php [new file with mode: 0644]
tine20/Sales/Exception.php
tine20/Sales/Export/Ods/Abstract.php [new file with mode: 0644]
tine20/Sales/Frontend/Json.php
tine20/Sales/Model/Contract.php
tine20/Sales/Model/ContractFilter.php
tine20/Sales/Model/CostCenter.php
tine20/Sales/Model/CostCenterFilter.php
tine20/Sales/Model/Division.php
tine20/Sales/Model/DivisionFilter.php
tine20/Sales/Model/Number.php
tine20/Sales/Model/Product.php
tine20/Sales/Model/ProductFilter.php
tine20/Sales/Sales.jsb2
tine20/Sales/Setup/Initialize.php
tine20/Sales/Setup/Update/Release5.php
tine20/Sales/Setup/Update/Release8.php
tine20/Sales/Setup/setup.xml
tine20/Sales/css/Sales.css
tine20/Sales/js/ContractCostCenterFilterModel.js
tine20/Sales/js/ContractEditDialog.js
tine20/Sales/js/ContractGridPanel.js
tine20/Sales/js/CostCenterEditDialog.js [new file with mode: 0644]
tine20/Sales/js/DivisionEditDialog.js [new file with mode: 0644]
tine20/Sales/js/Models.js [deleted file]
tine20/Sales/js/ProductEditDialog.js
tine20/Sales/js/ProductGridPanel.js
tine20/Sales/js/Sales.js
tine20/Sales/translations/de.po
tine20/Sales/translations/template.pot
tine20/Setup/Exception.php
tine20/Setup/Exception/PromptUser.php [new file with mode: 0644]
tine20/Setup/Update/Abstract.php
tine20/Setup/js/ApplicationGridPanel.js
tine20/Setup/js/AuthenticationPanel.js
tine20/Setup/translations/template.pot
tine20/SimpleFAQ/Model/Faq.php
tine20/SimpleFAQ/Setup/Initialize.php
tine20/Sipgate/Controller/Account.php
tine20/Sipgate/Controller/Connection.php
tine20/Sipgate/Controller/Line.php
tine20/Sipgate/Model/Line.php
tine20/Sipgate/js/CallStateWindow.js
tine20/Tasks/Backend/Sql.php
tine20/Tasks/Convert/Task/VCalendar/Abstract.php
tine20/Tasks/Convert/Task/VCalendar/EMClient.php
tine20/Tasks/Frontend/CalDAV/Cli.php [new file with mode: 0644]
tine20/Tasks/Frontend/Cli.php [new file with mode: 0644]
tine20/Tasks/Frontend/WebDAV.php
tine20/Tasks/Frontend/WebDAV/Backend.php
tine20/Tasks/Frontend/WebDAV/Container.php
tine20/Tasks/Frontend/WebDAV/Task.php
tine20/Tasks/Import/CalDav/Client.php [new file with mode: 0644]
tine20/Tasks/Model/Task.php
tine20/Tasks/Model/TaskFilter.php
tine20/Tasks/Setup/Initialize.php
tine20/Tasks/Setup/Update/Release3.php
tine20/Tasks/Setup/Update/Release8.php [new file with mode: 0644]
tine20/Tasks/Setup/setup.xml
tine20/Tasks/Tasks.jsb2
tine20/Tasks/css/Tasks.css
tine20/Tasks/js/CalDAVContainerPropertiesHookField.js [new file with mode: 0644]
tine20/Timetracker/Controller/Timeaccount.php
tine20/Timetracker/Controller/Timesheet.php
tine20/Timetracker/Setup/Initialize.php
tine20/Timetracker/Setup/Update/Release3.php
tine20/Timetracker/Setup/Update/Release5.php
tine20/Timetracker/Setup/setup.xml
tine20/Tinebase/Acl/Roles.php
tine20/Tinebase/Application.php
tine20/Tinebase/Backend/Abstract.php
tine20/Tinebase/Backend/Sql/Abstract.php
tine20/Tinebase/Backend/Sql/Command/Interface.php
tine20/Tinebase/Backend/Sql/Command/Mysql.php
tine20/Tinebase/Backend/Sql/Command/Oracle.php
tine20/Tinebase/Backend/Sql/Command/Pgsql.php
tine20/Tinebase/Backend/Sql/Grants.php [new file with mode: 0644]
tine20/Tinebase/Config.php
tine20/Tinebase/Container.php
tine20/Tinebase/Controller.php
tine20/Tinebase/Controller/Abstract.php
tine20/Tinebase/Controller/Record/Abstract.php
tine20/Tinebase/Controller/Record/Grants.php [new file with mode: 0644]
tine20/Tinebase/Controller/ScheduledImport.php [new file with mode: 0644]
tine20/Tinebase/Convert/ImportExportDefinition/Json.php
tine20/Tinebase/Convert/Json.php
tine20/Tinebase/Convert/VCalendar/Abstract.php [new file with mode: 0644]
tine20/Tinebase/Core.php
tine20/Tinebase/CustomField/Config.php
tine20/Tinebase/DateTime.php
tine20/Tinebase/Department.php
tine20/Tinebase/EmailUser/Sql.php
tine20/Tinebase/Exception/InvalidRelationConstraints.php [new file with mode: 0644]
tine20/Tinebase/Exception/MonthFormat.php [new file with mode: 0644]
tine20/Tinebase/Export/Spreadsheet/Ods.php
tine20/Tinebase/FileSystem.php
tine20/Tinebase/FileSystem/RecordAttachments.php
tine20/Tinebase/Frontend/Abstract.php
tine20/Tinebase/Frontend/Http.php
tine20/Tinebase/Frontend/Json.php
tine20/Tinebase/Frontend/Json/Abstract.php
tine20/Tinebase/Frontend/Json/Container.php
tine20/Tinebase/Frontend/Json/PersistentFilter.php
tine20/Tinebase/Frontend/WebDAV/Abstract.php
tine20/Tinebase/Frontend/WebDAV/Container.php
tine20/Tinebase/Frontend/WebDAV/Directory.php
tine20/Tinebase/Frontend/WebDAV/Node.php
tine20/Tinebase/Frontend/WebDAV/Record.php [new file with mode: 0644]
tine20/Tinebase/Frontend/WebDAV/RecordCollection.php [new file with mode: 0644]
tine20/Tinebase/Group/Sql.php
tine20/Tinebase/Helper.php
tine20/Tinebase/Import/CalDav/Client.php [new file with mode: 0644]
tine20/Tinebase/Import/CalDav/GroupMemberSet.php [new file with mode: 0644]
tine20/Tinebase/ImportExportDefinition.php
tine20/Tinebase/Model/ContainerFilter.php
tine20/Tinebase/Model/CustomField/ConfigFilter.php
tine20/Tinebase/Model/Filter/Container.php
tine20/Tinebase/Model/Filter/Date.php
tine20/Tinebase/Model/Filter/GrantsFilterGroup.php [new file with mode: 0644]
tine20/Tinebase/Model/Filter/Month.php
tine20/Tinebase/Model/Filter/Text.php
tine20/Tinebase/Model/Grants.php
tine20/Tinebase/Model/GrantsFilter.php [new file with mode: 0644]
tine20/Tinebase/Model/Import.php [new file with mode: 0644]
tine20/Tinebase/Model/ImportFilter.php [new file with mode: 0644]
tine20/Tinebase/Model/PersistentFilter.php
tine20/Tinebase/Model/PersistentFilterFilter.php
tine20/Tinebase/Model/PersistentFilterGrant.php [new file with mode: 0644]
tine20/Tinebase/Model/Tag.php
tine20/Tinebase/Model/Tree/Node.php
tine20/Tinebase/Model/Tree/Node/Path.php
tine20/Tinebase/Model/User.php
tine20/Tinebase/ModelConfiguration.php
tine20/Tinebase/PersistentFilter.php
tine20/Tinebase/Pluggable/Abstract.php [new file with mode: 0644]
tine20/Tinebase/Record/Abstract.php
tine20/Tinebase/Record/RecordSet.php
tine20/Tinebase/Relation/Backend/Sql.php
tine20/Tinebase/Relations.php
tine20/Tinebase/Scheduler/Task.php
tine20/Tinebase/Server/Http.php
tine20/Tinebase/Server/Json.php
tine20/Tinebase/Server/WebDAV.php
tine20/Tinebase/Setup/Initialize.php
tine20/Tinebase/Setup/Update/Release8.php
tine20/Tinebase/Setup/setup.xml
tine20/Tinebase/Tinebase.jsb2
tine20/Tinebase/User.php
tine20/Tinebase/User/Sql.php
tine20/Tinebase/WebDav/Collection/Abstract.php
tine20/Tinebase/WebDav/Collection/AbstractContainerTree.php [new file with mode: 0644]
tine20/Tinebase/WebDav/Container/Abstract.php
tine20/Tinebase/WebDav/Plugin/PrincipalSearch.php [new file with mode: 0644]
tine20/Tinebase/WebDav/Principal.php [new file with mode: 0644]
tine20/Tinebase/WebDav/PrincipalBackend.php
tine20/Tinebase/WebDav/PrincipalCollection.php [new file with mode: 0644]
tine20/Tinebase/WebDav/Root.php
tine20/Tinebase/css/SmallForms.css
tine20/Tinebase/css/Tinebase.css
tine20/Tinebase/css/ux/ArrowCollapse.css
tine20/Tinebase/css/ux/DatePickerWeekPlugin.css
tine20/Tinebase/css/ux/SubFormPanel.css
tine20/Tinebase/css/ux/display/DisplayPanel.css
tine20/Tinebase/css/ux/form/HtmlEditor.css
tine20/Tinebase/css/ux/form/Spinner.css
tine20/Tinebase/css/ux/grid/ActionColumnPlugin.css [new file with mode: 0644]
tine20/Tinebase/css/widgets/EditRecord.css
tine20/Tinebase/css/widgets/FilterToolbar.css
tine20/Tinebase/css/widgets/TagsPanel.css
tine20/Tinebase/js/ApplicationStarter.js
tine20/Tinebase/js/ExceptionHandler.js
tine20/Tinebase/js/MainMenu.js
tine20/Tinebase/js/Models.js
tine20/Tinebase/js/data/Clipboard.js [new file with mode: 0644]
tine20/Tinebase/js/data/MemoryBackend.js
tine20/Tinebase/js/data/Record.js
tine20/Tinebase/js/data/TitleRendererManager.js [new file with mode: 0644]
tine20/Tinebase/js/ux/Printer/print.css
tine20/Tinebase/js/ux/grid/ActionColumnPlugin.js [new file with mode: 0644]
tine20/Tinebase/js/ux/grid/GroupingGridPlugin.js [new file with mode: 0644]
tine20/Tinebase/js/widgets/account/ChangeAccountAction.js [new file with mode: 0644]
tine20/Tinebase/js/widgets/container/CalDAVContainerPropertiesHookField.js [new file with mode: 0644]
tine20/Tinebase/js/widgets/container/TreePanel.js
tine20/Tinebase/js/widgets/dialog/ExceptionHandlerDialog.js
tine20/Tinebase/js/widgets/dialog/MultipleEditDialogPlugin.js
tine20/Tinebase/js/widgets/form/AutoCompleteField.js
tine20/Tinebase/js/widgets/grid/FileUploadGrid.js
tine20/Tinebase/js/widgets/grid/GridPanel.js
tine20/Tinebase/js/widgets/persistentfilter/EditPersistentFilterPanel.js
tine20/Tinebase/js/widgets/persistentfilter/Model.js
tine20/Tinebase/js/widgets/persistentfilter/PickerPanel.js
tine20/Tinebase/js/widgets/relation/GenericPickerGridPanel.js
tine20/Tinebase/js/widgets/relation/PickerCombo.js
tine20/Tinebase/js/widgets/tree/ContextMenu.js
tine20/Tinebase/js/widgets/tree/FilterPlugin.js
tine20/Tinebase/js/widgets/tree/Loader.js
tine20/Tinebase/translations/de.po
tine20/Tinebase/translations/en.po
tine20/Tinebase/translations/template.pot
tine20/Tool/Application/templates/Config.php [deleted file]
tine20/Tool/Application/templates/Controller.php [deleted file]
tine20/Tool/Application/templates/Controller/ExampleRecord.php [deleted file]
tine20/Tool/Application/templates/ExampleApplication.jsb2 [deleted file]
tine20/Tool/Application/templates/Exception.php [deleted file]
tine20/Tool/Application/templates/Frontend/Cli.php [deleted file]
tine20/Tool/Application/templates/Frontend/Http.php [deleted file]
tine20/Tool/Application/templates/Frontend/Json.php [deleted file]
tine20/Tool/Application/templates/Model/ExampleRecord.php [deleted file]
tine20/Tool/Application/templates/Model/ExampleRecordFilter.php [deleted file]
tine20/Tool/Application/templates/Model/Status.php [deleted file]
tine20/Tool/Application/templates/Preference.php [deleted file]
tine20/Tool/Application/templates/Setup/Initialize.php [deleted file]
tine20/Tool/Application/templates/css/ExampleApplication.css [deleted file]
tine20/Tool/Application/templates/js/ExampleRecordEditDialog.js [deleted file]
tine20/Tool/Application/templates/js/ExampleRecordGridPanel.js [deleted file]
tine20/Tool/Application/templates/translations/bg.po [deleted file]
tine20/Tool/Application/templates/translations/ca.po [deleted file]
tine20/Tool/Application/templates/translations/cs.po [deleted file]
tine20/Tool/Application/templates/translations/de.po [deleted file]
tine20/Tool/Application/templates/translations/en.po [deleted file]
tine20/Tool/Application/templates/translations/es.po [deleted file]
tine20/Tool/Application/templates/translations/fr.po [deleted file]
tine20/Tool/Application/templates/translations/hu.po [deleted file]
tine20/Tool/Application/templates/translations/it.po [deleted file]
tine20/Tool/Application/templates/translations/ja.po [deleted file]
tine20/Tool/Application/templates/translations/nb.po [deleted file]
tine20/Tool/Application/templates/translations/pl.po [deleted file]
tine20/Tool/Application/templates/translations/ru.po [deleted file]
tine20/Tool/Application/templates/translations/template.pot [deleted file]
tine20/Tool/Application/templates/translations/zh_CN.po [deleted file]
tine20/Tool/Application/templates/translations/zh_TW.po [deleted file]
tine20/Tool/CodeGenerator/Application.php
tine20/Voipmanager/Setup/setup.xml
tine20/Zend/Auth/Adapter/ModSsl/Certificate/X509.php
tine20/Zend/Db/Adapter/Pdo/Pgsql.php [new file with mode: 0644]
tine20/bootstrap.php
tine20/build.xml
tine20/composer.json
tine20/composer.lock
tine20/config.inc.php.dist
tine20/docs/htaccess
tine20/images/oxygen/16x16/actions/edit-cut-break.png [new file with mode: 0644]
tine20/images/oxygen/22x22/actions/edit-cut-break.png [new file with mode: 0644]
tine20/images/oxygen/32x32/actions/edit-cut-break.png [new file with mode: 0644]
tine20/images/scalable/call-forward.svg
tine20/images/scalable/call-incoming.svg
tine20/images/scalable/call-missed.svg
tine20/images/scalable/call-outgoing.svg
tine20/init_plugins.php [new file with mode: 0644]
tine20/library/jsb2tk/tests/core/core.jsb2
tine20/library/jsb2tk/tests/modul/modul.jsb2
tine20/themes/tine20/resources/css/layout.css
tine20/tine20.php [changed mode: 0644->0755]

index b03c5c5..9afe891 100644 (file)
@@ -5,7 +5,7 @@
  * @package     Tine_Tool
  * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
  * @author      Flávio Gomes da Silva Lisboa <flavio.lisboa@serpro.gov.br>
- * @copyright   Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
  * @version     $Id$ 
  */
 
@@ -15,28 +15,27 @@ main();
 
 function main()
 {
-       prepareEnvironment();
-       
-       try {
-               $opts = new Zend_Console_Getopt(array(
-                               'create application|a=s'=>'create application option with required string parameter',
-                               'help'=>'help option with no required parameter'
-               )
-               );
-               $opts->parse();
-       } catch (Zend_Console_Getopt_Exception $e) {
-               echo $e->getUsageMessage();
-               exit;
-       }
+    prepareEnvironment();
 
-       if ($applicationName = $opts->getOption('a'))
-       {
-               create(APPLICATION, array($applicationName));
-               echo "Application $applicationName was created successfully into tine20 folder! \n";
-               exit;
-       }
-       echo $e->getUsageMessage();
-       exit;
+    try {
+        $opts = new Zend_Console_Getopt(array(
+                'create application|a=s'=>'create application option with required string parameter',
+                'help'=>'help option with no required parameter'
+        )
+        );
+        $opts->parse();
+    } catch (Zend_Console_Getopt_Exception $e) {
+        echo $e->getUsageMessage();
+        exit;
+    }
+
+    if ($applicationName = $opts->getOption('a'))
+    {
+        echo create(APPLICATION, array($applicationName));
+        exit;
+    }
+    echo "UNEXPECTED ERROR: missing argument. Type tn -help to see parameters \n";
+    exit;
 }
 
 /**
@@ -44,29 +43,29 @@ function main()
  */
 function prepareEnvironment()
 {
-       $paths = array(
-                       realpath(dirname(__FILE__) . '/../tine20'),
-                       realpath(dirname(__FILE__) . '/../tine20/library'),
-                       get_include_path()
-       );
-       set_include_path(implode(PATH_SEPARATOR, $paths));
+    $paths = array(
+            realpath(__DIR__ . '/../tine20'),
+            realpath(__DIR__ . '/../tine20/library'),
+            get_include_path()
+    );
+    set_include_path(implode(PATH_SEPARATOR, $paths));
 
-       require_once 'Zend/Loader/Autoloader.php';
-       $autoloader = Zend_Loader_Autoloader::getInstance();
-       $autoloader->setFallbackAutoloader(true);
-       Tinebase_Autoloader::initialize($autoloader);
+    require_once realpath(__DIR__ . '/../tine20') . '/bootstrap.php';
 }
 
 /**
  * Creates an instance of a class that knows how to build the requested structure
+ * Command can executed from everywhere, because the path is determined by __DIR__
  * @param string $builder
+ * @param array $args
+ * @return string message
  */
 function create($builder, array $args)
-{      
-       // last argument is path of Tine 2.0
-       $args[] = realpath(dirname(__FILE__) . '/../tine20');
+{
+    // last argument is path of Tine 2.0
+    $args[] = realpath(__DIR__ . '/../tine20');
 
-       $className = 'Tool_CodeGenerator_' . $builder;
-       $tcg = new $className();
-       $tcg->build($args);
-}
\ No newline at end of file
+    $className = 'Tool_CodeGenerator_' . $builder;
+    $tcg = new $className();
+    return $tcg->build($args);
+}
index 8f70a4d..a3003ae 100644 (file)
@@ -1,48 +1,46 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<doc>\r
-    <sources>\r
-        <!-- <source src="../tine20/library/ExtJS/src" match="*.js"/> -->\r
-\r
-\r
-               <source src="../tine20/Tinebase/js/" match="*.js"/>\r
-\r
-\r
-        <source src="../tine20/Addressbook/js/ContactGrid.js"/>\r
-        <source src="../tine20/Addressbook/js/SearchCombo.js"/>\r
-        <!-- <source src="../tine20/Admin/js/UserEditDialog.js"/> -->\r
-        <!-- <source src="../tine20/Calendar/js" match="*.js"/> -->\r
-        <source src="../tine20/Calendar/js/AttendeeGridPanel.js"/>\r
-        <source src="../tine20/Calendar/js/Calendar.js"/>\r
-        <source src="../tine20/Calendar/js/CalendarPanel.js"/>\r
-        <source src="../tine20/Calendar/js/CalendarSelectWidget.js"/>\r
-        <source src="../tine20/Calendar/js/ColorManager.js"/>\r
-        <source src="../tine20/Calendar/js/DaysView.js"/>\r
-        <source src="../tine20/Calendar/js/EventEditDialog.js"/> \r
-        <!-- <source src="../tine20/Calendar/js/EventSelectionModel.js"/> \r
-        <source src="../tine20/Calendar/js/EventUI.js"/> \r
-        <source src="../tine20/Calendar/js/MainScreenCenterPanel.js"/> -->\r
-        <source src="../tine20/Calendar/js/Model.js"/>\r
-        <!-- <source src="../tine20/Calendar/js/MonthView.js"/> \r
-        <source src="../tine20/Calendar/js/PagingToolbar.js"/> \r
-        <source src="../tine20/Calendar/js/ParallelEventsRegistry.js"/> \r
-        <source src="../tine20/Calendar/js/RrulePanel.js"/> -->\r
-        <source src="../tine20/Crm/js" match="*.js"/>\r
-        <source src="../tine20/ExampleApplication/js/ExampleRecordGridPanel.js"/>\r
-        <source src="../tine20/ExampleApplication/js/ExampleRecordEditDialog.js"/>\r
-        <source src="../tine20/Felamimail/js" match="*.js"/>\r
-        <source src="../tine20/Sales/js" match="*.js"/>\r
-               <!-- <source src="../tine20/Setup/js" match="*.js"/> -->\r
-        <!-- <source src="../tine20/Tasks/js/EditDialog.js"/> -->\r
-        <source src="../tine20/Tasks/js/GridPanel.js"/>\r
-        <source src="../tine20/Timetracker/js/TimesheetGridPanel.js"/>\r
-        <source src="../tine20/Timetracker/js/TimeaccountGridPanel.js"/>\r
-    </sources>\r
-    <tags>\r
-        <tag name="author" title="Author"/>\r
-        <tag name="copyright" title="Copyright"/>\r
-        <tag name="license" title="License"/>\r
-        <tag name="version" title="Version"/>\r
-        <tag name="note" format="&lt;i&gt;NOTE: {0}&lt;/i&gt;"/>\r
-        <tag name="demo" title="Demo" format="&lt;a href=&quot;{0}&quot;&gt;{0}&lt;/a&gt;" />   \r
-       </tags>\r
-</doc>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<doc>
+    <sources>
+        <!-- <source src="../tine20/library/ExtJS/src" match="*.js"/> -->
+
+        <source src="../tine20/Tinebase/js/" match="*.js"/>
+
+        <source src="../tine20/Addressbook/js/ContactGrid.js"/>
+        <source src="../tine20/Addressbook/js/SearchCombo.js"/>
+        <!-- <source src="../tine20/Admin/js/UserEditDialog.js"/> -->
+        <!-- <source src="../tine20/Calendar/js" match="*.js"/> -->
+        <source src="../tine20/Calendar/js/AttendeeGridPanel.js"/>
+        <source src="../tine20/Calendar/js/Calendar.js"/>
+        <source src="../tine20/Calendar/js/CalendarPanel.js"/>
+        <source src="../tine20/Calendar/js/CalendarSelectWidget.js"/>
+        <source src="../tine20/Calendar/js/ColorManager.js"/>
+        <source src="../tine20/Calendar/js/DaysView.js"/>
+        <source src="../tine20/Calendar/js/EventEditDialog.js"/> 
+        <!-- <source src="../tine20/Calendar/js/EventSelectionModel.js"/> 
+        <source src="../tine20/Calendar/js/EventUI.js"/> 
+        <source src="../tine20/Calendar/js/MainScreenCenterPanel.js"/> -->
+        <source src="../tine20/Calendar/js/Model.js"/>
+        <!-- <source src="../tine20/Calendar/js/MonthView.js"/> 
+        <source src="../tine20/Calendar/js/PagingToolbar.js"/> 
+        <source src="../tine20/Calendar/js/ParallelEventsRegistry.js"/> 
+        <source src="../tine20/Calendar/js/RrulePanel.js"/> -->
+        <source src="../tine20/Crm/js" match="*.js"/>
+        <source src="../tine20/ExampleApplication/js/ExampleRecordGridPanel.js"/>
+        <source src="../tine20/ExampleApplication/js/ExampleRecordEditDialog.js"/>
+        <source src="../tine20/Felamimail/js" match="*.js"/>
+        <source src="../tine20/Sales/js" match="*.js"/>
+        <!-- <source src="../tine20/Setup/js" match="*.js"/> -->
+        <!-- <source src="../tine20/Tasks/js/EditDialog.js"/> -->
+        <source src="../tine20/Tasks/js/GridPanel.js"/>
+        <source src="../tine20/Timetracker/js/TimesheetGridPanel.js"/>
+        <source src="../tine20/Timetracker/js/TimeaccountGridPanel.js"/>
+    </sources>
+    <tags>
+        <tag name="author" title="Author"/>
+        <tag name="copyright" title="Copyright"/>
+        <tag name="license" title="License"/>
+        <tag name="version" title="Version"/>
+        <tag name="note" format="&lt;i&gt;NOTE: {0}&lt;/i&gt;"/>
+        <tag name="demo" title="Demo" format="&lt;a href=&quot;{0}&quot;&gt;{0}&lt;/a&gt;" />   
+    </tags>
+</doc>
index 2f1dd2b..8dc88a7 100644 (file)
@@ -59,6 +59,10 @@ Alias /Microsoft-Server-ActiveSync /usr/share/tine20/Microsoft-Server-ActiveSync
         RewriteRule ^webdav                      index.php?frontend=webdav             [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
         RewriteRule ^principals                  index.php?frontend=webdav             [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
         RewriteRule ^remote.php                  index.php?frontend=webdav             [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
+        
+        # Anonymous downloads
+        RewriteRule ^download/get/(.*)           index.php?method=Download.downloadNode&path=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
+        RewriteRule ^download/show/(.*)          index.php?method=Download.displayNode&path=$1  [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
     </IfModule>
 
     <IfModule mod_expires.c>
index e070a1d..2562380 100644 (file)
@@ -59,6 +59,10 @@ Alias /Microsoft-Server-ActiveSync /usr/share/tine20/Microsoft-Server-ActiveSync
         RewriteRule ^webdav                      index.php?frontend=webdav             [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
         RewriteRule ^principals                  index.php?frontend=webdav             [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
         RewriteRule ^remote.php                  index.php?frontend=webdav             [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
+        
+        # Anonymous downloads
+        RewriteRule ^download/get/(.*)           index.php?method=Download.downloadNode&path=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
+        RewriteRule ^download/show/(.*)          index.php?method=Download.displayNode&path=$1  [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
     </IfModule>
 
     <IfModule mod_expires.c>
index 2fffcde..65626f6 100644 (file)
@@ -59,6 +59,10 @@ Alias /Microsoft-Server-ActiveSync /usr/share/tine20/Microsoft-Server-ActiveSync
         RewriteRule ^webdav                      index.php?frontend=webdav             [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
         RewriteRule ^principals                  index.php?frontend=webdav             [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
         RewriteRule ^remote.php                  index.php?frontend=webdav             [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
+        
+        # Anonymous downloads
+        RewriteRule ^download/get/(.*)           index.php?method=Download.downloadNode&path=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
+        RewriteRule ^download/show/(.*)          index.php?method=Download.displayNode&path=$1  [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
     </IfModule>
 
     <IfModule mod_expires.c>
index 4f8d5c7..0e5ae89 100644 (file)
@@ -508,6 +508,8 @@ Zeile 3</AirSyncBase:Data>
     {
         parent::setUp();
         
+        Calendar_Controller_Event::getInstance()->doContainerACLChecks(true);
+        
         // replace email to make current user organizer and attendee
         $testConfig = Zend_Registry::get('testConfig');
         $email = ($testConfig->email) ? $testConfig->email : Tinebase_Core::getUser()->accountEmailAddress;
index e8b0fe1..02be157 100644 (file)
@@ -4,80 +4,25 @@
  * 
  * @package     Addressbook
  * @license     http://www.gnu.org/licenses/agpl.html
- * @copyright   Copyright (c) 2011-2011 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @copyright   Copyright (c) 2011-2041 Metaways Infosystems GmbH (http://www.metaways.de)
  * @author      Lars Kneschke <l.kneschke@metaways.de>
  */
 
 /**
- * Test helper
- */
-require_once dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'TestHelper.php';
-
-if (!defined('PHPUnit_MAIN_METHOD')) {
-    define('PHPUnit_MAIN_METHOD', 'Addressbook_Frontend_CardDAVTest::main');
-}
-
-/**
  * Test class for Addressbook_Frontend_CardDAV
  */
-class Addressbook_Frontend_CardDAVTest extends PHPUnit_Framework_TestCase
+class Addressbook_Frontend_CardDAVTest extends TestCase
 {
     /**
-     * @var array test objects
-     */
-    protected $objects = array();
-    
-    /**
-     * Runs the test methods of this class.
-     *
-     * @access public
-     * @static
-     */
-    public static function main()
-    {
-        $suite  = new PHPUnit_Framework_TestSuite('Tine 2.0 Addressbook CardDAV Tests');
-        PHPUnit_TextUI_TestRunner::run($suite);
-    }
-
-    /**
-     * Sets up the fixture.
-     * This method is called before a test is executed.
-     *
-     * @access protected
-     */
-    protected function setUp()
-    {
-        Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
-        
-        $this->objects['initialContainer'] = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array(
-            'name'              => Tinebase_Record_Abstract::generateUID(),
-            'type'              => Tinebase_Model_Container::TYPE_PERSONAL,
-            'backend'           => 'Sql',
-            'application_id'    => Tinebase_Application::getInstance()->getApplicationByName('Addressbook')->getId(),
-        )));
-    }
-
-    /**
-     * Tears down the fixture
-     * This method is called after a test is executed.
-     *
-     * @access protected
-     */
-    protected function tearDown()
-    {
-        Tinebase_TransactionManager::getInstance()->rollBack();
-    }
-    
-    /**
      * test getChildren
      */
     public function testGetChildren()
     {
-        $collection = new Addressbook_Frontend_CardDAV();
+        $collection = new Addressbook_Frontend_WebDAV(\Sabre\CardDAV\Plugin::ADDRESSBOOK_ROOT, true);
         
         $children = $collection->getChildren();
         
-        $this->assertTrue($children[0] instanceof Addressbook_Frontend_WebDAV_Container);
+        $this->assertTrue($children[0] instanceof Addressbook_Frontend_WebDAV);
     }
         
     /**
@@ -85,9 +30,9 @@ class Addressbook_Frontend_CardDAVTest extends PHPUnit_Framework_TestCase
      */
     public function testGetChild()
     {
-        $collection = new Addressbook_Frontend_CardDAV();
+        $collection = new Addressbook_Frontend_WebDAV(\Sabre\CardDAV\Plugin::ADDRESSBOOK_ROOT . '/' . Tinebase_Core::getUser()->contact_id, true);
         
-        $child = $collection->getChild($this->objects['initialContainer']->getId());
+        $child = $collection->getChild($this->_getTestContainer()->getId());
         
         $this->assertTrue($child instanceof Addressbook_Frontend_WebDAV_Container);
     }
@@ -97,7 +42,7 @@ class Addressbook_Frontend_CardDAVTest extends PHPUnit_Framework_TestCase
      */
     public function testCreateFile()
     {
-        $collection = new Addressbook_Frontend_CardDAV();
+        $collection = new Addressbook_Frontend_WebDAV(\Sabre\CardDAV\Plugin::ADDRESSBOOK_ROOT . '/' . Tinebase_Core::getUser()->contact_id, true);
         
         $this->setExpectedException('Sabre\DAV\Exception\Forbidden');
         
@@ -111,7 +56,7 @@ class Addressbook_Frontend_CardDAVTest extends PHPUnit_Framework_TestCase
     {
         $randomName = Tinebase_Record_Abstract::generateUID();
         
-        $collection = new Addressbook_Frontend_CardDAV();
+        $collection = new Addressbook_Frontend_WebDAV(\Sabre\CardDAV\Plugin::ADDRESSBOOK_ROOT . '/' . Tinebase_Core::getUser()->contact_id, true);
         
         $collection->createDirectory($randomName);
         
@@ -124,10 +69,10 @@ class Addressbook_Frontend_CardDAVTest extends PHPUnit_Framework_TestCase
     {
         $_SERVER['HTTP_USER_AGENT'] = 'Mac OS X/10.9 (13A603) AddressBook/1365';
     
-        $collection = new Addressbook_Frontend_CardDAV();
+        $collection = new Addressbook_Frontend_WebDAV(\Sabre\CardDAV\Plugin::ADDRESSBOOK_ROOT . '/' . Tinebase_Core::getUser()->contact_id, true);
     
         $children = $collection->getChildren();
-    
+        
         $this->assertCount(1, $children, 'there should be just one global container');
         $this->assertTrue($children[0] instanceof Addressbook_Frontend_CardDAV_AllContacts, 'wrong instance');
     }
@@ -136,10 +81,27 @@ class Addressbook_Frontend_CardDAVTest extends PHPUnit_Framework_TestCase
     {
         $_SERVER['HTTP_USER_AGENT'] = 'FooBar User Agent';
     
-        $collection = new Addressbook_Frontend_CardDAV();
+        $collection = new Addressbook_Frontend_WebDAV(\Sabre\CardDAV\Plugin::ADDRESSBOOK_ROOT, true);
     
         $children = $collection->getChildren();
     
         $this->assertGreaterThanOrEqual(2, count($children), 'there should be more than one container');
     }
+    
+    /**
+     * create test container
+     * 
+     * @return Tinebase_Model_Container
+     */
+    protected function _getTestContainer()
+    {
+        $container = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array(
+            'name'              => Tinebase_Record_Abstract::generateUID(),
+            'type'              => Tinebase_Model_Container::TYPE_PERSONAL,
+            'backend'           => 'Sql',
+            'application_id'    => Tinebase_Application::getInstance()->getApplicationByName('Addressbook')->getId(),
+        )));
+        
+        return $container;
+    }
 }
index 4df6319..5fba8bf 100644 (file)
@@ -40,6 +40,7 @@ class AllTests
         $suite->addTest(Projects_AllTests::suite());
         $suite->addTest(HumanResources_AllTests::suite());
         $suite->addTest(Inventory_AllTests::suite());
+        $suite->addTest(ExampleApplication_AllTests::suite());
         $suite->addTest(Sipgate_AllTests::suite());
         $suite->addTest(SimpleFAQ_AllTests::suite());
         $suite->addTest(Zend_AllTests::suite());
index 1646549..5880f87 100644 (file)
@@ -40,6 +40,7 @@ class Calendar_AllTests
         $suite->addTestSuite('Calendar_Controller_MSEventFacadeTest');
         $suite->addTestSuite('Calendar_JsonTests');
         $suite->addTestSuite('Calendar_Import_ICalTest');
+        $suite->addTestSuite('Calendar_Import_CalDAVTest');
         $suite->addTestSuite('Calendar_Export_ICalTest');
         $suite->addTestSuite('Calendar_Convert_Event_VCalendar_AllTests');
         $suite->addTestSuite('Calendar_Setup_DemoDataTests');
index 7884d66..f4d4eef 100644 (file)
@@ -102,7 +102,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'dtend'        => '2009-04-02 23:59:59',
                 'summary'      => 'non recur event ending before search period => should _not_ be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 Tinebase_Model_Grants::GRANT_READ    => true
@@ -112,7 +112,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'dtend'        => '2009-04-03 00:30:00',
                 'summary'      => 'non recur event ending within search period => should be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 Tinebase_Model_Grants::GRANT_READ    => true
@@ -122,7 +122,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'dtend'        => '2009-04-07 12:00:00',
                 'summary'      => 'non recur event completly within search period => should be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 Tinebase_Model_Grants::GRANT_READ    => true
@@ -132,7 +132,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'dtend'        => '2009-04-11 00:30:00',
                 'summary'      => 'non recur event starting within search period => should be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 Tinebase_Model_Grants::GRANT_READ    => true
@@ -142,7 +142,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'dtend'        => '2009-04-11 02:00:00',
                 'summary'      => 'non recur event starting after search period => should _not_ be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 Tinebase_Model_Grants::GRANT_READ    => true
@@ -153,7 +153,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'rrule'        => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-02 23:59:59',
                 'summary'      => 'recur event ending before search period => should _not_ be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 'rrule_until'  => '2009-04-02 23:59:59',
@@ -165,7 +165,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'rrule'        => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-05 23:59:59',
                 'summary'      => 'recur event ending within search period => should be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 'rrule_until'  => '2009-04-05 23:59:59',
@@ -177,7 +177,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'rrule'        => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-06 23:59:59',
                 'summary'      => 'recur event completly within search period => should be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 'rrule_until'  => '2009-04-06 23:59:59',
@@ -189,7 +189,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'rrule'        => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-12 23:59:59',
                 'summary'      => 'recur event starting within search period => should be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 'rrule_until'  => '2009-04-12 23:59:59',
@@ -201,7 +201,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
                 'rrule'        => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-15 02:00:00',
                 'summary'      => 'recur event starting after search period => should _not_ be found',
                 'attendee'     => $this->_getAttendee(),
-                'container_id' => $this->_testCalendar->getId(),
+                'container_id' => $this->_getTestCalendar()->getId(),
                 'organizer'    => Tinebase_Core::getUser()->getId(),
                 'uid'          => Calendar_Model_Event::generateUID(),
                 'rrule_until'  => '2009-04-15 02:00:00',
@@ -218,7 +218,7 @@ class Calendar_Backend_SqlTest extends Calendar_TestCase
         }
         
         $filter = new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'period'      , 'operator' => 'within', 'value' => array(
                 'from'  => $from,
                 'until' => $until
index 8527c2f..0bb4061 100644 (file)
@@ -45,6 +45,7 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
         $this->_setupTestCalendars();
         
         $this->_uit = Calendar_Controller_Event::getInstance();
+        $this->_uit->doContainerACLChecks(true);
     }
     
     public function tearDown()
@@ -61,7 +62,7 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
      */
     public function testAddPersonalCalendarGrants()
     {
-        $grants = Tinebase_Container::getInstance()->getGrantsOfContainer($this->_testCalendar->getId(), TRUE);
+        $grants = Tinebase_Container::getInstance()->getGrantsOfContainer($this->_getTestCalendar()->getId(), TRUE);
         $anyoneIdx = array_search(Tinebase_Acl_Rights::ACCOUNT_TYPE_ANYONE, $grants->account_type);
         $this->assertTrue($anyoneIdx !== false, 'anyone has no grant entry');
         $this->assertTrue($grants[$anyoneIdx]->{Tinebase_Model_Grants::GRANT_FREEBUSY}, 'anyone has not freebusy grant');
@@ -185,7 +186,7 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
         $persistentEvent = $this->_createEventInPersonasCalendar('rwright', 'rwright', 'sclever');
         
         $loadedEvent = $this->_uit->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => "/personal/{$this->_personas['sclever']->getId()}"),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => "/personal/{$this->_getPersona('sclever')->getId()}"),
             array('field' => 'id', 'operator' => 'equals', 'value' => $persistentEvent->getId())
         )))->getFirstRecord();
         
@@ -341,8 +342,8 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
     public function testFreeBusyViaAttendee()
     {
         // whipe grants from jmcblack
-        Tinebase_Container::getInstance()->setGrants($this->_personasDefaultCals['jmcblack'], new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-            'account_id'    => $this->_personas['jmcblack']->getId(),
+        Tinebase_Container::getInstance()->setGrants($this->_getPersonasDefaultCals('jmcblack'), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
+            'account_id'    => $this->_getPersona('jmcblack')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -362,7 +363,7 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
                         array('field' => 'id', 'operator' => 'equals', 'value' => $persistentEvent->getId()),
                         array('field' => 'attender', 'operator' => 'in', 'value' => array(array(
                             'user_type' => 'user',
-                            'user_id'   => $this->_personas['rwright']->contact_id,
+                            'user_id'   => $this->_getPersona('rwright')->contact_id,
                         ))),
                     )
                 )
@@ -386,7 +387,7 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
 //            array('field' => 'attender', 'operator' => 'in', 'value' => array(
 //                array(
 //                    'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-//                    'user_id'   => $this->_personasContacts['rwright']->getId()
+//                    'user_id'   => $this->_getPersonasContacts('rwright')->getId()
 //                )
 //            ))
 //        )), NULL, FALSE, FALSE);
@@ -425,7 +426,7 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
         $persistentEvent = $this->_createEventInPersonasCalendar('rwright', 'rwright');
         
         // for shure, this is esoteric, but it enshures that record GRANTS are in charge
-        Tinebase_Container::getInstance()->setGrants($this->_testCalendar, new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
+        Tinebase_Container::getInstance()->setGrants($this->_getTestCalendar(), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
             'account_id'    => Tinebase_Core::getUser()->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_FREEBUSY => FALSE,
@@ -470,8 +471,8 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
         $this->markTestIncomplete('temporarily disabled until fixed');
         
         // set testuser to have editgrant for sclever
-        Tinebase_Container::getInstance()->setGrants($this->_personasDefaultCals['sclever'], new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-            'account_id'    => $this->_personas['sclever']->getId(),
+        Tinebase_Container::getInstance()->setGrants($this->_getPersonasDefaultCals('sclever'), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
+            'account_id'    => $this->_getPersona('sclever')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -514,9 +515,9 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
     
     protected function _createEventInPersonasCalendar($_calendarPersona, $_organizerPersona = NULL, $_attenderPersona = NULL, $_classification = Calendar_Model_Event::CLASS_PUBLIC)
     {
-        $calendarId  = $this->_personasDefaultCals[$_calendarPersona]->getId();
-        $organizerId = $_organizerPersona ? $this->_personasContacts[$_organizerPersona]->getId() : $this->_testUserContact->getId();
-        $attenderId  = $_attenderPersona ? $this->_personasContacts[$_attenderPersona]->getId() : $this->_testUserContact->getId();
+        $calendarId  = $this->_getPersonasDefaultCals($_calendarPersona)->getId();
+        $organizerId = $_organizerPersona ? $this->_getPersonasContacts($_organizerPersona)->getId() : $this->_getTestUserContact()->getId();
+        $attenderId  = $_attenderPersona ? $this->_getPersonasContacts($_attenderPersona)->getId() : $this->_getTestUserContact()->getId();
         
         $event = $this->_getEvent();
         $event->class = $_classification;
@@ -549,8 +550,8 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
     protected function _setupTestCalendars()
     {
         // jsmith:     anyone freebusyGrant, readGrant, addGrant, editGrant, deleteGrant
-        Tinebase_Container::getInstance()->setGrants($this->_personasDefaultCals['jsmith'], new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-            'account_id'    => $this->_personas['jsmith']->getId(),
+        Tinebase_Container::getInstance()->setGrants($this->_getPersonasDefaultCals('jsmith'), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
+            'account_id'    => $this->_getPersona('jsmith')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -571,8 +572,8 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
         ))), true);
         
         // pwulf:      anyone readGrant, sclever addGrant, readGrant, editGrant, deleteGrant, privateGrant
-        Tinebase_Container::getInstance()->setGrants($this->_personasDefaultCals['pwulf'], new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-            'account_id'    => $this->_personas['pwulf']->getId(),
+        Tinebase_Container::getInstance()->setGrants($this->_getPersonasDefaultCals('pwulf'), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
+            'account_id'    => $this->_getPersona('pwulf')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -590,7 +591,7 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
             Tinebase_Model_Grants::GRANT_DELETE   => false,
             Tinebase_Model_Grants::GRANT_ADMIN    => false,
         ), array(
-            'account_id'    => $this->_personas['sclever']->getId(),
+            'account_id'    => $this->_getPersona('sclever')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -601,8 +602,8 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
         ))), true);
         
         // sclever:   testuser addGrant, readGrant, editGrant, deleteGrant, privateGrant
-        Tinebase_Container::getInstance()->setGrants($this->_personasDefaultCals['sclever'], new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-            'account_id'    => $this->_personas['sclever']->getId(),
+        Tinebase_Container::getInstance()->setGrants($this->_getPersonasDefaultCals('sclever'), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
+            'account_id'    => $this->_getPersona('sclever')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -623,8 +624,8 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
         ))), true);
         
         // jmacblack: prim group of testuser readGrant, testuser privateGrant
-        Tinebase_Container::getInstance()->setGrants($this->_personasDefaultCals['jmcblack'], new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-            'account_id'    => $this->_personas['jmcblack']->getId(),
+        Tinebase_Container::getInstance()->setGrants($this->_getPersonasDefaultCals('jmcblack'), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
+            'account_id'    => $this->_getPersona('jmcblack')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -653,8 +654,8 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
         ))), true);
         
         // rwright:   testuser freebusyGrant, sclever has readGrant and editGrant
-        Tinebase_Container::getInstance()->setGrants($this->_personasDefaultCals['rwright'], new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-            'account_id'    => $this->_personas['rwright']->getId(),
+        Tinebase_Container::getInstance()->setGrants($this->_getPersonasDefaultCals('rwright'), new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
+            'account_id'    => $this->_getPersona('rwright')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => true,
@@ -674,7 +675,7 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
             Tinebase_Model_Grants::GRANT_ADMIN    => false,
             Tinebase_Model_Grants::GRANT_FREEBUSY => true,
         ), array(
-            'account_id'    => $this->_personas['sclever']->getId(),
+            'account_id'    => $this->_getPersona('sclever')->getId(),
             'account_type'  => 'user',
             Tinebase_Model_Grants::GRANT_READ     => true,
             Tinebase_Model_Grants::GRANT_ADD      => false,
@@ -689,9 +690,9 @@ class Calendar_Controller_EventGrantsTests extends Calendar_TestCase
      */
     protected function cleanupTestCalendars()
     {
-        foreach ($this->_personasDefaultCals as $loginName => $calendar) {
+        foreach ($this->_getAllPersonasDefaultCals() as $loginName => $calendar) {
             Tinebase_Container::getInstance()->setGrants($calendar, new Tinebase_Record_RecordSet('Tinebase_Model_Grants', array(array(
-                'account_id'    => $this->_personas[$loginName]->getId(),
+                'account_id'    => $this->_getPersona($loginName)->getId(),
                 'account_type'  => 'user',
                 Tinebase_Model_Grants::GRANT_READ     => true,
                 Tinebase_Model_Grants::GRANT_ADD      => true,
index 28ca194..65d825b 100644 (file)
@@ -25,11 +25,6 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
      */
     protected $_notificationController;
     
-    /**
-     * @var Tinebase_Model_Container
-     */
-    protected $_testCalendar;
-    
    /**
     * email test class
     *
@@ -158,11 +153,11 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
         
         $persistentEvent->attendee->merge($this->_getPersonaAttendee('jsmith, sclever'));
         $persistentEvent->attendee->removeRecord(
-            $persistentEvent->attendee->find('user_id', $this->_personasContacts['pwulf']->getId())
+            $persistentEvent->attendee->find('user_id', $this->_getPersonasContacts('pwulf')->getId())
         );
-        $persistentEvent->attendee->find('user_id', $this->_personasContacts['rwright']->getId())->status =
+        $persistentEvent->attendee->find('user_id', $this->_getPersonasContacts('rwright')->getId())->status =
             Calendar_Model_Attender::STATUS_ACCEPTED;
-        $persistentEvent->attendee->find('user_id', $this->_personasContacts['jmcblack']->getId())->status =
+        $persistentEvent->attendee->find('user_id', $this->_getPersonasContacts('jmcblack')->getId())->status =
             Calendar_Model_Attender::STATUS_DECLINED;
             
         self::flushMailer();
@@ -235,7 +230,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent();
         $event->attendee = $this->_getPersonaAttendee('jsmith, pwulf');
-        $event->organizer = $this->_personasContacts['jsmith']->getId();
+        $event->organizer = $this->_getPersonasContacts('jsmith')->getId();
         $persistentEvent = $this->_eventController->create($event);
         
         $persistentEvent->attendee[1]->status = Calendar_Model_Attender::STATUS_DECLINED;
@@ -252,7 +247,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent(TRUE);
         $event->attendee = $this->_getPersonaAttendee('jsmith, pwulf');
-        $event->organizer = $this->_personasContacts['pwulf']->getId();
+        $event->organizer = $this->_getPersonasContacts('pwulf')->getId();
         $persistentEvent = $this->_eventController->create($event);
         
         $persistentEvent->attendee[1]->status = Calendar_Model_Attender::STATUS_DECLINED;
@@ -270,7 +265,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent(TRUE);
         $event->attendee = $this->_getPersonaAttendee('pwulf');
-        $event->organizer = $this->_personasContacts['pwulf']->getId();
+        $event->organizer = $this->_getPersonasContacts('pwulf')->getId();
         
         // add nonaccount attender
         $nonAccountEmail = 'externer@example.org';
@@ -320,7 +315,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
                 'dtstart'       => '2012-03-14 09:00:00',
                 'dtend'         => '2012-03-14 10:00:00',
                 'rrule'         => 'FREQ=DAILY;INTERVAL=1',
-                'container_id'  => $this->_testCalendar->getId(),
+                'container_id'  => $this->_getTestCalendar()->getId(),
                 'attendee'      => $this->_getPersonaAttendee('jmcblack'),
         ));
         
@@ -375,7 +370,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent();
         $event->attendee = $this->_getPersonaAttendee('sclever, pwulf');
-        $event->organizer = $this->_personasContacts['sclever']->getId();
+        $event->organizer = $this->_getPersonasContacts('sclever')->getId();
         
         $event->dtstart = Tinebase_DateTime::now()->addMinute(25);
         $event->dtend = clone $event->dtstart;
@@ -390,7 +385,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
         $event->alarms->setOption('skip', array(
             array(
                 'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-                'user_id'   => $this->_personasContacts['pwulf']->getId(),
+                'user_id'   => $this->_getPersonasContacts('pwulf')->getId(),
             )
         ));
         
@@ -407,7 +402,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent();
         $event->attendee = $this->_getPersonaAttendee('sclever, pwulf');
-        $event->organizer = $this->_personasContacts['sclever']->getId();
+        $event->organizer = $this->_getPersonasContacts('sclever')->getId();
         
         $event->dtstart = Tinebase_DateTime::now()->addMinute(25);
         $event->dtend = clone $event->dtstart;
@@ -419,7 +414,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
         ));
         $event->alarms->setOption('attendee', array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['pwulf']->getId()
+            'user_id'   => $this->_getPersonasContacts('pwulf')->getId()
         ));
         
         Tinebase_Alarm::getInstance()->sendPendingAlarms("Tinebase_Event_Async_Minutely");
@@ -551,7 +546,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent();
         $event->attendee = $this->_getPersonaAttendee('pwulf');
-        $event->organizer = $this->_personasContacts['pwulf']->getId();
+        $event->organizer = $this->_getPersonasContacts('pwulf')->getId();
         
         // lets flush mailer so next flushing ist faster!
         Tinebase_Alarm::getInstance()->sendPendingAlarms("Tinebase_Event_Async_Minutely");
@@ -601,7 +596,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent();
         $event->attendee = $this->_getPersonaAttendee('pwulf');
-        $event->organizer = $this->_personasContacts['pwulf']->getId();
+        $event->organizer = $this->_getPersonasContacts('pwulf')->getId();
         
         $event->dtstart = Tinebase_DateTime::now()->subDay(1)->addMinute(15);
         $event->dtend = clone $event->dtstart;
@@ -653,7 +648,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent();
         $event->attendee = $this->_getPersonaAttendee('pwulf');
-        $event->organizer = $this->_personasContacts['pwulf']->getId();
+        $event->organizer = $this->_getPersonasContacts('pwulf')->getId();
         
         $event->dtstart = Tinebase_DateTime::now()->addWeek(1)->addMinute(15);
         $event->dtend = clone $event->dtstart;
@@ -725,7 +720,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
             'summary'      => 'Cleanup',
             'dtstart'      => '2012-01-31 07:30:00',
             'dtend'        => '2012-01-31 10:30:00',
-            'container_id' => $this->_testCalendar->getId(),
+            'container_id' => $this->_getTestCalendar()->getId(),
             'uid'          => Calendar_Model_Event::generateUID(),
             'rrule'        => 'FREQ=WEEKLY;INTERVAL=1;WKST=MO;BYDAY=TU',
             'originator_tz'=> 'Europe/Berlin',
@@ -747,7 +742,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $event = $this->_getEvent();
         $event->attendee = $this->_getPersonaAttendee('sclever, pwulf');
-        $event->organizer = $this->_personasContacts['sclever']->getId();
+        $event->organizer = $this->_getPersonasContacts('sclever')->getId();
         
         $event->dtstart = Tinebase_DateTime::now()->addMinute(25);
         $event->dtend = clone $event->dtstart;
@@ -1031,7 +1026,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
         self::flushMailer();
         $vcalendar = Calendar_Frontend_WebDAV_EventTest::getVCalendar(dirname(__FILE__) . '/../Import/files/apple_ical_remind_part1.ics');
         $id = Tinebase_Record_Abstract::generateUID();
-        $event = Calendar_Frontend_WebDAV_Event::create($this->_testCalendar, "$id.ics", $vcalendar);
+        $event = Calendar_Frontend_WebDAV_Event::create($this->_getTestCalendar(), "$id.ics", $vcalendar);
         
         return $event;
     }
@@ -1132,7 +1127,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
             $otherRecipients = array();
             $personaEmail = strstr($personaName, '@') ? 
                 $personaName : 
-                $this->_personas[trim($personaName)]->accountEmailAddress;
+                $this->_getPersona(trim($personaName))->accountEmailAddress;
             
             foreach ($messages as $message) {
                 if (array_value(0, $message->getRecipients()) == $personaEmail) {
@@ -1193,7 +1188,7 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender');
         foreach (explode(',', $_personas) as $personaName) {
-            $attendee->addRecord($this->_createAttender($this->_personasContacts[trim($personaName)]->getId()));
+            $attendee->addRecord($this->_createAttender($this->_getPersonasContacts(trim($personaName))->getId()));
         }
         
         return $attendee;
@@ -1217,32 +1212,32 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
         $calPreferences->setValueForUser(
             Calendar_Preference::NOTIFICATION_LEVEL, 
             Calendar_Controller_EventNotifications::NOTIFICATION_LEVEL_NONE,
-            $this->_personas['jsmith']->getId(), TRUE
+            $this->_getPersona('jsmith')->getId(), TRUE
         );
         $calPreferences->setValueForUser(
             Calendar_Preference::NOTIFICATION_LEVEL, 
             Calendar_Controller_EventNotifications::NOTIFICATION_LEVEL_INVITE_CANCEL,
-            $this->_personas['pwulf']->getId(), TRUE
+            $this->_getPersona('pwulf')->getId(), TRUE
         );
         $calPreferences->setValueForUser(
             Calendar_Preference::NOTIFICATION_LEVEL, 
             Calendar_Controller_EventNotifications::NOTIFICATION_LEVEL_EVENT_RESCHEDULE,
-            $this->_personas['sclever']->getId(), TRUE
+            $this->_getPersona('sclever')->getId(), TRUE
         );
         $calPreferences->setValueForUser(
             Calendar_Preference::NOTIFICATION_LEVEL, 
             Calendar_Controller_EventNotifications::NOTIFICATION_LEVEL_EVENT_UPDATE,
-            $this->_personas['jmcblack']->getId(), TRUE
+            $this->_getPersona('jmcblack')->getId(), TRUE
         );
         $calPreferences->setValueForUser(
             Calendar_Preference::NOTIFICATION_LEVEL, 
             Calendar_Controller_EventNotifications::NOTIFICATION_LEVEL_ATTENDEE_STATUS_UPDATE,
-            $this->_personas['rwright']->getId(), TRUE
+            $this->_getPersona('rwright')->getId(), TRUE
         );
         
         // set all languages to en
         $preferences = Tinebase_Core::getPreference('Tinebase');
-        foreach ($this->_personas as $name => $account) {
+        foreach ($this->_getPersonas() as $name => $account) {
             $preferences->setValueForUser(Tinebase_Preference::LOCALE, 'en', $account->getId(), TRUE);
         }
     }
index 70797df..dd24be1 100644 (file)
@@ -26,11 +26,6 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
     protected $_controller;
     
     /**
-     * @var Tinebase_Model_Container
-     */
-    protected $_testCalendar;
-    
-    /**
      * (non-PHPdoc)
      * @see Calendar_TestCase::setUp()
      */
@@ -150,7 +145,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $event->attendee = $this->_getAttendee();
         $event->attendee[1] = new Calendar_Model_Attender(array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['pwulf']->getId(),
+            'user_id'   => $this->_getPersonasContacts('pwulf')->getId(),
         ));
         
         $persistentEvent = $this->_controller->create($event);
@@ -178,7 +173,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
             
         $pwulf = $updatedEvent->attendee
             ->filter('user_type', Calendar_Model_Attender::USERTYPE_USER)
-            ->filter('user_id', $this->_personasContacts['pwulf']->getId())
+            ->filter('user_id', $this->_getPersonasContacts('pwulf')->getId())
             ->getFirstRecord();
 
         $this->assertEquals(Calendar_Model_Attender::STATUS_DECLINED, $currentUser->status, 'current users status must not be touched');
@@ -209,7 +204,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $event->attendee = $this->_getAttendee();
         $event->attendee[1] = new Calendar_Model_Attender(array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['pwulf']->getId()
+            'user_id'   => $this->_getPersonasContacts('pwulf')->getId()
         ));
         
         $persistendEvent = $this->_controller->create($event);
@@ -233,30 +228,30 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $event1 = $this->_getEvent();
         $event1->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
             array('user_id' => Tinebase_Core::getUser()->contact_id),
-            array('user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         $persistentEvent1 = $this->_controller->create($event1);
         
         $event2 = $this->_getEvent();
         $event2->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
             array('user_id' => Tinebase_Core::getUser()->contact_id),
-            array('user_id' => $this->_personasContacts['sclever']->getId()),
+            array('user_id' => $this->_getPersonasContacts('sclever')->getId()),
         ));
         $persistentEvent2 = $this->_controller->create($event2);
         
         $event3 = $this->_getEvent();
         $event3->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
             array('user_id' => Tinebase_Core::getUser()->contact_id),
-            array('user_id' => $this->_personasContacts['sclever']->getId()),
+            array('user_id' => $this->_getPersonasContacts('sclever')->getId()),
         ));
         $persistentEvent3 = $this->_controller->create($event3);
         
         // test sclever
         $filter = new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'attender'    , 'operator' => 'equals', 'value' => array(
                 'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-                'user_id'   => $this->_personasContacts['sclever']->getId()
+                'user_id'   => $this->_getPersonasContacts('sclever')->getId()
             )),
         ));
         $eventsFound = $this->_controller->search($filter, new Tinebase_Model_Pagination());
@@ -264,10 +259,10 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         
         // test pwulf
         $filter = new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'attender'    , 'operator' => 'equals', 'value' => array(
                 'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-                'user_id'   => $this->_personasContacts['pwulf']->getId()
+                'user_id'   => $this->_getPersonasContacts('pwulf')->getId()
             )),
         ));
         $eventsFound = $this->_controller->search($filter, new Tinebase_Model_Pagination());
@@ -275,15 +270,15 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         
         // test sclever OR pwulf
         $filter = new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'attender'    , 'operator' => 'in',     'value' => array(
                 array(
                     'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-                    'user_id'   => $this->_personasContacts['sclever']->getId()
+                    'user_id'   => $this->_getPersonasContacts('sclever')->getId()
                 ),
                 array (
                     'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-                    'user_id'   => $this->_personasContacts['pwulf']->getId()
+                    'user_id'   => $this->_getPersonasContacts('pwulf')->getId()
                 )
             )),
         ));
@@ -296,16 +291,16 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $event = $this->_getEvent();
         $event->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
             array('user_id' => Tinebase_Core::getUser()->contact_id),
-            array('user_id' => $this->_personasContacts['sclever']->getId())
+            array('user_id' => $this->_getPersonasContacts('sclever')->getId())
         ));
         $persistentEvent = $this->_controller->create($event);
         
         $filter = new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'attender'    , 'operator' => 'in',     'value' => array(
                 array(
                     'user_type' => Calendar_Model_AttenderFilter::USERTYPE_MEMBEROF,
-                    'user_id'   => $this->_personas['sclever']->accountPrimaryGroup
+                    'user_id'   => $this->_getPersona('sclever')->accountPrimaryGroup
                 )
             )),
         ));
@@ -317,8 +312,8 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
     {
         $event = $this->_getEvent();
         $event->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         $persistentEvent = $this->_controller->create($event);
         
@@ -347,7 +342,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
             'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId()
         ), true));
         
-        $this->_testCalendars->addRecord($testCal);
+        $this->_getTestCalendars()->addRecord($testCal);
         
         // create event in testcal
         $event = $this->_getEvent();
@@ -362,7 +357,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $events = $this->_controller->search(new Calendar_Model_EventFilter(array(
             array('field' => 'attender', 'operator' => 'equals', 'value' => array(
                 'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-                'user_id'   => $this->_testUserContact->getId()
+                'user_id'   => $this->_getTestUserContact()->getId()
             ))
         )), NULL, FALSE, FALSE);
         
@@ -375,15 +370,15 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         
         $event = $this->_getEvent();
         $event->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         $persistentEvent = $this->_controller->create($event);
         
         $conflictEvent = $this->_getEvent();
         $conflictEvent->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         
         try {
@@ -410,8 +405,8 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         
         $conflictEvent = $this->_getEvent();
         $conflictEvent->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         
         try {
@@ -435,8 +430,8 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $nonConflictEvent = $this->_getEvent();
         $nonConflictEvent->transp = Calendar_Model_Event::TRANSP_TRANSP;
         $nonConflictEvent->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         
         $this->_controller->create($nonConflictEvent, TRUE);
@@ -451,8 +446,8 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         
         $nonConflictEvent = $this->_getEvent();
         $nonConflictEvent->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         
         $this->_controller->create($nonConflictEvent, TRUE);
@@ -648,10 +643,10 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         // assert test condition
         $pwulf = $persistentEvent->attendee
             ->filter('user_type', Calendar_Model_Attender::USERTYPE_GROUPMEMBER)
-            ->filter('user_id', $this->_personasContacts['pwulf']->getId());
+            ->filter('user_id', $this->_getPersonasContacts('pwulf')->getId());
         $this->assertEquals(0, count($pwulf), 'invalid test condition, pwulf should not be member or admin group');
         
-        Admin_Controller_Group::getInstance()->addGroupMember($defaultAdminGroup->getId(), $this->_personasContacts['pwulf']->account_id);
+        Admin_Controller_Group::getInstance()->addGroupMember($defaultAdminGroup->getId(), $this->_getPersonasContacts('pwulf')->account_id);
         if (isset(Tinebase_Core::getConfig()->actionqueue)) {
             Tinebase_ActionQueue::getInstance()->processQueue(10000);
         }
@@ -660,11 +655,11 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         // assert pwulf is in
         $pwulf = $loadedEvent->attendee
             ->filter('user_type', Calendar_Model_Attender::USERTYPE_GROUPMEMBER)
-            ->filter('user_id', $this->_personasContacts['pwulf']->getId());
+            ->filter('user_id', $this->_getPersonasContacts('pwulf')->getId());
         $this->assertEquals(1, count($pwulf), 'pwulf is not attender of event, but should be');
         
         
-        Admin_Controller_Group::getInstance()->removeGroupMember($defaultAdminGroup->getId(), $this->_personasContacts['pwulf']->account_id);
+        Admin_Controller_Group::getInstance()->removeGroupMember($defaultAdminGroup->getId(), $this->_getPersonasContacts('pwulf')->account_id);
         if (isset(Tinebase_Core::getConfig()->actionqueue)) {
             Tinebase_ActionQueue::getInstance()->processQueue(10000);
         }
@@ -673,7 +668,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         // assert pwulf is missing
         $pwulf = $loadedEvent->attendee
             ->filter('user_type', Calendar_Model_Attender::USERTYPE_GROUPMEMBER)
-            ->filter('user_id', $this->_personasContacts['pwulf']->getId());
+            ->filter('user_id', $this->_getPersonasContacts('pwulf')->getId());
         $this->assertEquals(0, count($pwulf), 'pwulf is attender of event, but not should be');
         
         // Test the same with update
@@ -688,7 +683,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $loadedEvent = $this->_controller->get($persistentEvent->getId());
         $pwulf = $loadedEvent->attendee
             ->filter('user_type', Calendar_Model_Attender::USERTYPE_GROUPMEMBER)
-            ->filter('user_id', $this->_personasContacts['pwulf']->getId());
+            ->filter('user_id', $this->_getPersonasContacts('pwulf')->getId());
         $this->assertEquals(1, count($pwulf), 'pwulf is not attender of event, but should be (via update)');
         
         $group->members = array_diff(Admin_Controller_Group::getInstance()->getGroupMembers($defaultAdminGroup->getId()), array(array_value('pwulf', Zend_Registry::get('personas'))->getId()));
@@ -700,7 +695,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $loadedEvent = $this->_controller->get($persistentEvent->getId());
         $pwulf = $loadedEvent->attendee
             ->filter('user_type', Calendar_Model_Attender::USERTYPE_GROUPMEMBER)
-            ->filter('user_id', $this->_personasContacts['pwulf']->getId());
+            ->filter('user_id', $this->_getPersonasContacts('pwulf')->getId());
         $this->assertEquals(0, count($pwulf), 'pwulf is attender of event, but not should be');
     }
     
@@ -814,7 +809,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         }
         
         $events = $this->_backend->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_testCalendars->getId()),
+            array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_getTestCalendars()->getId()),
         )), new Tinebase_Model_Pagination(array()));
         
         $oldSeries = $events->filter('rrule_until', '/.+/', TRUE)->getFirstRecord();
@@ -839,7 +834,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         }
         
         $events = $this->_backend->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_testCalendars->getId()),
+            array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_getTestCalendars()->getId()),
         )), new Tinebase_Model_Pagination(array()));
         
         $newSeries = $events->filter('rrule_until', '/^$/', TRUE)->getFirstRecord();
@@ -918,7 +913,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-02 21:59:59',
             'exdate'        => '2009-03-27 18:00:00,2009-03-31 17:00:00',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT     => true,
         ));
         
@@ -997,7 +992,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         
         $this->_controller->delete($persistentEvent->getId());
         
-        $contentSeq = Tinebase_Container::getInstance()->getContentSequence($this->_testCalendar);
+        $contentSeq = Tinebase_Container::getInstance()->getContentSequence($this->_getTestCalendar());
         $this->assertEquals(2, $contentSeq, 'container content seq should be increased 2 times!');
         
         $this->setExpectedException('Tinebase_Exception_NotFound');
@@ -1251,7 +1246,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
         $persistentEvent = $this->testCreateEvent();
         
         $events = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'period', 'operator' => 'within', 'value' => array(
                 'from'  => '2009-04-07',
                 'until' => '2010-04-07'
@@ -1274,7 +1269,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
             'dtend'       => '2009-04-06 13:30:00',
             'description' => 'Wieslaw Brudzinski: Das Gesetz garantiert zwar die Mittagspause, aber nicht das Mittagessen...',
         
-            'container_id' => $this->_testCalendar->getId(),
+            'container_id' => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT    => true,
         ));
         
@@ -1341,7 +1336,7 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
             'dtend'       => '2014-04-06 19:00:00',
             'description' => 'Guten Appetit',
             
-            'container_id' => $this->_testCalendar->getId(),
+            'container_id' => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT    => true,
             'customfields' => array('unittest' => 'Hello')
         ));
index 82323d5..52639fb 100644 (file)
@@ -24,6 +24,8 @@ class Calendar_Controller_MSEventFacadeTest extends Calendar_TestCase
     {
         parent::setUp();
         
+        Calendar_Controller_Event::getInstance()->doContainerACLChecks(true);
+        
         $this->_uit = Calendar_Controller_MSEventFacade::getInstance();
         $this->_uit->setEventFilter(new Calendar_Model_EventFilter(array(
             array('field' => 'attender', 'operator' => 'equals', 'value' => array(
@@ -53,22 +55,22 @@ class Calendar_Controller_MSEventFacadeTest extends Calendar_TestCase
         ), TRUE);
         $event->alarms[0]->setOption('skip', array(array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_testUserContact->getId(),
+            'user_id'   => $this->_getTestUserContact()->getId(),
             'organizer' => Tinebase_Core::getUser()->contact_id
         )));
         $event->alarms[1]->setOption('attendee', array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_testUserContact->getId(),
+            'user_id'   => $this->_getTestUserContact()->getId(),
             'organizer' => Tinebase_Core::getUser()->contact_id
         ));
         $event->alarms[2]->setOption('skip', array(array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['sclever']->getId(),
+            'user_id'   => $this->_getPersonasContacts('sclever')->getId(),
             'organizer' => Tinebase_Core::getUser()->contact_id
         )));
         $event->alarms[3]->setOption('attendee', array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['sclever']->getId(),
+            'user_id'   => $this->_getPersonasContacts('sclever')->getId(),
             'organizer' => Tinebase_Core::getUser()->contact_id
         ));
         
@@ -125,7 +127,7 @@ class Calendar_Controller_MSEventFacadeTest extends Calendar_TestCase
         $this->testCreate();
         
         $events = $this->_uit->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_testCalendars->getId()),
+            array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_getTestCalendars()->getId()),
         )));
         
         $this->assertEquals(1, $events->count());
@@ -141,7 +143,7 @@ class Calendar_Controller_MSEventFacadeTest extends Calendar_TestCase
         $cbe->delete($event->getId());
         
         $events = $this->_uit->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_testCalendars->getId()),
+            array('field' => 'container_id', 'operator' => 'in', 'value' => $this->_getTestCalendars()->getId()),
         )));
         
         $this->assertEquals(1, $events->count());
@@ -167,7 +169,7 @@ class Calendar_Controller_MSEventFacadeTest extends Calendar_TestCase
         $this->_assertTestEvent($event);
         
         $sclever = new Calendar_Model_Attender(array(
-            'user_id'        => $this->_personasContacts['sclever']->getId(),
+            'user_id'        => $this->_getPersonasContacts('sclever')->getId(),
             'user_type'      => Calendar_Model_Attender::USERTYPE_USER,
         ));
         
@@ -200,7 +202,7 @@ class Calendar_Controller_MSEventFacadeTest extends Calendar_TestCase
         $event = $this->testCreate();
         
         $sclever = new Calendar_Model_Attender(array(
-            'user_id'        => $this->_personasContacts['sclever']->getId(),
+            'user_id'        => $this->_getPersonasContacts('sclever')->getId(),
             'user_type'      => Calendar_Model_Attender::USERTYPE_USER,
         ));
         $currUser = $this->_uit->setCalendarUser($sclever);
@@ -419,7 +421,7 @@ class Calendar_Controller_MSEventFacadeTest extends Calendar_TestCase
         $this->_uit->setEventFilter(new Calendar_Model_EventFilter(array(
             array('field' => 'attender', 'operator' => 'equals', 'value' => array(
                 'user_type'    => Calendar_Model_Attender::USERTYPE_USER,
-                'user_id'      => $this->_personasContacts['sclever']->getId(),
+                'user_id'      => $this->_getPersonasContacts('sclever')->getId(),
             )),
             array(
                 'field' => 'attender_status', 'operator' => 'notin', 'value' => array(
index 9a83f0a..12d506c 100644 (file)
@@ -40,7 +40,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2012-06-01 18:30:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=DAILY;INTERVAL=1;UNTIL=2011-05-31 17:30:00',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
         ));
         
         $this->setExpectedException('Tinebase_Exception_Record_Validation');
@@ -90,7 +90,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2011-04-20 15:30:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=WEEKLY;INTERVAL=3;WKST=SU;BYDAY=TU,TH',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT     => true,
         ));
         
@@ -103,7 +103,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $persistentEventException = $this->_controller->createRecurException($eventException);
         
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
@@ -174,14 +174,14 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
                 'dtend'         => '2012-02-22 15:30:00',
                 'originator_tz' => 'Europe/Berlin',
                 'rrule'         => 'FREQ=DAILY;COUNT=3',
-                'container_id'  => $this->_testCalendar->getId(),
+                'container_id'  => $this->_getTestCalendar()->getId(),
         ));
         
         $persistentEvent = $this->_controller->create($event);
         
         // create exception
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
         $weekviewEvents[2]->dtstart->subHour(5);
@@ -190,7 +190,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         
         // load series
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
         $weekviewEvents->sort('dtstart', 'ASC');
@@ -215,14 +215,14 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'is_all_day_event'  => true,
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT     => true,
         ));
         
         $persistentEvent = $this->_controller->create($event);
         
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
@@ -233,7 +233,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $persistentEventException = $this->_controller->createRecurException($exception, TRUE);
         
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
@@ -254,7 +254,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-03-31 17:30:00',
             'exdate'        => '2009-03-27 18:00:00,2009-03-29 17:00:00',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT     => true,
         ));
         $event->attendee = $this->_getAttendee();
@@ -297,7 +297,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2011-04-20 15:30:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=WEEKLY;INTERVAL=3;WKST=SU;BYDAY=TU,TH',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT     => true,
         ));
         $event->attendee = $this->_getAttendee();
@@ -310,7 +310,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $this->_controller->attenderStatusCreateRecurException(clone $persistentEvent, $attendee, $attendee->status_authkey);
         
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
@@ -328,15 +328,15 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $event->dtstart = '2010-05-20 06:00:00';
         $event->dtend = '2010-05-20 06:15:00';
         $event->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         $this->_controller->create($event);
 
         $event1 = $this->_getRecurEvent();
         $event1->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         
         $this->setExpectedException('Calendar_Exception_AttendeeBusy');
@@ -352,15 +352,15 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $event->dtstart = '2010-05-20 06:00:00';
         $event->dtend = '2010-05-20 06:15:00';
         $event->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         $this->_controller->create($event);
 
         $event1 = $this->_getRecurEvent();
         $event1->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         
         $event1 = $this->_controller->create($event1);
@@ -382,8 +382,8 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $event = $this->_getRecurEvent();
         $event->rrule = "FREQ=MONTHLY;INTERVAL=1;BYDAY=3TH";
         $event->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['sclever']->getId()),
-            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_personasContacts['pwulf']->getId())
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId()),
+            array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('pwulf')->getId())
         ));
         
         $persistentRecurEvent = $this->_controller->create($event);
@@ -424,7 +424,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
                 'dtstart'       => '2012-03-13 09:00:00',
                 'dtend'         => '2012-03-13 10:00:00',
                 'rrule'         => 'FREQ=DAILY;INTERVAL=1',
-                'container_id'  => $this->_testCalendar->getId(),
+                'container_id'  => $this->_getTestCalendar()->getId(),
                 'attendee'      => $this->_getAttendee(),
         ));
         
@@ -470,7 +470,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2011-04-21 12:00:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=DAILY;INTERVAL=1;UNTIL=2011-04-27 21:59:59',
-            'container_id'  => $this->_testCalendar->getId()
+            'container_id'  => $this->_getTestCalendar()->getId()
         ));
         
         $persistentEvent = $this->_controller->create($event);
@@ -507,7 +507,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $newBaseEvent = $this->_controller->createRecurException($recurSet[3], FALSE, TRUE);
         
         $events = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'period', 'operator' => 'within', 'value' => array('from' => $from, 'until' => $until),
         ))));
         
@@ -566,7 +566,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtstart'       => '2012-02-03 09:00:00',
             'dtend'         => '2012-02-03 10:00:00',
             'rrule'         => 'FREQ=DAILY;INTERVAL=1',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             'attendee'      => $this->_getAttendee(),
         ));
         
@@ -604,7 +604,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2012-06-01 12:00:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=WEEKLY;INTERVAL=1',
-            'container_id'  => $this->_testCalendar->getId()
+            'container_id'  => $this->_getTestCalendar()->getId()
         ));
         
         $persistentEvent = $this->_controller->create($event);
@@ -637,7 +637,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtstart'       => '2012-02-03 09:00:00',
             'dtend'         => '2012-02-03 10:00:00',
             'rrule'         => 'FREQ=DAILY;INTERVAL=1',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             'attendee'      => $this->_getAttendee(),
         ));
         
@@ -653,7 +653,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         $this->_controller->attenderStatusCreateRecurException($start, $sclever, $sclever->status_authkey, TRUE);
         
         $events = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId())
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId())
         )))->sort('dtstart', 'ASC');
         
         // assert two baseEvents
@@ -683,7 +683,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         
         $recurSet[5]->attendee->addRecord(new Calendar_Model_Attender(array(
             'user_type'   => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'     => $this->_personasContacts['pwulf']->getId()
+            'user_id'     => $this->_getPersonasContacts('pwulf')->getId()
         )));
         
         $updatedPersistentEvent = $this->_controller->createRecurException($recurSet[5], FALSE, TRUE);
@@ -704,7 +704,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtstart'       => $dtstart->toString(),
             'dtend'         => $dtstart->addHour(1)->toString(),
             'rrule'         => 'FREQ=DAILY;INTERVAL=1',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
             'attendee'      => $this->_getAttendee(),
         ));
         return $this->_controller->create($event);
@@ -725,14 +725,14 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'         => '2012-02-21 15:30:00',
             'originator_tz' => 'Europe/Berlin',
             'rrule'         => 'FREQ=DAILY;COUNT=5',
-            'container_id'  => $this->_testCalendar->getId(),
+            'container_id'  => $this->_getTestCalendar()->getId(),
         ));
         
         $persistentEvent = $this->_controller->create($event);
         
         // create exception
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
         $weekviewEvents[2]->dtstart->subHour(5);
@@ -741,7 +741,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
         
         // load events
         $weekviewEvents = $this->_controller->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         )));
         Calendar_Model_Rrule::mergeRecurrenceSet($weekviewEvents, $from, $until);
         $weekviewEvents->sort('dtstart', 'ASC');
@@ -792,7 +792,7 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             'dtend'       => '2010-05-20 06:15:00',
             'description' => 'Breakfast',
             'rrule'       => 'FREQ=DAILY;INTERVAL=1',    
-            'container_id' => $this->_testCalendar->getId(),
+            'container_id' => $this->_getTestCalendar()->getId(),
             Tinebase_Model_Grants::GRANT_EDIT    => true,
         ));
     }
index 342338b..e3a2a43 100644 (file)
@@ -94,8 +94,8 @@ class Calendar_Controller_ResourceTest extends Calendar_TestCase
         $persistentEvent = Calendar_Controller_Event::getInstance()->create($event);
         
         // we need to adopt conainer through backend, to bypass rights control
-        $persistentEvent->container_id = $this->_personasDefaultCals['rwright']->getId();
-        $persistentEvent->organizer = $this->_personasContacts['rwright']->getId();
+        $persistentEvent->container_id = $this->_getPersonasDefaultCals('rwright')->getId();
+        $persistentEvent->organizer = $this->_getPersonasContacts('rwright')->getId();
         $this->_backend->update($persistentEvent);
 
         
index c3985f6..77e80bb 100644 (file)
@@ -638,16 +638,112 @@ class Calendar_Convert_Event_VCalendar_GenericTest extends PHPUnit_Framework_Tes
      */
     public function testConvertWithInvalidAlarmTime()
     {
-        $vcalendarStream = Calendar_Frontend_WebDAV_EventTest::getVCalendar(dirname(__FILE__) . '/../../../Import/files/invalid_alarm_time.ics', 'r');
+        $savedEvent = $this->_saveIcsEvent('invalid_alarm_time.ics');
+        $this->assertEquals(104, count($savedEvent->exdate), print_r($savedEvent->toArray(), true));
+        $this->assertEquals(2, count($savedEvent->alarms), print_r($savedEvent->toArray(), true));
+    }
+    
+    /**
+     * save ics test event
+     * 
+     * @param string $filename
+     * @param string $client
+     * @return Calendar_Model_Event
+     */
+    protected function _saveIcsEvent($filename, $client = Calendar_Convert_Event_VCalendar_Factory::CLIENT_GENERIC)
+    {
+        $vcalendarStream = Calendar_Frontend_WebDAV_EventTest::getVCalendar(dirname(__FILE__) . '/../../../Import/files/' . $filename, 'r');
         
-        $this->_converter = Calendar_Convert_Event_VCalendar_Factory::factory(Calendar_Convert_Event_VCalendar_Factory::CLIENT_GENERIC);
+        $this->_converter = Calendar_Convert_Event_VCalendar_Factory::factory($client);
         
         $event = $this->_converter->toTine20Model($vcalendarStream);
         
-        // try to save event
-        $savedEvent = Calendar_Controller_MSEventFacade::getInstance()->create($event);
+        return Calendar_Controller_MSEventFacade::getInstance()->create($event);
+    }
+
+    /**
+     * testRruleWithBysetpos
+     * 
+     * @see 0010058: vevent with lots of exdates leads alarm saving failure
+     */
+    public function testRruleWithBysetpos()
+    {
+        $savedEvent = $this->_saveIcsEvent('outlook_bysetpos.ics');
         
-        $this->assertEquals(104, count($savedEvent->exdate), print_r($savedEvent->toArray(), true));
-        $this->assertEquals(2, count($savedEvent->alarms), print_r($savedEvent->toArray(), true));
+        $this->assertEquals(1, $savedEvent->rrule->bymonthday, print_r($savedEvent->toArray(), true));
+        $this->assertTrue(! isset($savedEvent->rrule->byday), print_r($savedEvent->toArray(), true));
+    }
+    
+    /**
+     * testLongSummary
+     * 
+     * @see 0010120: shorten long event summaries
+     */
+    public function testLongSummary()
+    {
+        $savedEvent = $this->_saveIcsEvent('iphone_longsummary.ics');
+        
+        $this->assertEquals('Finanz-IT anrufen, xxxxxxxxxxxh', $savedEvent->summary, print_r($savedEvent->toArray(), true));
+        $this->assertContains("Finanz-IT anrufen, xxxxxxxxxxxh\nFestgelegt für 25. Juli 2012", $savedEvent->description, print_r($savedEvent->toArray(), true));
+    }
+    
+    /**
+     * testRruleUntilAtDtstartForAllDayEvent
+     */
+    public function testRruleUntilAtDtstartForAllDayEvent()
+    {
+        $savedEvent = $this->_saveIcsEvent('rrule_until_at_dtstart_allday.ics');
+        
+        $this->assertTrue(true, 'no exception should be thrown ;-)');
+    }
+    
+    /**
+     * testInvalidUtf8
+     */
+    public function testInvalidUtf8()
+    {
+        $savedEvent = $this->_saveIcsEvent('invalid_utf8.ics');
+        $this->assertContains('Hoppegarten Day', $savedEvent->summary);
+    }
+    
+    /**
+     * testLongLocation
+     */
+    public function testLongLocation()
+    {
+        $savedEvent = $this->_saveIcsEvent('iphone_longlocation.ics');
+        
+        $this->assertContains('1. Rufen Sie folgende Seite auf: https://xxxxxxxxxxxxxx.webex.', $savedEvent->location, print_r($savedEvent->toArray(), true));
+        $this->assertContains("und Ihre E-Mail-Adresse ein.; geben Sie das Meeting-Passwort ein: xxxx", $savedEvent->description, print_r($savedEvent->toArray(), true));
+    }
+
+    /**
+     * test4ByteUTF8Summary
+     */
+    public function test4ByteUTF8Summary()
+    {
+        $savedEvent = $this->_saveIcsEvent('utf8mb4_summary.ics');
+        
+        $this->assertContains('Mail an Frau LaLiLoLu ging am 4.11 raus, dass du später zur Ralf Sitzung kommst (joda)', $savedEvent->summary);
+    }
+
+    /**
+     * testEmptyCategories
+     */
+    public function testEmptyCategories()
+    {
+        $savedEvent = $this->_saveIcsEvent('empty_categories.ics', Calendar_Convert_Event_VCalendar_Factory::CLIENT_MACOSX);
+        
+        $this->assertEquals('Flug nach Hamburg', $savedEvent->summary);
+    }
+    
+    /**
+     * testEmptyAttenderNameAndBrokenEmail
+     */
+    public function testEmptyAttenderNameAndBrokenEmail()
+    {
+        $savedEvent = $this->_saveIcsEvent('attender_empty_name.ics', Calendar_Convert_Event_VCalendar_Factory::CLIENT_MACOSX);
+        
+        $this->assertEquals('Telko axel', $savedEvent->summary);
     }
 }
index 0c739e2..ecb73ce 100644 (file)
@@ -191,7 +191,7 @@ class Calendar_Export_ICalTest extends Calendar_TestCase
         
         $this->_testNeedsTransaction();
         $cmd = realpath(__DIR__ . "/../../../../tine20/tine20.php") . ' --method Calendar.exportICS ' .
-            $this->_testCalendar->getId() ;
+            $this->_getTestCalendar()->getId() ;
         
         $cmd = TestServer::assembleCliCommand($cmd, TRUE);
         exec($cmd, $output);
@@ -209,7 +209,7 @@ class Calendar_Export_ICalTest extends Calendar_TestCase
     {
         $cli = new Calendar_Frontend_Cli();
         try {
-            $cli->exportICS(new Zend_Console_Getopt('abp:', array($this->_testCalendar->getId())));
+            $cli->exportICS(new Zend_Console_Getopt('abp:', array($this->_getTestCalendar()->getId())));
             $this->fail('Expected tinbase exception.');
         } catch (Tinebase_Exception $e){
             $this->assertTrue(true);
index e70edf5..7120cbd 100644 (file)
@@ -30,6 +30,7 @@ class Calendar_Frontend_AllTests
         $suite->addTest(Calendar_Frontend_WebDAV_AllTests::suite());
         $suite->addTestSuite('Calendar_Frontend_CalDAVTest');
         $suite->addTestSuite('Calendar_Frontend_iMIPTest');
+        $suite->addTestSuite('Calendar_Frontend_CalDAV_AllTests');
         return $suite;
     }
 }
diff --git a/tests/tine20/Calendar/Frontend/CalDAV/AllTests.php b/tests/tine20/Calendar/Frontend/CalDAV/AllTests.php
new file mode 100644 (file)
index 0000000..29a5c9b
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Tine 2.0 - http://www.tine20.org
+ * 
+ * @package     Calendar
+ * @license     http://www.gnu.org/licenses/agpl.html
+ * @copyright   Copyright (c) 2011-2011 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @author      Lars Kneschke <l.kneschke@metaways.de>
+ */
+
+/**
+ * Test helper
+ */
+require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php';
+
+class Calendar_Frontend_CalDAV_AllTests
+{
+    public static function main ()
+    {
+        PHPUnit_TextUI_TestRunner::run(self::suite());
+    }
+    
+    public static function suite ()
+    {
+        $suite = new PHPUnit_Framework_TestSuite('Tine 2.0 Calendar All Frontend CalDAV Tests');
+        $suite->addTestSuite('Calendar_Frontend_CalDAV_PluginDefaultAlarmsTest');
+        $suite->addTestSuite('Calendar_Frontend_CalDAV_ProxyTest');
+        $suite->addTestSuite('Calendar_Frontend_CalDAV_PluginManagedAttachmentsTest');
+        return $suite;
+    }
+}
diff --git a/tests/tine20/Calendar/Frontend/CalDAV/PluginDefaultAlarmsTest.php b/tests/tine20/Calendar/Frontend/CalDAV/PluginDefaultAlarmsTest.php
new file mode 100644 (file)
index 0000000..8ad34e8
--- /dev/null
@@ -0,0 +1,107 @@
+<?php
+/**
+ * Tine 2.0 - http://www.tine20.org
+ * 
+ * @package     Tinebase
+ * @subpackage  Frontend
+ * @license     http://www.gnu.org/licenses/agpl.html
+ * @copyright   Copyright (c) 2013-2013 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @author      Lars Kneschke <l.kneschke@metaways.de>
+ */
+
+/**
+ * Test helper
+ */
+require_once __DIR__ . '/../../../../../tine20/vendor/sabre/dav/tests/Sabre/HTTP/ResponseMock.php';
+
+/**
+ * Test class for Tinebase_WebDav_Plugin_OwnCloud
+ */
+class Calendar_Frontend_CalDAV_PluginDefaultAlarmsTest extends TestCase
+{
+    /**
+     * 
+     * @var Sabre\DAV\Server
+     */
+    protected $server;
+    
+    /**
+     * Sets up the fixture.
+     * This method is called before a test is executed.
+     *
+     * @access protected
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+        
+        $this->server = new Sabre\DAV\Server(new Tinebase_WebDav_Root());
+        
+        $this->plugin = new Calendar_Frontend_CalDAV_PluginDefaultAlarms();
+        
+        $this->server->addPlugin($this->plugin);
+        
+        $this->response = new Sabre\HTTP\ResponseMock();
+        $this->server->httpResponse = $this->response;
+    }
+
+    /**
+     * test getPluginName method
+     */
+    public function testGetPluginName()
+    {
+        $pluginName = $this->plugin->getPluginName();
+        
+        $this->assertEquals('calendarDefaultAlarms', $pluginName);
+    }
+    
+    /**
+     * test testGetProperties method
+     */
+    public function testGetProperties()
+    {
+        $body = '<?xml version="1.0" encoding="utf-8"?>
+                 <propfind xmlns="DAV:">
+                    <prop>
+                        <default-alarm-vevent-date xmlns="urn:ietf:params:xml:ns:caldav"/>
+                        <default-alarm-vevent-datetime xmlns="urn:ietf:params:xml:ns:caldav"/>
+                        <default-alarm-vtodo-date xmlns="urn:ietf:params:xml:ns:caldav"/>
+                        <default-alarm-vtodo-datetime xmlns="urn:ietf:params:xml:ns:caldav"/>
+                    </prop>
+                 </propfind>';
+
+        $request = new Sabre\HTTP\Request(array(
+            'REQUEST_METHOD' => 'PROPFIND',
+            'REQUEST_URI'    => '/calendars/' . Tinebase_Core::getUser()->contact_id,
+            'HTTP_DEPTH'     => '0',
+        ));
+        $request->setBody($body);
+
+        $this->server->httpRequest = $request;
+        $this->server->exec();
+        //var_dump($this->response->body);
+        $this->assertEquals('HTTP/1.1 207 Multi-Status', $this->response->status);
+        
+        $responseDoc = new DOMDocument();
+        $responseDoc->loadXML($this->response->body);
+        //$responseDoc->formatOutput = true; echo $responseDoc->saveXML();
+        $xpath = new DomXPath($responseDoc);
+        $xpath->registerNamespace('cal', 'urn:ietf:params:xml:ns:caldav');
+        
+        $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/cal:default-alarm-vevent-datetime');
+        $this->assertEquals(1, $nodes->length, $responseDoc->saveXML());
+        $this->assertNotEmpty($nodes->item(0)->nodeValue, $responseDoc->saveXML());
+        
+        $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/cal:default-alarm-vevent-date');
+        $this->assertEquals(1, $nodes->length, $responseDoc->saveXML());
+        $this->assertNotEmpty($nodes->item(0)->nodeValue, $responseDoc->saveXML());
+        
+        $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/cal:default-alarm-vtodo-datetime');
+        $this->assertEquals(1, $nodes->length, $responseDoc->saveXML());
+        $this->assertNotEmpty($nodes->item(0)->nodeValue, $responseDoc->saveXML());
+        
+        $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/cal:default-alarm-vtodo-date');
+        $this->assertEquals(1, $nodes->length, $responseDoc->saveXML());
+        $this->assertNotEmpty($nodes->item(0)->nodeValue, $responseDoc->saveXML());
+    }
+}
diff --git a/tests/tine20/Calendar/Frontend/CalDAV/PluginManagedAttachmentsTest.php b/tests/tine20/Calendar/Frontend/CalDAV/PluginManagedAttachmentsTest.php
new file mode 100644 (file)
index 0000000..c78b0ed
--- /dev/null
@@ -0,0 +1,318 @@
+<?php
+/**
+ * Tine 2.0 - http://www.tine20.org
+ * 
+ * @package     Calendar
+ * @subpackage  CalDAV
+ * @license     http://www.gnu.org/licenses/agpl.html
+ * @copyright   Copyright (c) 2013-2014 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @author      Cornelius Weiss <c.weiss@metaways.de>
+ */
+
+/**
+ * Test helper
+ */
+require_once __DIR__ . '/../../../../../tine20/vendor/sabre/dav/tests/Sabre/HTTP/ResponseMock.php';
+
+/**
+ * Test class for Calendar_Frontend_CalDAV_PluginManagedAttachments
+ */
+class Calendar_Frontend_CalDAV_PluginManagedAttachmentsTest extends TestCase
+{
+    /**
+     * 
+     * @var Sabre\DAV\Server
+     */
+    protected $server;
+    
+    /**
+     * Sets up the fixture.
+     * This method is called before a test is executed.
+     *
+     * @access protected
+     */
+    public function setUp()
+    {
+        $this->calDAVTests = new Calendar_Frontend_WebDAV_EventTest();
+        $this->calDAVTests->setup();
+        
+        parent::setUp();
+        
+        $this->hostname = 'tine.example.com';
+        $this->originalHostname = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null;
+        $_SERVER['HTTP_HOST'] = $this->hostname;
+        
+        $this->server = new Sabre\DAV\Server(new Tinebase_WebDav_Root());
+        
+        $this->plugin = new Calendar_Frontend_CalDAV_PluginManagedAttachments();
+        
+        $this->server->addPlugin($this->plugin);
+        
+        
+        $this->response = new Sabre\HTTP\ResponseMock();
+        $this->server->httpResponse = $this->response;
+    }
+
+    public function tearDown()
+    {
+        if ($this->originalHostname) {
+            $_SERVER['HTTP_HOST'] = $this->originalHostname;
+        }
+        $this->calDAVTests->tearDown();
+    }
+    
+    /**
+     * test getPluginName method
+     */
+    public function testGetPluginName()
+    {
+        $pluginName = $this->plugin->getPluginName();
+        
+        $this->assertEquals('calendarManagedAttachments', $pluginName);
+    }
+    
+    public function testGetProperties()
+    {
+        $body = '<?xml version="1.0" encoding="UTF-8"?>
+             <A:propfind xmlns:A="DAV:">
+               <A:prop>
+                 <B:dropbox-home-URL xmlns:B="http://calendarserver.org/ns/"/>
+               </A:prop>
+             </A:propfind>';
+    
+        $request = new Sabre\HTTP\Request(array(
+                'REQUEST_METHOD' => 'PROPFIND',
+                'REQUEST_URI'    => '/' . Tinebase_WebDav_PrincipalBackend::PREFIX_USERS . '/' . Tinebase_Core::getUser()->contact_id
+        ));
+        $request->setBody($body);
+    
+        $this->server->httpRequest = $request;
+        $this->server->exec();
+        
+        $responseDoc = new DOMDocument();
+        $responseDoc->loadXML($this->response->body);
+        //$responseDoc->formatOutput = true; echo $responseDoc->saveXML();
+        $xpath = new DomXPath($responseDoc);
+        $xpath->registerNamespace('cal', 'urn:ietf:params:xml:ns:caldav');
+        $xpath->registerNamespace('cs',  'http://calendarserver.org/ns/');
+        
+        $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/cs:dropbox-home-URL/d:href');
+        $dropboxUrl = $nodes->item(0)->nodeValue;
+        $this->assertTrue(!! strstr($dropboxUrl, 'dropbox'), $dropboxUrl);
+    }
+    
+    /**
+     * test testAddAttachment 
+     */
+    public function testAddAttachment()
+    {
+        $event = $this->calDAVTests->testCreateRepeatingEventAndPutExdate();
+        
+        $request = new Sabre\HTTP\Request(array(
+            'HTTP_CONTENT_TYPE' => 'text/plain',
+            'HTTP_CONTENT_DISPOSITION' => 'attachment;filename="agenda.txt"',
+            'REQUEST_METHOD' => 'POST',
+            'REQUEST_URI'    => '/calendars/' . 
+                Tinebase_Core::getUser()->contact_id . '/'. 
+                $event->getRecord()->container_id . '/' .
+                $event->getRecord()->uid . '.ics?action=attachment-add',
+            'QUERY_STRING'   => 'action=attachment-add',
+            'HTTP_DEPTH'     => '0',
+        ));
+        
+        $agenda = 'HELLO WORLD';
+        $request->setBody($agenda);
+
+        $this->server->httpRequest = $request;
+        $this->server->exec();
+        
+        $vcalendar = stream_get_contents($this->response->body);
+//         echo $vcalendar;
+        
+        $baseAttachments = Tinebase_FileSystem_RecordAttachments::getInstance()
+            ->getRecordAttachments($event->getRecord());
+        $exdateAttachments = Tinebase_FileSystem_RecordAttachments::getInstance()
+            ->getRecordAttachments($event->getRecord()->exdate[0]);
+        
+        $this->assertEquals('HTTP/1.1 201 Created', $this->response->status);
+        $this->assertContains('ATTACH;MANAGED-ID='. sha1($agenda), $vcalendar, $vcalendar);
+        $this->assertEquals(1, $baseAttachments->count());
+        $this->assertEquals('agenda.txt', $baseAttachments[0]->name);
+        $this->assertEquals(1, $exdateAttachments->count());
+        $this->assertEquals('agenda.txt', $exdateAttachments[0]->name);
+    }
+    
+    /**
+     * test testOverwriteAttachment
+     * 
+     * NOTE: current iCal can not update, but re-adds/overwrides if
+     *       you drag and drop an attachment twice
+     */
+    public function testOverwriteAttachment()
+    {
+        $event = $this->calDAVTests->createEventWithAttachment();
+        
+        $request = new Sabre\HTTP\Request(array(
+                'HTTP_CONTENT_TYPE' => 'text/plain',
+                'HTTP_CONTENT_DISPOSITION' => 'attachment;filename="agenda.html"',
+                'REQUEST_METHOD' => 'POST',
+                'REQUEST_URI'    => '/calendars/' .
+                Tinebase_Core::getUser()->contact_id . '/'.
+                $event->getRecord()->container_id . '/' .
+                $event->getRecord()->uid . '.ics?action=attachment-add',
+                'QUERY_STRING'   => 'action=attachment-add',
+                'HTTP_DEPTH'     => '0',
+        ));
+        
+        $agenda = 'GODDBYE WORLD';
+        $request->setBody($agenda);
+        
+        $this->server->httpRequest = $request;
+        $this->server->exec();
+        
+        $vcalendar = stream_get_contents($this->response->body);
+        //         echo $vcalendar;
+        
+        $attachments = Tinebase_FileSystem_RecordAttachments::getInstance()
+        ->getRecordAttachments($event->getRecord());
+        
+        $this->assertEquals('HTTP/1.1 201 Created', $this->response->status);
+        $this->assertContains('ATTACH;MANAGED-ID='. sha1($agenda), $vcalendar, $vcalendar);
+        $this->assertEquals(1, $attachments->count());
+        $this->assertEquals('agenda.html', $attachments[0]->name);
+    }
+    
+    public function testUpdateAttachment()
+    {
+        $event = $this->calDAVTests->createEventWithAttachment();
+        $attachmentNode = $event->getRecord()->attachments->getFirstRecord();
+        
+        $request = new Sabre\HTTP\Request(array(
+            'HTTP_CONTENT_TYPE' => 'text/plain',
+            'HTTP_CONTENT_DISPOSITION' => 'attachment;filename=agenda.txt',
+            'REQUEST_METHOD' => 'POST',
+            'REQUEST_URI'    => '/calendars/' .
+            Tinebase_Core::getUser()->contact_id . '/'.
+            $event->getRecord()->container_id . '/' .
+            $event->getRecord()->uid . '.ics?action=attachment-update&managed-id='.$attachmentNode->hash,
+            'QUERY_STRING'   => 'action=attachment-update&managed-id='.$attachmentNode->hash,
+            'HTTP_DEPTH'     => '0',
+        ));
+        
+        $agenda = 'GODDBYE WORLD';
+        $request->setBody($agenda);
+        
+        $this->server->httpRequest = $request;
+        $this->server->exec();
+        
+        $vcalendar = stream_get_contents($this->response->body);
+//         echo $vcalendar;
+        
+//         $this->assertEquals('HTTP/1.1 201 Created', $this->response->status);
+        $this->assertContains('ATTACH;MANAGED-ID='. sha1($agenda), $vcalendar, $vcalendar);
+         $this->assertNotContains($attachmentNode->hash, $vcalendar, 'old managed-id');
+        //@TODO assert URI
+        //@TODO /fetch attachement & assert contents
+    }
+    
+    public function testRemoveAttachment()
+    {
+        $event = $this->calDAVTests->createEventWithAttachment();
+        $attachmentNode = $event->getRecord()->attachments->getFirstRecord();
+        
+        $request = new Sabre\HTTP\Request(array(
+                'HTTP_CONTENT_TYPE' => 'text/plain',
+                'HTTP_CONTENT_DISPOSITION' => 'attachment;filename=agenda.txt',
+                'REQUEST_METHOD' => 'POST',
+                'REQUEST_URI'    => '/calendars/' .
+                Tinebase_Core::getUser()->contact_id . '/'.
+                $event->getRecord()->container_id . '/' .
+                $event->getRecord()->uid . '.ics?action=attachment-remove&managed-id='.$attachmentNode->hash,
+                'QUERY_STRING'   => 'action=attachment-remove&managed-id='.$attachmentNode->hash,
+                'HTTP_DEPTH'     => '0',
+        ));
+        
+        $this->server->httpRequest = $request;
+        $this->server->exec();
+        
+        $vcalendar = stream_get_contents($this->response->body);
+//         echo $vcalendar;
+        
+//         $this->assertEquals('HTTP/1.1 204 No Content', $this->response->status);
+        $this->assertNotContains('ATTACH;MANAGED-ID=', $vcalendar, $vcalendar);
+        
+        $attachments = Tinebase_FileSystem_RecordAttachments::getInstance()->getRecordAttachments($event->getRecord());
+        $this->assertEquals(0, $attachments->count());
+    }
+    
+    public function testCreateRecurringExceptionWithManagedBaseAttachment()
+    {
+        $_SERVER['HTTP_USER_AGENT'] = 'CalendarStore/5.0 (1127); iCal/5.0 (1535); Mac OS X/10.7.1 (11B26)';
+        
+        $event = $this->calDAVTests->createEventWithAttachment();
+        
+        // assemble vcalendar with exception
+        $eventWithExdate = clone $event;
+        $exception = clone $eventWithExdate->getRecord();
+        $eventWithExdate->getRecord()->exdate->addRecord($exception);
+        $exception->exdate = NULL;
+        $exception->rrule = NULL;
+        $exception->dtstart->addDay(5)->addHour(1);
+        $exception->dtend->addDay(5)->addHour(1);
+        $exception->setRecurId();
+
+        $event->put($eventWithExdate->get());
+        
+        $createdException = $event->getRecord()->exdate
+            ->filter('recurid', '9d28b78f-aa6d-44fc-92f6-5ab98d35d692-2011-10-09 09:00:00')
+            ->getFirstRecord();
+        
+        $this->assertEquals(1, $createdException->attachments->count());
+        
+        $attachment = $createdException->attachments->getFirstRecord();
+        $this->assertEquals('agenda.html', $attachment->name);
+    }
+
+    public function testDropBoxMKCol()
+    {
+        $event = $this->calDAVTests->testCreateEventWithInternalOrganizer();
+        
+        $body = '';
+        $request = new Sabre\HTTP\Request(array(
+                'REQUEST_METHOD' => 'MKCOL',
+                'REQUEST_URI'    => '/calendars/' . Tinebase_Core::getUser()->contact_id . '/dropbox/' . 
+                    $event->getRecord()->getId() . '.dropbox'
+        ));
+        $request->setBody($body);
+        
+        $this->server->httpRequest = $request;
+        $this->server->exec();
+        
+        // attachement folder is managed by tine20 itself
+        $this->assertEquals('HTTP/1.1 405 Method Not Allowed', $this->response->status);
+    }
+    
+    public function testDropBoxPut()
+    {
+        $event = $this->calDAVTests->testCreateEventWithInternalOrganizer();
+    
+        $request = new Sabre\HTTP\Request(array(
+                'REQUEST_METHOD' => 'PUT',
+                'REQUEST_URI'    => '/calendars/' . Tinebase_Core::getUser()->contact_id . '/dropbox/' .
+                $event->getRecord()->getId() . '.dropbox/agenda.txt'
+        ));
+        
+        $agenda = 'HELLO WORLD';
+        $request->setBody($agenda);
+    
+        $this->server->httpRequest = $request;
+        $this->server->exec();
+        
+//         echo $this->response->body;
+        $attachments = Tinebase_FileSystem_RecordAttachments::getInstance()
+        ->getRecordAttachments($event->getRecord());
+        
+        $this->assertEquals(1, $attachments->count());
+        $this->assertEquals('agenda.txt', $attachments[0]->name);
+    }
+}
diff --git a/tests/tine20/Calendar/Frontend/CalDAV/ProxyTest.php b/tests/tine20/Calendar/Frontend/CalDAV/ProxyTest.php
new file mode 100644 (file)
index 0000000..b41e19c
--- /dev/null
@@ -0,0 +1,200 @@
+<?php
+/**
+ * Tine 2.0 - http://www.tine20.org
+ * 
+ * @package     Calendar
+ * @subpackage  Frontend
+ * @license     http://www.gnu.org/licenses/agpl.html
+ * @copyright   Copyright (c) 2014-2014 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @author      Lars Kneschke <l.kneschke@metaways.de>
+ */
+
+/**
+ * Test helper
+ */
+require_once __DIR__ . '/../../../../../tine20/vendor/sabre/dav/tests/Sabre/HTTP/ResponseMock.php';
+
+/**
+ * Test class for Calendar_Frontend_CalDAV_ProxyTest
+ */
+class Calendar_Frontend_CalDAV_ProxyTest extends TestCase
+{
+    /**
+     * 
+     * @var Sabre\DAV\Server
+     */
+    protected $server;
+    
+    /**
+     * Sets up the fixture.
+     * This method is called before a test is executed.
+     *
+     * @access protected
+     */
+    protected function setUp()
+    {
+        parent::setUp();
+        
+        $this->server = new Sabre\DAV\Server(new Tinebase_WebDav_Root());
+        $this->server->debugExceptions = true;
+        $this->server->addPlugin(new \Sabre\CalDAV\Plugin());
+        $this->server->addPlugin(new \Sabre\CalDAV\SharingPlugin());
+        
+        $aclPlugin = new \Sabre\DAVACL\Plugin();
+        $aclPlugin->defaultUsernamePath    = Tinebase_WebDav_PrincipalBackend::PREFIX_USERS;
+        $aclPlugin->principalCollectionSet = array (Tinebase_WebDav_PrincipalBackend::PREFIX_USERS, Tinebase_WebDav_PrincipalBackend::PREFIX_GROUPS);
+        $this->server->addPlugin($aclPlugin);
+        
+        $this->response = new Sabre\HTTP\ResponseMock();
+        $this->server->httpResponse = $this->response;
+    }
+
+    /**
+     * test testGetProperties method
+     */
+    public function testGetProperties()
+    {
+        $body = '<?xml version="1.0" encoding="UTF-8"?>
+            <A:expand-property xmlns:A="DAV:">
+                <A:property name="calendar-proxy-read-for" namespace="http://calendarserver.org/ns/">
+                    <A:property name="email-address-set" namespace="http://calendarserver.org/ns/"/>
+                    <A:property name="displayname" namespace="DAV:"/>
+                    <A:property name="calendar-user-address-set" namespace="urn:ietf:params:xml:ns:caldav"/>
+                </A:property>
+                <A:property name="calendar-proxy-write-for" namespace="http://calendarserver.org/ns/">
+                    <A:property name="email-address-set" namespace="http://calendarserver.org/ns/"/>
+                    <A:property name="displayname" namespace="DAV:"/>
+                    <A:property name="calendar-user-address-set" namespace="urn:ietf:params:xml:ns:caldav"/>
+                </A:property>
+            </A:expand-property>';
+
+        $request = new Sabre\HTTP\Request(array(
+            'REQUEST_METHOD' => 'REPORT',
+            'REQUEST_URI'    => '/' . Tinebase_WebDav_PrincipalBackend::PREFIX_USERS . '/' . Tinebase_Core::getUser()->contact_id
+        ));
+        $request->setBody($body);
+
+        $this->server->httpRequest = $request;
+        $this->server->exec();
+        //var_dump($this->response->body);
+        
+        $this->assertEquals('HTTP/1.1 207 Multi-Status', $this->response->status);
+        
+        $responseDoc = new DOMDocument();
+        $responseDoc->loadXML($this->response->body);
+        //$responseDoc->formatOutput = true; echo $responseDoc->saveXML();
+        $xpath = new DomXPath($responseDoc);
+        $xpath->registerNamespace('cal', 'urn:ietf:params:xml:ns:caldav');
+        $xpath->registerNamespace('cs',  'http://calendarserver.org/ns/');
+        
+        $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/cs:calendar-proxy-read-for');
+        $this->assertEquals(1, $nodes->length, $responseDoc->saveXML());
+        #$this->assertEmpty($nodes->item(0)->nodeValue, $responseDoc->saveXML());
+        
+        $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/cs:calendar-proxy-write-for');
+        $this->assertEquals(1, $nodes->length, $responseDoc->saveXML());
+        #$this->assertEmpty($nodes->item(0)->nodeValue, $responseDoc->saveXML());
+    }
+    
+    /**
+     * test testGetProperties method
+     */
+    public function testGetPropertiesSharedUser()
+    {
+        $body = '<?xml version="1.0" encoding="UTF-8"?>
+            <A:expand-property xmlns:A="DAV:">
+                <A:property name="calendar-proxy-read-for" namespace="http://calendarserver.org/ns/">
+                    <A:property name="email-address-set" namespace="http://calendarserver.org/ns/"/>
+                    <A:property name="displayname" namespace="DAV:"/>
+                    <A:property name="calendar-user-address-set" namespace="urn:ietf:params:xml:ns:caldav"/>
+                </A:property>
+                <A:property name="calendar-proxy-write-for" namespace="http://calendarserver.org/ns/">
+                    <A:property name="email-address-set" namespace="http://calendarserver.org/ns/"/>
+                    <A:property name="displayname" namespace="DAV:"/>
+                    <A:property name="calendar-user-address-set" namespace="urn:ietf:params:xml:ns:caldav"/>
+                </A:property>
+            </A:expand-property>';
+
+        $request = new Sabre\HTTP\Request(array(
+            'REQUEST_METHOD' => 'REPORT',
+            'REQUEST_URI'    => '/' . Tinebase_WebDav_PrincipalBackend::PREFIX_USERS . '/' . Tinebase_WebDav_PrincipalBackend::SHARED
+        ));
+        $request->setBody($body);
+
+        $this->server->httpRequest = $request;
+        $this->server->exec();
+        //var_dump($this->response->body);
+        
+        $this->assertEquals('HTTP/1.1 207 Multi-Status', $this->response->status);
+        
+        $responseDoc = new DOMDocument();
+        $responseDoc->loadXML($this->response->body);
+        //$responseDoc->formatOutput = true; echo $responseDoc->saveXML();
+        $xpath = new DomXPath($responseDoc);
+        $xpath->registerNamespace('cal', 'urn:ietf:params:xml:ns:caldav');
+        $xpath->registerNamespace('cs',  'http://calendarserver.org/ns/');
+        
+        $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/cs:calendar-proxy-read-for');
+        $this->assertEquals(1, $nodes->length, $responseDoc->saveXML());
+        #$this->assertEmpty($nodes->item(0)->nodeValue, $responseDoc->saveXML());
+        
+        $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/cs:calendar-proxy-write-for');
+        $this->assertEquals(1, $nodes->length, $responseDoc->saveXML());
+        #$this->assertEmpty($nodes->item(0)->nodeValue, $responseDoc->saveXML());
+    }
+    
+    /**
+     * test testGetProperties method
+     */
+    public function testGetPropertiesSharedUserPrincipal()
+    {
+        $body = '<?xml version="1.0" encoding="UTF-8"?>
+            <A:propfind xmlns:A="DAV:">
+              <A:prop>
+                <B:calendar-home-set xmlns:B="urn:ietf:params:xml:ns:caldav"/>
+                <B:calendar-user-address-set xmlns:B="urn:ietf:params:xml:ns:caldav"/>
+                <A:current-user-principal/>
+                <A:displayname/>
+                <C:dropbox-home-URL xmlns:C="http://calendarserver.org/ns/"/>
+                <C:email-address-set xmlns:C="http://calendarserver.org/ns/"/>
+                <C:notification-URL xmlns:C="http://calendarserver.org/ns/"/>
+                <A:principal-collection-set/>
+                <A:principal-URL/>
+                <A:resource-id/>
+                <B:schedule-inbox-URL xmlns:B="urn:ietf:params:xml:ns:caldav"/>
+                <B:schedule-outbox-URL xmlns:B="urn:ietf:params:xml:ns:caldav"/>
+                <A:supported-report-set/>
+              </A:prop>
+            </A:propfind>';
+
+        $request = new Sabre\HTTP\Request(array(
+            'REQUEST_METHOD' => 'PROPFIND',
+            'REQUEST_URI'    => '/' . Tinebase_WebDav_PrincipalBackend::PREFIX_USERS . '/' . Tinebase_WebDav_PrincipalBackend::SHARED,
+            'HTTP_BRIEF'     => 't',
+            'HTTP_DEPTH'     => '0'
+        ));
+        $request->setBody($body);
+
+        $this->server->httpRequest = $request;
+        $this->server->exec();
+        //var_dump($this->response->body);
+        
+        $this->assertEquals('HTTP/1.1 207 Multi-Status', $this->response->status);
+        
+        $responseDoc = new DOMDocument();
+        $responseDoc->loadXML($this->response->body);
+        //$responseDoc->formatOutput = true; echo $responseDoc->saveXML();
+        $xpath = new DomXPath($responseDoc);
+        $xpath->registerNamespace('cal', 'urn:ietf:params:xml:ns:caldav');
+        $xpath->registerNamespace('cs',  'http://calendarserver.org/ns/');
+        $xpath->registerNamespace('d',  'DAV');
+        
+        $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/cal:calendar-home-set');
+        $this->assertEquals(1, $nodes->length, $responseDoc->saveXML());
+        #$this->assertEmpty($nodes->item(0)->nodeValue, $responseDoc->saveXML());
+        
+        $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/d:principal-URL');
+        $this->assertEquals(1, $nodes->length, $responseDoc->saveXML());
+        #$this->assertEmpty($nodes->item(0)->nodeValue, $responseDoc->saveXML());
+    }
+}
index 744ee91..43a7306 100644 (file)
@@ -4,86 +4,30 @@
  * 
  * @package     Calendar
  * @license     http://www.gnu.org/licenses/agpl.html
- * @copyright   Copyright (c) 2011-2011 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @copyright   Copyright (c) 2011-2014 Metaways Infosystems GmbH (http://www.metaways.de)
  * @author      Lars Kneschke <l.kneschke@metaways.de>
  */
 
 /**
- * Test helper
- */
-require_once dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'TestHelper.php';
-
-if (!defined('PHPUnit_MAIN_METHOD')) {
-    define('PHPUnit_MAIN_METHOD', 'Calendar_Frontend_CalDAVTest::main');
-}
-
-/**
  * Test class for Calendar_Frontend_CalDAV
+ * 
+ * @package     Calendar
  */
-class Calendar_Frontend_CalDAVTest extends PHPUnit_Framework_TestCase
+class Calendar_Frontend_CalDAVTest extends TestCase
 {
     /**
-     * @var array test objects
-     */
-    protected $objects = array();
-    
-    /**
-     * Runs the test methods of this class.
-     *
-     * @access public
-     * @static
-     */
-    public static function main()
-    {
-        $suite  = new PHPUnit_Framework_TestSuite('Tine 2.0 Calendar CalDAV Tests');
-        PHPUnit_TextUI_TestRunner::run($suite);
-    }
-
-    /**
-     * Sets up the fixture.
-     * This method is called before a test is executed.
-     *
-     * @access protected
-     */
-    protected function setUp()
-    {
-        Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
-        
-        $this->objects['initialContainer'] = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array(
-            'name'              => Tinebase_Record_Abstract::generateUID(),
-            'model'             => 'Calendar_Model_Event',
-            'type'              => Tinebase_Model_Container::TYPE_PERSONAL,
-            'backend'           => 'Sql',
-            'application_id'    => Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId(),
-        )));
-        
-        $this->objects['tasksContainer'] = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array(
-            'name'              => Tinebase_Record_Abstract::generateUID(),
-            'model'             => 'Tasks_Model_Task',
-            'type'              => Tinebase_Model_Container::TYPE_PERSONAL,
-            'backend'           => 'Sql',
-            'application_id'    => Tinebase_Application::getInstance()->getApplicationByName('Tasks')->getId(),
-        )));
-    }
-
-    /**
-     * Tears down the fixture
-     * This method is called after a test is executed.
+     * Tree
      *
-     * @access protected
+     * @var Sabre\DAV\ObjectTree
      */
-    protected function tearDown()
-    {
-        Tinebase_TransactionManager::getInstance()->rollBack();
-        $_SERVER['HTTP_USER_AGENT'] = '';
-    }
+    protected $_webdavTree;
     
     /**
      * test getChildren
      */
     public function testGetChildren()
     {
-        $collection = new Calendar_Frontend_CalDAV();
+        $collection = new Calendar_Frontend_WebDAV(\Sabre\CalDAV\Plugin::CALENDAR_ROOT . '/' . Tinebase_Core::getUser()->contact_id, true);
         
         $children = $collection->getChildren();
         
@@ -95,25 +39,45 @@ class Calendar_Frontend_CalDAVTest extends PHPUnit_Framework_TestCase
         
         return $children;
     }
-        
+    
     /**
      * test getChild
      */
     public function testGetChild()
     {
-        $collection = new Calendar_Frontend_CalDAV();
+        $collection = new Calendar_Frontend_WebDAV(\Sabre\CalDAV\Plugin::CALENDAR_ROOT . '/' . Tinebase_Core::getUser()->contact_id, true);
         
-        $child = $collection->getChild($this->objects['initialContainer']->getId());
+        $child = $collection->getChild($this->_getCalendarTestContainer()->getId());
         
         $this->assertTrue($child instanceof Calendar_Frontend_WebDAV_Container);
     }
     
     /**
+     * test get calendar inbox
+     */
+    public function testGetCalendarInbox()
+    {
+        $node = $this->_getWebDAVTree()->getNodeForPath('/calendars/' . Tinebase_Core::getUser()->contact_id . '/inbox');
+        
+        $this->assertInstanceOf('Calendar_Frontend_CalDAV_ScheduleInbox', $node, 'wrong child class');
+    }
+    
+    /**
+     * test get calendar outbox
+     */
+    public function testGetCalendarOutbox()
+    {
+        $node = $this->_getWebDAVTree()->getNodeForPath('/calendars/' . Tinebase_Core::getUser()->contact_id . '/outbox');
+        
+        $this->assertInstanceOf('\Sabre\CalDAV\Schedule\Outbox', $node, 'wrong child class');
+    }
+    
+    /**
      * test getChild
      */
     public function testGetTasksChild()
     {
-        $collection = new Calendar_Frontend_CalDAV();
+        $collection = new Calendar_Frontend_WebDAV(\Sabre\CalDAV\Plugin::CALENDAR_ROOT . '/' . Tinebase_Core::getUser()->contact_id, true);
         $children = $this->testGetChildren();
         
         $taskContainer = array_reduce($children, function($result, $container){
@@ -126,12 +90,14 @@ class Calendar_Frontend_CalDAVTest extends PHPUnit_Framework_TestCase
     
     /**
      * test testGetTasksChild (Mac_OS_X)
+     * 
+     * @backupGlobals enabled
      */
     public function testGetTasksChildMacOSX()
     {
         $_SERVER['HTTP_USER_AGENT'] = 'Mac_OS_X/10.9 (13A603) CalendarAgent/174';
         
-        $collection = new Calendar_Frontend_CalDAV();
+        $collection = new Calendar_Frontend_WebDAV(\Sabre\CalDAV\Plugin::CALENDAR_ROOT, true);
         $children = $this->testGetChildren();
     }
     
@@ -140,7 +106,7 @@ class Calendar_Frontend_CalDAVTest extends PHPUnit_Framework_TestCase
      */
     public function testCreateFile()
     {
-        $collection = new Calendar_Frontend_CalDAV();
+        $collection = new Calendar_Frontend_WebDAV(\Sabre\CalDAV\Plugin::CALENDAR_ROOT . '/' . Tinebase_Core::getUser()->contact_id, true);
         
         $this->setExpectedException('Sabre\DAV\Exception\Forbidden');
         
@@ -154,13 +120,117 @@ class Calendar_Frontend_CalDAVTest extends PHPUnit_Framework_TestCase
     {
         $randomName = Tinebase_Record_Abstract::generateUID();
         
-        $collection = new Calendar_Frontend_CalDAV();
+        $collection = new Calendar_Frontend_WebDAV(\Sabre\CalDAV\Plugin::CALENDAR_ROOT . '/' . Tinebase_Core::getUser()->contact_id, true);
         
         $collection->createDirectory($randomName);
         
         $container = Tinebase_Container::getInstance()->getContainerByName('Calendar', $randomName, Tinebase_Model_Container::TYPE_PERSONAL, Tinebase_Core::getUser());
         
         $this->assertTrue($container instanceof Tinebase_Model_Container);
+    }
+
+    /**
+     * test to create a new directory
+     */
+    public function testCreateExtendedCollectionVEvent()
+    {
+        $randomName = Tinebase_Record_Abstract::generateUID();
+        
+        $collection = new Calendar_Frontend_WebDAV(\Sabre\CalDAV\Plugin::CALENDAR_ROOT . '/' . Tinebase_Core::getUser()->contact_id, true);
+        
+        $collection->createExtendedCollection(
+            'B1B3BEA0-F1F9-409F-B1A0-43E41119F851', 
+            array('{DAV:}collection', '{urn:ietf:params:xml:ns:caldav}calendar'),
+            array(
+                '{DAV:}displayname' => $randomName,
+                '{http://apple.com/ns/ical/}calendar-color' => '#711A76FF',
+                '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new \Sabre\CalDAV\Property\SupportedCalendarComponentSet(array('VEVENT'))
+            )
+        );
         
+        $container = Tinebase_Container::getInstance()->getContainerByName('Calendar', $randomName, Tinebase_Model_Container::TYPE_PERSONAL, Tinebase_Core::getUser());
+        $this->assertTrue($container instanceof Tinebase_Model_Container);
+        
+        $subCollection = $collection->getChild('B1B3BEA0-F1F9-409F-B1A0-43E41119F851');
+        $this->assertEquals('B1B3BEA0-F1F9-409F-B1A0-43E41119F851', $subCollection->getName());
+        
+        $properties = $subCollection->getProperties(array('{DAV:}displayname'));
+        $this->assertEquals($randomName, $properties['{DAV:}displayname']);
     }
+
+    /**
+     * test to create a new directory
+     */
+    public function testCreateExtendedCollectionVTodo()
+    {
+        $randomName = Tinebase_Record_Abstract::generateUID();
+        
+        $collection = new Calendar_Frontend_WebDAV(\Sabre\CalDAV\Plugin::CALENDAR_ROOT . '/' . Tinebase_Core::getUser()->contact_id, true);
+        
+        $collection->createExtendedCollection(
+            'B1B3BEA0-F1F9-409F-B1A0-43E41119F851', 
+            array('{DAV:}collection', '{urn:ietf:params:xml:ns:caldav}calendar'),
+            array(
+                '{DAV:}displayname' => $randomName,
+                '{http://apple.com/ns/ical/}calendar-color' => '#711A76FF',
+                '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new \Sabre\CalDAV\Property\SupportedCalendarComponentSet(array('VTODO'))
+            )
+        );
+        
+        $container = Tinebase_Container::getInstance()->getContainerByName('Tasks', $randomName, Tinebase_Model_Container::TYPE_PERSONAL, Tinebase_Core::getUser());
+        $this->assertTrue($container instanceof Tinebase_Model_Container);
+        
+        $subCollection = $collection->getChild('B1B3BEA0-F1F9-409F-B1A0-43E41119F851');
+        $this->assertEquals('B1B3BEA0-F1F9-409F-B1A0-43E41119F851', $subCollection->getName());
+        
+        $properties = $subCollection->getProperties(array('{DAV:}displayname'));
+        $this->assertEquals($randomName, $properties['{DAV:}displayname']);
+    }
+
+    /**
+     * 
+     * @return \Sabre\DAV\ObjectTree
+     */
+    protected function _getWebDAVTree()
+    {
+        if (! $this->_webdavTree instanceof \Sabre\DAV\ObjectTree) {
+            $this->_webdavTree = new \Sabre\DAV\ObjectTree(new Tinebase_WebDav_Root());
+        }
+        
+        return $this->_webdavTree;
+    }
+    
+    /**
+     * 
+     * @return Tinebase_Model_Container
+     */
+    protected function _getCalendarTestContainer()
+    {
+        $container = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array(
+            'name'              => Tinebase_Record_Abstract::generateUID(),
+            'model'             => 'Calendar_Model_Event',
+            'type'              => Tinebase_Model_Container::TYPE_PERSONAL,
+            'backend'           => 'Sql',
+            'application_id'    => Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId(),
+        )));
+        
+        return $container;
+    }
+    
+    /**
+     * 
+     * @return Tinebase_Model_Container
+     */
+    protected function _getTasksTestContainer()
+    {
+        $container = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array(
+            'name'              => Tinebase_Record_Abstract::generateUID(),
+            'model'             => 'Tasks_Model_Task',
+            'type'              => Tinebase_Model_Container::TYPE_PERSONAL,
+            'backend'           => 'Sql',
+            'application_id'    => Tinebase_Application::getInstance()->getApplicationByName('Tasks')->getId(),
+        )));
+        
+        return $container;
+    }    
 }
index 951347f..7355c8c 100644 (file)
@@ -8,15 +8,6 @@
  * @author      Lars Kneschke <l.kneschke@metaways.de>
  */
 
-/**
- * Test helper
- */
-require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php';
-
-if (! defined('PHPUnit_MAIN_METHOD')) {
-    define('PHPUnit_MAIN_METHOD', 'Calendar_Frontend_WebDAV_AllTests::main');
-}
-
 class Calendar_Frontend_WebDAV_AllTests
 {
     public static function main ()
@@ -32,7 +23,3 @@ class Calendar_Frontend_WebDAV_AllTests
         return $suite;
     }
 }
-
-if (PHPUnit_MAIN_METHOD == 'Calendar_Frontend_WebDAV_AllTests::main') {
-    Calendar_Frontend_WebDAV_AllTests::main();
-}
index 9d9c72d..f42b61e 100644 (file)
@@ -81,9 +81,6 @@ class Calendar_Frontend_WebDAV_ContainerTest extends PHPUnit_Framework_TestCase
         $this->assertEquals($this->objects['initialContainer']->name, $result);
     }
     
-    /**
-     * assert that name of folder is container name
-     */
     public function testGetOwner()
     {
         $container = new Calendar_Frontend_WebDAV_Container($this->objects['initialContainer']);
@@ -93,9 +90,6 @@ class Calendar_Frontend_WebDAV_ContainerTest extends PHPUnit_Framework_TestCase
         $this->assertEquals('principals/users/' . Tinebase_Core::getUser()->contact_id, $result);
     }
     
-    /**
-     * assert that name of folder is container name
-     */
     public function testGetACL()
     {
         $container = new Calendar_Frontend_WebDAV_Container($this->objects['initialContainer']);
@@ -107,9 +101,6 @@ class Calendar_Frontend_WebDAV_ContainerTest extends PHPUnit_Framework_TestCase
         $this->assertEquals(6, count($result));
     }
     
-    /**
-     * assert that name of folder is container name
-     */
     public function testGetIdAsName()
     {
         $container = new Calendar_Frontend_WebDAV_Container($this->objects['initialContainer'], true);
@@ -294,6 +285,35 @@ class Calendar_Frontend_WebDAV_ContainerTest extends PHPUnit_Framework_TestCase
     }
     
     /**
+     * test Calendar_Frontend_WebDAV_Container::getShares
+     */
+    public function testGetShares()
+    {
+        $container = new Calendar_Frontend_WebDAV_Container($this->objects['initialContainer']);
+        
+        $shares = $container->getShares();
+        
+        $this->assertEquals(3, count($shares));
+    }
+    
+    /**
+     * test Calendar_Frontend_WebDAV_Container::getShares for container user has no admin grant for
+     */
+    public function testGetSharesWithoutRights()
+    {
+        $jmcblack = array_value('jmcblack', Zend_Registry::get('personas'));
+        $jmcblacksCalId = Tinebase_Core::getPreference('Calendar')->getValueForUser(Calendar_Preference::DEFAULTCALENDAR, $jmcblack->getId());
+        $jmcblacksCal = Tinebase_Container::getInstance()->get($jmcblacksCalId);
+        
+        $container = new Calendar_Frontend_WebDAV_Container($jmcblacksCal);
+    
+        $shares = $container->getShares();
+    
+        $this->assertEquals(1, count($shares));
+        $this->assertTrue((bool)$shares[0]['readOnly']);
+    }
+    
+    /**
      * return vcalendar as string and replace organizers email address with emailaddess of current user
      * 
      * @param string $_filename  file to open
index 439a2e8..54c9574 100644 (file)
@@ -70,7 +70,7 @@ class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
     {
         parent::tearDown();
         
-        Tinebase_Core::set(Tinebase_Core::USER, $this->_testUser);
+        Tinebase_Core::set(Tinebase_Core::USER, $this->_getTestUser());
     }
     
     /**
@@ -241,6 +241,8 @@ class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
         $event->put($vcalendarStreamException);
         
         $this->_checkExdate($event);
+        
+        return $event;
     }
     
     /**
@@ -256,33 +258,48 @@ class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
         $event = Calendar_Frontend_WebDAV_Event::create($this->objects['initialContainer'], "$id.ics", $vcalendar);
         
         $event = Calendar_Controller_Event::getInstance()->get($id);
-        $pwulf = $event->attendee->filter('user_id', $this->_personasContacts['pwulf']->getId())->getFirstRecord();
+        $pwulf = $event->attendee->filter('user_id', $this->_getPersonasContacts('pwulf')->getId())->getFirstRecord();
         
         $this->assertTrue($pwulf !== null, 'could not find pwulf in attendee: ' . print_r($event->attendee->toArray(), true));
-        $this->assertEquals($this->_personasDefaultCals['pwulf']->getId(), $pwulf->displaycontainer_id, 'event not in pwulfs personal calendar');
+        $this->assertEquals($this->_getPersonasDefaultCals('pwulf')->getId(), $pwulf->displaycontainer_id, 'event not in pwulfs personal calendar');
     }
     
-    public function testCreateEventMissingOwnAttendee()
+    /**
+     * _testEventMissingAttendee helper
+     * 
+     * @param Tinebase_Model_Container $container
+     * @param Calendar_Model_Attender $assertionAttendee
+     * @param boolean $assertMissing
+     */
+    public function _testEventMissingAttendee($container, $assertionAttendee, $assertMissing = false)
     {
+        $not = $assertMissing ? '' : 'not ';
+        $assertFn = $assertMissing ? 'assertFalse' : 'assertTrue';
+        
         $_SERVER['HTTP_USER_AGENT'] = 'CalendarStore/5.0 (1127); iCal/5.0 (1535); Mac OS X/10.7.1 (11B26)';
         
         $vcalendar = self::getVCalendar(dirname(__FILE__) . '/../../Import/files/apple_caldendar_repeating.ics');
         
         
         $id = Tinebase_Record_Abstract::generateUID();
-        $event = Calendar_Frontend_WebDAV_Event::create($this->objects['initialContainer'], "$id.ics", $vcalendar);
+
+        $event = Calendar_Frontend_WebDAV_Event::create($container, "$id.ics", $vcalendar);
         
-        $this->assertTrue(!! Calendar_Model_Attender::getOwnAttender($event->getRecord()->attendee), 'own attendee has not been added');
-        $this->assertTrue(!! Calendar_Model_Attender::getOwnAttender($event->getRecord()->exdate->getFirstRecord()->attendee), 'own attendee has not been added to exdate');
+        $this->$assertFn(!! Calendar_Model_Attender::getAttendee($event->getRecord()->attendee, $assertionAttendee),
+                "attendee has {$not}been added: " . print_r($event->getRecord()->attendee->toArray(), true));
+        $this->$assertFn(!! Calendar_Model_Attender::getAttendee($event->getRecord()->exdate->getFirstRecord()->attendee, $assertionAttendee),
+                "attendee has {$not}been added to exdate");
         
         // Simulate OSX which updates w.o. fetching first
         $vcalendarStream = fopen(dirname(__FILE__) . '/../../Import/files/apple_caldendar_repeating.ics', 'r');
         
-        $event = new Calendar_Frontend_WebDAV_Event($this->objects['initialContainer'], $event->getRecord()->getId());
+        $event = new Calendar_Frontend_WebDAV_Event($container, $event->getRecord()->getId());
         $event->put($vcalendarStream);
         
-        $this->assertTrue(!! Calendar_Model_Attender::getOwnAttender($event->getRecord()->attendee), 'own attendee has not been preserved');
-        $this->assertTrue(!! Calendar_Model_Attender::getOwnAttender($event->getRecord()->exdate->getFirstRecord()->attendee), 'own attendee has not been preserved in exdate');
+        $this->$assertFn(!! Calendar_Model_Attender::getAttendee($event->getRecord()->attendee, $assertionAttendee),
+                "attendee has {$not}been preserved: " . print_r($event->getRecord()->attendee->toArray(), true));
+        $this->$assertFn(!! Calendar_Model_Attender::getAttendee($event->getRecord()->exdate->getFirstRecord()->attendee, $assertionAttendee),
+                "attendee has {$not}been preserved in exdate");
         
         // create new exception from client w.o. fetching first
         Calendar_Controller_Event::getInstance()->purgeRecords(TRUE);
@@ -291,12 +308,58 @@ class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
         
         $vcalendarStream = fopen(dirname(__FILE__) . '/../../Import/files/apple_caldendar_repeating.ics', 'r');
         
-        $event = new Calendar_Frontend_WebDAV_Event($this->objects['initialContainer'], $event->getRecord()->getId());
+        $event = new Calendar_Frontend_WebDAV_Event($container, $event->getRecord()->getId());
         $event->put($vcalendarStream);
         
-        $this->assertTrue(!! Calendar_Model_Attender::getOwnAttender($event->getRecord()->attendee), 'own attendee has not been created in exdate');
-        $this->assertTrue(!! Calendar_Model_Attender::getOwnAttender($event->getRecord()->exdate->getFirstRecord()->attendee), 'own attendee has not been created in exdate');
+        $this->$assertFn(!! Calendar_Model_Attender::getAttendee($event->getRecord()->attendee, $assertionAttendee),
+                "attendee has {$not}been created in exdate");
+        $this->$assertFn(!! Calendar_Model_Attender::getAttendee($event->getRecord()->exdate->getFirstRecord()->attendee, $assertionAttendee),
+                "attendee has {$not}been created in exdate");
+    }
+    
+    /**
+     * testEventMissingAttendeeOwnCalendar
+     *
+     * validate test user is added for event in own container
+     */
+    public function testEventMissingAttendeeOwnCalendar()
+    {
+        $this->_testEventMissingAttendee($this->objects['initialContainer'], new Calendar_Model_Attender(array(
+            'user_type'    => Calendar_Model_Attender::USERTYPE_USER,
+            'user_id'      => Tinebase_Core::getUser()->contact_id,
+        )));
+    }
+    /**
+     * testEventMissingAttendeeOtherCalendar
+     *
+     * validate calendar owner is added for event in other user container
+     */
+    public function testEventMissingAttendeeOtherCalendar()
+    {
+        $egt = new Calendar_Controller_EventGrantsTests();
+        $egt->setup();
         
+        $pwulfPersonalCal = $this->_personasDefaultCals['sclever'];
+        $pwulf = new Calendar_Model_Attender(array(
+            'user_type'    => Calendar_Model_Attender::USERTYPE_USER,
+            'user_id'      => $this->_personasContacts['sclever']->getId(),
+        ));
+        
+        $this->_testEventMissingAttendee($pwulfPersonalCal, $pwulf);
+    }
+    
+    /**
+     * testEventMissingAttendeeSharedCalendar
+     * 
+     * validate no attendee is implicitly added for shared calendars
+     */
+    public function testEventMissingAttendeeSharedCalendar()
+    {
+        $this->markTestSkipped('not yet active');
+        $this->_testEventMissingAttendee($this->objects['sharedContainer'], new Calendar_Model_Attender(array(
+                'user_type'    => Calendar_Model_Attender::USERTYPE_USER,
+                'user_id'      => Tinebase_Core::getUser()->contact_id,
+        )), true);
     }
     
     public function testFilterRepeatingException()
@@ -420,6 +483,27 @@ class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
     }
     
     /**
+     * test deleting attachment from existing event
+     */
+    public function testDeleteAttachment()
+    {
+        $_SERVER['HTTP_USER_AGENT'] = 'CalendarStore/5.0 (1127); iCal/5.0 (1535); Mac OS X/10.7.1 (11B26)';
+        
+        $event = $this->createEventWithAttachment(2);
+        
+        // remove agenda.html
+        $clone = clone $event;
+        $attachments = $clone->getRecord()->attachments;
+        $attachments->removeRecord($attachments->filter('name', 'agenda.html')->getFirstRecord());
+        $event->put($clone->get());
+        
+        // assert agenda2.html exists
+        $record = $event->getRecord();
+        $this->assertEquals(1, $record->attachments->count());
+        $this->assertEquals('agenda2.html', $record->attachments->getFirstRecord()->name);
+    }
+    
+    /**
      * test updating existing event
      */
     public function testPutEventFromGenericClient()
@@ -579,13 +663,12 @@ class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
         
         $vcalendar = file_get_contents(dirname(__FILE__) . '/../../Import/files/lightning.ics');
         
-        $currentCU = Calendar_Controller_MSEventFacade::getInstance()->setCalendarUser(new Calendar_Model_Attender(array(
-            'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => 'someoneelse'
-        )));
+        $egt = new Calendar_Controller_EventGrantsTests();
+        $egt->setup();
+        
+        $pwulfPersonalCal = $this->_personasDefaultCals['sclever'];
         $id = Tinebase_Record_Abstract::generateUID();
-        $event = Calendar_Frontend_WebDAV_Event::create($this->objects['sharedContainer'], "$id.ics", $vcalendar);
-        Calendar_Controller_MSEventFacade::getInstance()->setCalendarUser($currentCU);
+        $event = Calendar_Frontend_WebDAV_Event::create($pwulfPersonalCal, "$id.ics", $vcalendar);
         
         $loadedEvent = new Calendar_Frontend_WebDAV_Event($this->objects['sharedContainer'], "$id.ics");
         $ics = stream_get_contents($loadedEvent->get());
@@ -793,7 +876,7 @@ class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
         $exception = Calendar_Model_Rrule::computeNextOccurrence($persistentEvent, $exceptions, new Tinebase_DateTime('20131017T140000'));
         $exception->attendee->addRecord(new Calendar_Model_Attender(array(
             'user_type' => Calendar_Model_Attender::USERTYPE_USER,
-            'user_id'   => $this->_personasContacts['pwulf']->getId(),
+            'user_id'   => $this->_getPersonasContacts('pwulf')->getId(),
         )));
         $persistentException = Calendar_Controller_Event::getInstance()->createRecurException($exception);
         $persistentEvent = Calendar_Controller_Event::getInstance()->get($persistentEvent->getId());
@@ -831,4 +914,29 @@ class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
         $this->assertNotNull($currentUser, 'currentUser not found in attendee');
         $this->assertEquals(Calendar_Model_Attender::STATUS_ACCEPTED, $currentUser->status, print_r($currentUser->toArray(), true));
     }
+    
+    /**
+     * create event with attachment
+     *
+     * @return multitype:Ambigous <Calendar_Frontend_WebDAV_Event, Calendar_Frontend_WebDAV_Event> Ambigous <Tinebase_Model_Tree_Node, Tinebase_Record_Interface, Tinebase_Record_Abstract, NULL, unknown>
+     */
+    public function createEventWithAttachment($count=1)
+    {
+        $event = $this->testCreateRepeatingEvent();
+        
+        for ($i=1; $i<=$count; $i++) {
+            $suffix = $i>1 ? $i : '';
+            
+            $agenda = fopen("php://temp", 'r+');
+            fputs($agenda, "HELLO WORLD$suffix");
+            rewind($agenda);
+        
+            $attachmentController = Tinebase_FileSystem_RecordAttachments::getInstance();
+            $attachmentNode = $attachmentController->addRecordAttachment($event->getRecord(), "agenda{$suffix}.html", $agenda);
+        }
+    
+        $event = new Calendar_Frontend_WebDAV_Event($event->getContainer(), $event->getRecord()->getId());
+    
+        return $event;
+    }
 }
diff --git a/tests/tine20/Calendar/Import/CalDAV/ClientMock.php b/tests/tine20/Calendar/Import/CalDAV/ClientMock.php
new file mode 100644 (file)
index 0000000..497c2e7
--- /dev/null
@@ -0,0 +1,423 @@
+<?php
+/**
+ * Tine 2.0
+ * 
+ * @package     Calendar
+ * @subpackage  Import
+ * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
+ * @author      Philipp Schüle <p.schuele@metaways.de>
+ * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
+ */
+
+/**
+ * Calendar_Import_CalDAV_ClientMock
+ * 
+ * @package     Calendar
+ * @subpackage  Import
+ */
+class Calendar_Import_CalDAV_ClientMock extends Calendar_Import_CalDav_Client
+{
+    /**
+     * needs to be overwritten because of the added flavor (osxical)
+     * 
+     * @var string
+     */
+    const findAllCalendarsRequest = '<?xml version="1.0"?>
+<d:propfind xmlns:d="DAV:">
+  <d:prop>
+    <d:resourcetype/>
+    <d:acl/>
+    <d:displayname/>
+    <x:supported-calendar-component-set xmlns:x="urn:ietf:params:xml:ns:caldav"/>
+  <osxical:calendar-color xmlns:osxical="http://apple.com/ns/ical/"/></d:prop>
+</d:propfind>
+';
+    
+    protected $_currentUserPrincipalResponse = array(
+        '{DAV:}current-user-principal' => '/principals/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/'
+    );
+    
+    protected $_calendarHomeSetResponse =  array (
+        '{urn:ietf:params:xml:ns:caldav}calendar-home-set' => '/calendars/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0',
+    );
+    
+    protected $_calendarICSResponse = array (
+      '/calendars/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar/' => 
+      array (
+      ),
+      '/calendars/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar/20E3E0E4-762D-42D6-A563-206161A9F1CA.ics' => 
+      array (
+      ),
+      '/calendars/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar/4971F93F-8657-412B-841A-A0FD9139CD61.ics' => 
+      array (
+      ),
+      '/calendars/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar/88F077A1-6F5B-4C6C-8D73-94C1F0127492.ics' => 
+      array (
+      ),
+    );
+    
+    protected $_serverEvents = array();
+    
+    public function __construct(array $a, $flavor)
+    {
+        parent::__construct($a, $flavor);
+        
+        $this->_serverEvents = array(
+            '/calendars/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar/20E3E0E4-762D-42D6-A563-206161A9F1CA.ics' =>
+                array (
+                    self::calendarDataKey => 'BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Apple Inc.//iCal 5.0.3//EN
+CALSCALE:GREGORIAN
+BEGIN:VTIMEZONE
+TZID:Europe/Berlin
+BEGIN:DAYLIGHT
+TZOFFSETFROM:+0100
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
+DTSTART:19810329T020000
+TZNAME:CEST
+TZOFFSETTO:+0200
+END:DAYLIGHT
+BEGIN:STANDARD
+TZOFFSETFROM:+0200
+RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
+DTSTART:19961027T030000
+TZNAME:CET
+TZOFFSETTO:+0100
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+CREATED:20140602T131852Z
+UID:20E3E0E4-762D-42D6-A563-206161A9F1CA
+DTEND;TZID=Europe/Berlin:20140604T171500
+TRANSP:OPAQUE
+SUMMARY:TEST06
+DTSTART;TZID=Europe/Berlin:20140604T161500
+DTSTAMP:20140602T131935Z
+SEQUENCE:3
+END:VEVENT
+END:VCALENDAR',
+                    '{DAV:}getetag' => '"bcc36c611f0b60bfee64b4d42e44aa1d"',
+                ),
+                '/calendars/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar/4971F93F-8657-412B-841A-A0FD9139CD61.ics' =>
+                array (
+                    self::calendarDataKey => 'BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Apple Inc.//iCal 5.0.3//EN
+CALSCALE:GREGORIAN
+BEGIN:VTIMEZONE
+TZID:Europe/Berlin
+BEGIN:DAYLIGHT
+TZOFFSETFROM:+0100
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
+DTSTART:19810329T020000
+TZNAME:CEST
+TZOFFSETTO:+0200
+END:DAYLIGHT
+BEGIN:STANDARD
+TZOFFSETFROM:+0200
+RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
+DTSTART:19961027T030000
+TZNAME:CET
+TZOFFSETTO:+0100
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+CREATED:20140602T131707Z
+UID:4971F93F-8657-412B-841A-A0FD9139CD61
+DTEND;TZID=Europe/Berlin:20140604T153000
+TRANSP:OPAQUE
+SUMMARY:TEST05
+DTSTART;TZID=Europe/Berlin:20140604T143000
+DTSTAMP:20140602T131725Z
+SEQUENCE:3
+END:VEVENT
+END:VCALENDAR',
+                    '{DAV:}getetag' => '"8b89914690ad7290fa9a2dc1da490489"',
+                ),
+                '/calendars/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar/88F077A1-6F5B-4C6C-8D73-94C1F0127492.ics' =>
+                array (
+                    self::calendarDataKey => 'BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Apple Inc.//iCal 5.0.1//EN
+CALSCALE:GREGORIAN
+BEGIN:VTIMEZONE
+TZID:Europe/Berlin
+BEGIN:DAYLIGHT
+TZOFFSETFROM:+0100
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
+DTSTART:19810329T020000
+TZNAME:CEST
+TZOFFSETTO:+0200
+END:DAYLIGHT
+BEGIN:STANDARD
+TZOFFSETFROM:+0200
+RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
+DTSTART:19961027T030000
+TZNAME:CET
+TZOFFSETTO:+0100
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+CREATED:20111207T143455Z
+UID:88F077A1-6F5B-4C6C-8D73-94C1F0127492
+DTEND;TZID=Europe/Berlin:20111207T170000
+TRANSP:OPAQUE
+SUMMARY:test
+DTSTART;TZID=Europe/Berlin:20111207T160000
+DTSTAMP:20111207T143502Z
+SEQUENCE:2
+END:VEVENT
+END:VCALENDAR
+',
+                    '{DAV:}getetag' => '"0b3621a20e9045d8679075db57e881dd"',
+                ),
+        );
+    }
+        
+    protected function _findAllCalendarsResponse()
+    {
+        return array (
+          '/calendars/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/' => 
+               array(
+                  '{DAV:}resourcetype' => new Sabre\DAV\Property\ResourceType(array('{DAV:}collection')),
+                  '{DAV:}acl' => new Sabre\DAVACL\Property\Acl(array(
+                    array (
+                      'principal' => '/principals/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/',
+                      'protected' => true,
+                      'privilege' => '{DAV:}all',
+                    ),
+                    array (
+                      'principal' => '{DAV:}authenticated',
+                      'protected' => false,
+                      'privilege' => '{urn:ietf:params:xml:ns:caldav}read-free-busy',
+                    ),
+                    array (
+                      'principal' => '/principals/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar-proxy-read/',
+                      'protected' => true,
+                      'privilege' => '{DAV:}read',
+                    ),
+                    array (
+                      'principal' => '/principals/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar-proxy-read/',
+                      'protected' => true,
+                      'privilege' => '{DAV:}read-current-user-privilege-set',
+                    ),
+                    array (
+                      'principal' => '/principals/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar-proxy-write/',
+                      'protected' => true,
+                      'privilege' => '{DAV:}read',
+                    ),
+                    array (
+                      'principal' => '/principals/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar-proxy-write/',
+                      'protected' => true,
+                      'privilege' => '{DAV:}read-current-user-privilege-set',
+                    ),
+                    array (
+                      'principal' => '/principals/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar-proxy-write/',
+                      'protected' => true,
+                      'privilege' => '{DAV:}write',
+                    ),
+                )),
+                '{DAV:}displayname' => 'User1 Test',
+                '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new
+                    Sabre\CalDAV\Property\SupportedCalendarComponentSet(array(
+                        0 => 'VEVENT',
+                        1 => 'VTODO',
+                        2 => 'VTIMEZONE',
+                        3 => 'VJOURNAL',
+                        4 => 'VFREEBUSY',
+                    )),
+               ),
+            '/calendars/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar/' =>
+            array (
+                '{DAV:}resourcetype' =>
+                new Sabre\DAV\Property\ResourceType(array(
+                    0 => '{DAV:}collection',
+                    1 => '{urn:ietf:params:xml:ns:caldav}calendar',
+                )),
+                '{DAV:}acl' =>
+                new Sabre\DAVACL\Property\Acl(array(
+                    array (
+                        'principal' => '/principals/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/',
+                        'protected' => true,
+                        'privilege' => '{DAV:}all',
+                    ),
+                    array (
+                        'principal' => '{DAV:}authenticated',
+                        'protected' => false,
+                        'privilege' => '{urn:ietf:params:xml:ns:caldav}read-free-busy',
+                    ),
+                    array (
+                        'principal' => '/principals/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar-proxy-read/',
+                        'protected' => true,
+                        'privilege' => '{DAV:}read',
+                    ),
+                    array (
+                        'principal' => '/principals/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar-proxy-read/',
+                        'protected' => true,
+                        'privilege' => '{DAV:}read-current-user-privilege-set',
+                    ),
+                    array (
+                        'principal' => '/principals/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar-proxy-write/',
+                        'protected' => true,
+                        'privilege' => '{DAV:}read',
+                    ),
+                    array (
+                        'principal' => '/principals/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar-proxy-write/',
+                        'protected' => true,
+                        'privilege' => '{DAV:}read-current-user-privilege-set',
+                    ),
+                    array (
+                        'principal' => '/principals/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar-proxy-write/',
+                        'protected' => true,
+                        'privilege' => '{DAV:}write',
+                    ),
+                )),
+                '{DAV:}displayname' => 'calendar',
+                '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' =>
+                new Sabre\CalDAV\Property\SupportedCalendarComponentSet(array(
+                    0 => 'VEVENT',
+                    1 => 'VTODO',
+                    2 => 'VTIMEZONE',
+                    3 => 'VJOURNAL',
+                    4 => 'VFREEBUSY',
+                )),
+                '{http://apple.com/ns/ical/}calendar-color' => '#711A76FF',
+            ),
+            );
+    }
+    
+    protected function _resolvePrincipalResponse()
+    {
+        return array (
+          '{DAV:}group-member-set' => 
+          new Tinebase_Import_CalDav_GroupMemberSet(array(
+          )),
+          '{DAV:}displayname' => 'calendar-proxy-write',
+        );
+    }
+    
+    /**
+     * calendar data response
+     * 
+     * @return string
+     */
+    protected function _calendarDataResponse()
+    {
+        return $this->_serverEvents;
+    }
+    
+    protected function _calendarEtagResponse()
+    {
+        $etags = array();
+        foreach($this->_serverEvents as $ics => $data) {
+            $etags[$ics] = array(
+                '{DAV:}getetag' => $data['{DAV:}getetag']
+            );
+        }
+        return $etags;
+    }
+    
+    /**
+     * update 1 event, delete one event, add one event
+     */
+    public function updateServerEvents()
+    {
+        // update
+        $ics = '/calendars/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar/88F077A1-6F5B-4C6C-8D73-94C1F0127492.ics';
+        
+        $this->_serverEvents[$ics]['{DAV:}getetag'] =
+            '"aa3621a20e9045d8679075db57e881dd"';
+        
+        $this->_serverEvents[$ics][self::calendarDataKey] = str_replace(array(
+            'SEQUENCE:2',
+           'SUMMARY:test'
+        ), array(
+            'SEQUENCE:3',
+            'SUMMARY:test update'
+        ), $this->_serverEvents[$ics][self::calendarDataKey]);
+        
+        // delete
+        unset($this->_serverEvents['/calendars/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar/4971F93F-8657-412B-841A-A0FD9139CD61.ics']);
+        
+        // add
+        $this->_serverEvents['/calendars/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar/3331F93F-8657-412B-841A-A0FD9139CD61.ics'] =
+        array (
+            self::calendarDataKey => 'BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Apple Inc.//iCal 5.0.3//EN
+CALSCALE:GREGORIAN
+BEGIN:VTIMEZONE
+TZID:Europe/Berlin
+BEGIN:DAYLIGHT
+TZOFFSETFROM:+0100
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
+DTSTART:19810329T020000
+TZNAME:CEST
+TZOFFSETTO:+0200
+END:DAYLIGHT
+BEGIN:STANDARD
+TZOFFSETFROM:+0200
+RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
+DTSTART:19961027T030000
+TZNAME:CET
+TZOFFSETTO:+0100
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+CREATED:20140602T131707Z
+UID:3331F93F-8657-412B-841A-A0FD9139CD61
+DTEND;TZID=Europe/Berlin:20140804T153000
+TRANSP:OPAQUE
+SUMMARY:new event
+DTSTART;TZID=Europe/Berlin:20140804T143000
+DTSTAMP:20140602T131725Z
+SEQUENCE:1
+END:VEVENT
+END:VCALENDAR',
+            '{DAV:}getetag' => '"3333914690ad7290fa9a2dc1da490489"',
+        );
+    }
+    
+    /**
+     * perform mocked calDavRequest
+     *
+     * @param string $method
+     * @param string $uri
+     * @param strubg $body
+     * @param number $depth
+     * @param number $tries
+     * @param number $sleep
+     * @throws Tinebase_Exception
+     */
+    public function calDavRequest($method, $uri, $body, $depth = 0, $tries = 10, $sleep = 30)
+    {
+        if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__
+                 . ' Sending ' . $method . ' request for uri ' . $uri . ': ' . $body);
+        
+        if ($body == self::findCurrentUserPrincipalRequest) {
+            return $this->_currentUserPrincipalResponse;
+            
+        } else if ($body == self::findCalendarHomeSetRequest) {
+            return $this->_calendarHomeSetResponse;
+            
+        } else if ($body == self::findAllCalendarsRequest) {
+            return $this->_findAllCalendarsResponse();
+            
+        } else if ($body == self::resolvePrincipalRequest) {
+            return $this->_resolvePrincipalResponse();
+            
+        } else if ($body == self::findAllCalendarICSsRequest) {
+            return $this->_calendarICSResponse;
+            
+        } else if (preg_match('/<b:calendar-data \/>/', $body)) {
+            return $this->_calendarDataResponse();
+            
+        } else if (preg_match('/<a:getetag \/>/', $body)) {
+            return $this->_calendarEtagResponse();
+            
+        } else {
+            throw new Tinebase_Exception_InvalidArgument('request not supported by mock');
+        }
+    }
+}
diff --git a/tests/tine20/Calendar/Import/CalDAVTest.php b/tests/tine20/Calendar/Import/CalDAVTest.php
new file mode 100644 (file)
index 0000000..f36196e
--- /dev/null
@@ -0,0 +1,126 @@
+<?php
+/**
+ * Tine 2.0 - http://www.tine20.org
+ * 
+ * @package     Calendar
+ * @license     http://www.gnu.org/licenses/agpl.html
+ * @copyright   Copyright (c) 2014 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @author      Philipp Schüle <p.schuele@metaways.de>
+ * 
+ */
+
+/**
+ * Test class for Calendar_Import_CalDAV
+ */
+class Calendar_Import_CalDAVTest extends Calendar_TestCase
+{
+    /**
+     * unit in test
+     *
+     * @var Calendar_Import_CalDAV_ClientMock
+     */
+    protected $_uit = null;
+    
+    /**
+     * lazy init of uit
+     *
+     * @return Calendar_Import_CalDAV_ClientMock
+     */
+    protected function _getUit()
+    {
+        if ($this->_uit === null) {
+            $caldavClientOptions = array(
+                'baseUri' => 'localhost',
+                'userName' => Tinebase_Core::getUser()->accountLoginName,
+                'password' => Zend_Registry::get('testConfig')->password, // TODO use credential cache?
+            );
+            $this->_uit = new Calendar_Import_CalDAV_ClientMock($caldavClientOptions, 'MacOSX');
+            $this->_uit->setVerifyPeer(false);
+        }
+        
+        return $this->_uit;
+    }
+    
+    /**
+     * test import of a single container/calendar of current user
+     */
+    public function testImportCalendars()
+    {
+        $this->_getUit()->importAllCalendars();
+        
+        $importedCalendar = $this->_getImportCalendar();
+        
+        $this->assertEquals('calendar', $importedCalendar->name);
+        $this->assertEquals('#711A76', $importedCalendar->color);
+        $this->assertEquals('Calendar_Model_Event', $importedCalendar->model, print_r($importedCalendar->toArray(), true));
+        $this->assertEquals( Tinebase_Core::getUser()->getId(), $importedCalendar->owner_id, print_r($importedCalendar->toArray(), true));
+    }
+    
+    /**
+     * fetch import calendar
+     * 
+     * @return Tinebase_Model_Container
+     */
+    protected function _getImportCalendar()
+    {
+        $calendarUuid = sha1('/calendars/__uids__/0AA03A3B-F7B6-459A-AB3E-4726E53637D0/calendar/');
+        return Tinebase_Container::getInstance()->getByProperty($calendarUuid, 'uuid');
+    }
+    
+    /**
+     * test import of events
+     */
+    public function testImportEvents()
+    {
+        $this->testImportCalendars();
+        $this->_getUit()->importAllCalendarData();
+        
+        $importedCalendar = $this->_getImportCalendar();
+        
+        $events = Calendar_Controller_Event::getInstance()->search(new Calendar_Model_EventFilter(array(
+            array('field' => 'container_id', 'operator' => 'in', 'value' => array($importedCalendar->getId()))
+        )));
+        $this->assertEquals(3, count($events));
+        $this->assertTrue(array(
+            '"bcc36c611f0b60bfee64b4d42e44aa1d"',
+            '"8b89914690ad7290fa9a2dc1da490489"',
+            '"0b3621a20e9045d8679075db57e881dd"'
+        ) == $events->etag);
+    }
+    
+    /**
+     * test update of events
+     */
+    public function testUpdateEvents()
+    {
+        $this->testImportEvents();
+        
+        $importedCalendar = $this->_getImportCalendar();
+        
+        $tine20Event = $this->_getEvent();
+        $tine20Event->container_id = $importedCalendar->getId();
+        Calendar_Controller_Event::getInstance()->create($tine20Event);
+        
+        $this->_getUit()->updateServerEvents();
+        
+        $this->_getUit()->updateAllCalendarData();
+
+        $events = Calendar_Controller_Event::getInstance()->search(new Calendar_Model_EventFilter(array(
+            array('field' => 'container_id', 'operator' => 'in', 'value' => array($importedCalendar->getId()))
+        )));
+        $this->assertEquals(4, count($events));
+        $expectedEtags = array(
+            '"bcc36c611f0b60bfee64b4d42e44aa1d"', // unchanged
+            '"3333914690ad7290fa9a2dc1da490489"', // added on server
+            '"aa3621a20e9045d8679075db57e881dd"', // updated
+            null,                                 // added on client (tine20)
+        );
+        sort($expectedEtags);
+        $currentEtags = $events->etag;
+        sort($currentEtags);
+        $this->assertEquals($expectedEtags, $currentEtags, 'etag mismatch');
+        
+        $updatedEvent = $events->filter('etag', '"aa3621a20e9045d8679075db57e881dd"')->getFirstRecord();
+        $this->assertEquals('test update', $updatedEvent->summary);
+    }
+}
index 72ed88d..2069ea1 100644 (file)
@@ -20,14 +20,14 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
     public function testImportSimpleFromString()
     {
         $importer = new Calendar_Import_Ical(array(
-            'importContainerId' => $this->_testCalendar->getId(),
+            'importContainerId' => $this->_getTestCalendar()->getId(),
         ));
 
         $icalData = file_get_contents(dirname(__FILE__) . '/files/simple.ics');
         $importer->importData($icalData);
         
         $events = Calendar_Controller_Event::getInstance()->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId())
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId())
         )), NULL);
         
         $this->assertEquals(6, $events->count(), 'events was not imported');
@@ -40,12 +40,12 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
     public function testImportSimpleFromFile()
     {
         $importer = new Calendar_Import_Ical(array(
-            'importContainerId' => $this->_testCalendar->getId(),
+            'importContainerId' => $this->_getTestCalendar()->getId(),
         ));
         
         $importer->importFile(dirname(__FILE__) . '/files/simple.ics');
         $events = Calendar_Controller_Event::getInstance()->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId())
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId())
         )), NULL);
         
         $this->assertEquals(6, $events->count(), 'events where not imported');
@@ -58,13 +58,13 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
     public function testImportRecur()
     {
         $importer = new Calendar_Import_Ical(array(
-            'importContainerId' => $this->_testCalendar->getId(),
+            'importContainerId' => $this->_getTestCalendar()->getId(),
         ));
         
         $importer->importFile(dirname(__FILE__) . '/files/XMAS_DE.ics');
         
         $events = Calendar_Controller_Event::getInstance()->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'period', 'operator' => 'within', 'value' => array(
                 'from'  => '2015-12-23 22:00:00',
                 'until' => '2015-12-26 22:00:00'
@@ -77,7 +77,7 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
     public function testImportHorde()
     {
         $importer = new Calendar_Import_Ical(array(
-            'importContainerId' => $this->_testCalendar->getId(),
+            'importContainerId' => $this->_getTestCalendar()->getId(),
         ));
         
         $importer->importFile(dirname(__FILE__) . '/files/horde.ics');
@@ -93,7 +93,7 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
     protected function _checkImport($failMessage = '', $assertNumber = 1)
     {
         $events = Calendar_Controller_Event::getInstance()->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId())
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId())
         )), NULL);
         
         $this->assertEquals($assertNumber, $events->count(), 'events where not imported ' . $failMessage);
@@ -105,7 +105,7 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
     public function testImportHordeBroken()
     {
         $importer = new Calendar_Import_Ical(array(
-            'importContainerId' => $this->_testCalendar->getId(),
+            'importContainerId' => $this->_getTestCalendar()->getId(),
         ));
         
         try {
@@ -119,12 +119,12 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
     public function testImportOutlook12()
     {
         $importer = new Calendar_Import_Ical(array(
-            'importContainerId' => $this->_testCalendar->getId(),
+            'importContainerId' => $this->_getTestCalendar()->getId(),
         ));
         
         $importer->importFile(dirname(__FILE__) . '/files/outlook12.ics');
         $events = Calendar_Controller_Event::getInstance()->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId())
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId())
         )), NULL);
         
         $this->assertEquals(1, $events->count(), 'events where not imported');
@@ -140,7 +140,7 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
         $this->_testNeedsTransaction();
         
         $cmd = realpath(__DIR__ . "/../../../../tine20/tine20.php") . ' --method Calendar.import ' .
-            'plugin=Calendar_Import_Ical importContainerId=' . $this->_testCalendar->getId() .
+            'plugin=Calendar_Import_Ical importContainerId=' . $this->_getTestCalendar()->getId() .
             ' ' . dirname(__FILE__) . '/files/horde.ics';
         
         $cmd = TestServer::assembleCliCommand($cmd, TRUE);
@@ -160,7 +160,7 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
         $this->_testNeedsTransaction();
         
         $cmd = realpath(__DIR__ . "/../../../../tine20/tine20.php") . ' --method Calendar.import ' .
-            'plugin=Calendar_Import_Ical forceUpdateExisting=1 importContainerId=' . $this->_testCalendar->getId() .
+            'plugin=Calendar_Import_Ical forceUpdateExisting=1 importContainerId=' . $this->_getTestCalendar()->getId() .
             ' ' . dirname(__FILE__) . '/files/termine.ics';
         
         $cmd = TestServer::assembleCliCommand($cmd, TRUE);
@@ -183,7 +183,7 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
     public function testImportRruleNormalize()
     {
         $importer = new Calendar_Import_Ical(array(
-            'importContainerId' => $this->_testCalendar->getId(),
+            'importContainerId' => $this->_getTestCalendar()->getId(),
         ));
         
         $importer->importFile(dirname(__FILE__) . '/files/ni-zsk.ics');
@@ -192,7 +192,7 @@ class Calendar_Import_ICalTest extends Calendar_TestCase
         $from = new Tinebase_DateTime('2014-04-23 22:00:00');
         $until = new Tinebase_DateTime('2014-05-23 22:00:00');
         $events = Calendar_Controller_Event::getInstance()->search(new Calendar_Model_EventFilter(array(
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
             array('field' => 'period', 'operator' => 'within', 'value' => array(
                 'from'  => $from->toString(),
                 'until' => $until->toString()
index fe03c7b..ac29a22 100644 (file)
@@ -32,6 +32,8 @@ SEQUENCE:4
 END:VEVENT
 BEGIN:VEVENT
 CREATED:20111109T144059Z
+ATTENDEE;CN="Clever, Susan";CUTYPE=INDIVIDUAL;EMAIL="sclever@tine20.org"
+ ;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT:mailto:sclever@tine20.org
 UID:552866D2-6C3C-4AB0-893C-F9F0F5764880
 DTEND;TZID=Europe/Berlin:20111111T113000
 TRANSP:OPAQUE
diff --git a/tests/tine20/Calendar/Import/files/attender_empty_name.ics b/tests/tine20/Calendar/Import/files/attender_empty_name.ics
new file mode 100644 (file)
index 0000000..d6e9561
--- /dev/null
@@ -0,0 +1,47 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iCal 4.0.4//EN
+BEGIN:VTIMEZONE
+TZID:Europe/Berlin
+BEGIN:STANDARD
+DTSTART:19961027T030000
+RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
+TZNAME:GMT+01:00
+TZOFFSETFROM:+0200
+TZOFFSETTO:+0100
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:19810329T020000
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
+TZNAME:GMT+02:00
+TZOFFSETFROM:+0100
+TZOFFSETTO:+0200
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:1D35281C-A4A2-4654-A66B-F1CEF13C5BAF
+DTSTART;TZID=Europe/Berlin:20101214T150000
+DTEND;TZID=Europe/Berlin:20101214T160000
+ATTENDEE;CN=;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT;
+ RSVP=TRUE:MAILTO:kai@axelhuepfer.de
+ATTENDEE;CN=hansii.fleche@axelhuepferxxas.de<bambi.rentz@axelhuepferxxas.d
+ e>;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT;RSVP=TRUE:
+ mailto:hansii.fleche@axelhuepferxxas.de%3Cbambi.rentz@axelhuepferxxas.de%3
+ E
+CLASS:PUBLIC
+CREATED:20101210T105440Z
+DESCRIPTION:Zeit: Dienstag\, 14. Dezember 2010 15:00-16:00. (UTC+01:00) Am
+ sterdam\, Berlin\, Bern\, Rom\, Stockholm\, Wien\nOrt: Büro RL\n\n*~*~*~*
+ ~*~*~*~*~*~*\n\n\n
+DTSTAMP:20101210T105347Z
+LOCATION:Büro RL
+ORGANIZER;CN=;SCHEDULE-AGENT=CLIENT;SCHEDULE-STATUS=5.3:MAILTO:rassmatazzz
+ nn@axelhuepper.de
+SEQUENCE:1
+STATUS:CONFIRMED
+SUMMARY:Telko axel
+TRANSP:OPAQUE
+X-APPLE-NEEDS-REPLY:TRUE
+END:VEVENT
+END:VCALENDAR
diff --git a/tests/tine20/Calendar/Import/files/empty_categories.ics b/tests/tine20/Calendar/Import/files/empty_categories.ics
new file mode 100644 (file)
index 0000000..2e74c95
--- /dev/null
@@ -0,0 +1,19 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Apple Inc.//Mac OS X 10.9.3//EN
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+TRANSP:OPAQUE
+DTEND:20141018T201000Z
+PRIORITY:5
+UID:abcdefg@swiss.com
+LOCATION:Zurich
+DTSTAMP:20141018T184500Z
+DESCRIPTION:Alle angegebenen Zeiten sind Lokalzeiten am Abflugort
+SEQUENCE:0
+CLASS:PRIVATE
+CATEGORIES: 
+SUMMARY:Flug nach Hamburg
+DTSTART:20141018T184500Z
+END:VEVENT
+END:VCALENDAR
diff --git a/tests/tine20/Calendar/Import/files/invalid_utf8.ics b/tests/tine20/Calendar/Import/files/invalid_utf8.ics
new file mode 100644 (file)
index 0000000..976bba4
--- /dev/null
@@ -0,0 +1,33 @@
+BEGIN:VCALENDAR
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iOS 5.0.1//EN
+VERSION:2.0
+BEGIN:VTIMEZONE
+TZID:Europe/Berlin
+BEGIN:DAYLIGHT
+DTSTART:19810329T020000
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
+TZNAME:CEST
+TZOFFSETFROM:+0100
+TZOFFSETTO:+0200
+END:DAYLIGHT
+BEGIN:STANDARD
+DTSTART:19961027T030000
+RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
+TZNAME:CET
+TZOFFSETFROM:+0200
+TZOFFSETTO:+0100
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+CREATED:20120322T111346Z
+DTEND;TZID=Europe/Berlin:20120527T140000
+DTSTAMP:20120323T092243Z
+DTSTART;TZID=Europe/Berlin:20120527T130000
+LAST-MODIFIED:20120322T111346Z
+SEQUENCE:0
+SUMMARY:🐎Hoppegarten Day
+TRANSP:OPAQUE
+UID:05D94964-F0A9-47B0-9433-D5E12EB140FA
+END:VEVENT
+END:VCALENDAR
diff --git a/tests/tine20/Calendar/Import/files/iphone_longlocation.ics b/tests/tine20/Calendar/Import/files/iphone_longlocation.ics
new file mode 100644 (file)
index 0000000..b2ba7c0
--- /dev/null
@@ -0,0 +1,35 @@
+BEGIN:VCALENDAR
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iCal 3.0m//EN
+VERSION:2.0
+BEGIN:VTIMEZONE
+TZID:Europe/Berlin
+BEGIN:DAYLIGHT
+DTSTART:19810329T020000
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
+TZNAME:CEST
+TZOFFSETFROM:+0100
+TZOFFSETTO:+0200
+END:DAYLIGHT
+BEGIN:STANDARD
+DTSTART:19961027T030000
+RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
+TZNAME:CET
+TZOFFSETFROM:+0200
+TZOFFSETTO:+0100
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+DTEND;TZID=Europe/Berlin:20111020T100000
+DTSTAMP:20111020T064721Z
+DTSTART;TZID=Europe/Berlin:20111020T090000
+LOCATION:1. Rufen Sie folgende Seite auf: https://xxxxxxxxxxxxxx.webex.
+ xxxxxxxxxxxxxxxxxxx/j.php?ED=180021367&UID=1242xxxxxx&PW=xxxxxxxxxxxxxxx
+ T=OCMyMg%3D%3D\; 2. Falls erforderlich\; 3. Falls ein Passwort erforderl
+ ich ist\; 4. Klicken Sie auf "Teilnehmen".\; geben Sie bitte Ihren Namen
+  und Ihre E-Mail-Adresse ein.\; geben Sie das Meeting-Passwort ein: xxxx
+SEQUENCE:0
+SUMMARY:Finanz-IT anrufen
+UID:631C01AB-0FE0-4E37-B774-56F05DDAD1E6
+END:VEVENT
+END:VCALENDAR
\ No newline at end of file
diff --git a/tests/tine20/Calendar/Import/files/iphone_longsummary.ics b/tests/tine20/Calendar/Import/files/iphone_longsummary.ics
new file mode 100644 (file)
index 0000000..4866799
--- /dev/null
@@ -0,0 +1,39 @@
+BEGIN:VCALENDAR
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iCal 3.0m//EN
+VERSION:2.0
+BEGIN:VTIMEZONE
+TZID:Europe/Berlin
+BEGIN:DAYLIGHT
+DTSTART:19810329T020000
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
+TZNAME:CEST
+TZOFFSETFROM:+0100
+TZOFFSETTO:+0200
+END:DAYLIGHT
+BEGIN:STANDARD
+DTSTART:19961027T030000
+RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
+TZNAME:CET
+TZOFFSETFROM:+0200
+TZOFFSETTO:+0100
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+DTEND;TZID=Europe/Berlin:20111020T100000
+DTSTAMP:20111020T064721Z
+DTSTART;TZID=Europe/Berlin:20111020T090000
+LOCATION:Ortrud
+SEQUENCE:0
+SUMMARY:Finanz-IT anrufen\, xxxxxxxxxxxh\nFestgelegt für 25. Juli 2012\nH
+ allo xxxxxx\,\n\nHerr xxxxxxxxxxxhvon der F-I hatte mich heute versucht 
+ zu erreichen\, leider habe ich ihn jetzt verpasst. Kannst du versuchen I
+ hn diese Woche noch anzurufen?\n\nWie es aussieht möchte er jetzt doch n
+ och mal über die Abschlagszahlungen handeln. Aussage auf der Mailbox war
+  das er die Datierung und die Summe klären möchte.\nIch befürchte das xx
+ x und xxx soweit noch nicht sind und deshalb die Bitte an dich\, bevor w
+ ieder was falsch läuft.\n\nVertraglich haben wir Zahlung in zwei Summen 
+ (Halbjahr) immer im Voraus vereinbart.\nBezahlt haben sie letztes mal xx
+UID:631C01AB-0FE0-4E37-B774-56F05DDAD1E6
+END:VEVENT
+END:VCALENDAR
diff --git a/tests/tine20/Calendar/Import/files/outlook_bysetpos.ics b/tests/tine20/Calendar/Import/files/outlook_bysetpos.ics
new file mode 100644 (file)
index 0000000..bf3472e
--- /dev/null
@@ -0,0 +1,30 @@
+BEGIN:VCALENDAR
+PRODID:-//Microsoft Corporation//Outlook 12.0 MIMEDIR//EN
+VERSION:2.0
+METHOD:PUBLISH
+X-MS-OLK-FORCEINSPECTOROPEN:TRUE
+BEGIN:VEVENT
+CLASS:PUBLIC
+CREATED:20111019T073153Z
+DTSTART:20131027T030000
+DTEND:20131027T050000
+LAST-MODIFIED:20111019T073153Z
+PRIORITY:5
+SEQUENCE:0
+RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYSETPOS=1;BYDAY=MO,TU,WE,TH,FR
+SUMMARY;LANGUAGE=de:summary
+TRANSP:TRANSPARENT
+UID:040000008200E00074C5B7101A82E0080000000000465FCFA940CC01000000000000000
+    010000000D581BE011ABF35418FBE154EDCEA07A7
+X-ALT-DESC;FMTTYPE=text/html:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//E
+    N">\n<HTML>\n<HEAD>\n<META NAME="Generator" CONTENT="MS Exchange Server ve
+    rsion 08.00.0681.000">\n<TITLE></TITLE>\n</HEAD>\n<BODY>\n<!-- Converted f
+    rom text/rtf format -->\n\n<P DIR=LTR><SPAN LANG="de"></SPAN></P>\n\n</BOD
+    Y>\n</HTML>
+X-MICROSOFT-CDO-BUSYSTATUS:FREE
+X-MICROSOFT-CDO-IMPORTANCE:1
+X-MICROSOFT-DISALLOW-COUNTER:FALSE
+X-MS-OLK-ALLOWEXTERNCHECK:TRUE
+X-MS-OLK-CONFTYPE:0
+END:VEVENT
+END:VCALENDAR
\ No newline at end of file
diff --git a/tests/tine20/Calendar/Import/files/rrule_until_at_dtstart_allday.ics b/tests/tine20/Calendar/Import/files/rrule_until_at_dtstart_allday.ics
new file mode 100644 (file)
index 0000000..c521f7d
--- /dev/null
@@ -0,0 +1,54 @@
+BEGIN:VCALENDAR
+PRODID:-//BusyMac LLC//BusyCal 2.5.4//DE
+VERSION:2.0
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+DTSTART;VALUE=DATE:20130715
+DTEND;VALUE=DATE:20130716
+RRULE:FREQ=YEARLY;UNTIL=20130715
+SUMMARY:Geburtstage
+UID:3616ED6A-E30F-4125-8213-9BA7A5730192
+SEQUENCE:0
+DTSTAMP:20140521T063241Z
+CREATED:20110704T155641Z
+TRANSP:TRANSPARENT
+LAST-MODIFIED:20140521T063213Z
+X-BUSYMAC-LASTMODBY:jeanette
+BEGIN:VALARM
+UID:D62E454A-F678-425C-AAAA-5A616D3C3365
+ACKNOWLEDGED:20130714T091142Z
+X-APPLE-DEFAULT-ALARM:TRUE
+TRIGGER;VALUE=DURATION:-PT15H
+ACTION:AUDIO
+ATTACH;VALUE=URI:Basso
+END:VALARM
+END:VEVENT
+BEGIN:VEVENT
+DTSTART;VALUE=DATE:20130715
+DTEND;VALUE=DATE:20130716
+SUMMARY:Geburtstage
+UID:3616ED6A-E30F-4125-8213-9BA7A5730192
+SEQUENCE:0
+DTSTAMP:20140521T063241Z
+RECURRENCE-ID;VALUE=DATE:20130715
+CREATED:20110704T155641Z
+TRANSP:TRANSPARENT
+LAST-MODIFIED:20130714T095219Z
+BEGIN:VALARM
+UID:CB33677C-22E5-49C8-AC54-317BF2A4EEA9
+ACKNOWLEDGED:20130714T091142Z
+X-APPLE-DEFAULT-ALARM:TRUE
+TRIGGER;VALUE=DURATION:-PT15H
+ACTION:AUDIO
+ATTACH;VALUE=URI:Basso
+END:VALARM
+BEGIN:VALARM
+UID:EB516FEB-A6DD-438E-BF61-E07E0357207B
+RELATED-TO;RELTYPE=SNOOZE:CB33677C-22E5-49C8-AC54-317BF2A4EEA9
+ACKNOWLEDGED:20130714T095219Z
+TRIGGER;VALUE=DATE-TIME:20130714T092642Z
+ACTION:AUDIO
+ATTACH;VALUE=URI:Basso
+END:VALARM
+END:VEVENT
+END:VCALENDAR
diff --git a/tests/tine20/Calendar/Import/files/utf8mb4_summary.ics b/tests/tine20/Calendar/Import/files/utf8mb4_summary.ics
new file mode 100644 (file)
index 0000000..fdf9ff2
--- /dev/null
@@ -0,0 +1,70 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Apple Inc.//iCal 5.0.3//EN
+CALSCALE:GREGORIAN
+BEGIN:VTIMEZONE
+TZID:Europe/Berlin
+BEGIN:DAYLIGHT
+TZOFFSETFROM:+0100
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
+DTSTART:19810329T020000
+TZNAME:CEST
+TZOFFSETTO:+0200
+END:DAYLIGHT
+BEGIN:STANDARD
+TZOFFSETFROM:+0200
+RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
+DTSTART:19961027T030000
+TZNAME:CET
+TZOFFSETTO:+0100
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+DTSTART;TZID=Europe/Berlin:20131126T090000
+DTEND;TZID=Europe/Berlin:20131126T120000
+TRANSP:OPAQUE
+UID:86311155-2891-4AEF-9D99-3D47418FF709
+DTSTAMP:20131122T100127Z
+X-BUSYMAC-LASTMODBY:jeanette
+SEQUENCE:6
+SUMMARY:Mail an Frau LaLiLoLu ging am 4.11 raus\, dass du später zur Ral
+ f Sitzung kommst (joda) RALF-Sitzung (bleibt trotz Ausfall des Frühstück
+ s - laut telefonischer Info von Frau LaLiLoLu am 25.10 (joda) Themen:   
+                                   1. Begrüßung und Eröffnung\n1.1 Begru
+ ̈ßung der Gäste\n1.2 Feststellung der Anwesenheit\n1.3 Eingaben zu TOP 1
+ 2                  Verschiedenes (Zeit: 10 Minuten\, Person: Sandra Sull
+ e)                                 2. Protokoll der letzten Sitzung (Zei
+ t: 5 Minuten\, Ziel: Genehmigung)                         3. Geschlossen
+ e Unterbringung\,\nEingabe vom PPK-Landesverband\nBayern\n(Zeit: nach Be
+ darf\, Ziel: Information Diskussion\, Person: Sandra Poliz)             
+                          4. Vorläufige Festlegung des\nWirtschaftsplanes
+ \n(30 Minuten\, Ziel: Information Festlegung\, Person: Präsidium) 5. Ein
+ gaben aus der Sitzung vom 23.09.2013\n5.1 \n->Lokale Mitgliedschaften fu
+ ̈r\nKita-Träger (Zeit: 20 Minuten\, Ziel: Information\, Person: Präsidiu
+ m)\n5.2 ->RahmenverträgePPK-Landesverband\nNordrhein-Westfalen (Zeit: 5 
+ Minuten\, Ziel: Information\, Person: Paul Haustie\nZoschke)           
+                           6. Vorbereitung von Veranstaltungen\n6.1 ->Del
+ egiertenversammlung und\nPODIUM\, 28.-30.04.2014 in\nHannover\n->DJHT\, 
+ 03.-05.06.2014 in Berlin (Zeit: 30 Minuten\, Ziel: Information\, Person:
+  Präsidium) 7. Unternehmerlöhne (Zeit: nach Bedarf\, Ziel: Information\n
+ Diskussion\, Person: \nOleks Schuster)                           8. Arbe
+ itsgruppen\n8.1 ->AG Beitragsordnung\n8.2 ->AG AVE/Tarifvertrag\n(Zeit: 
+ 15 Minuten\, Ziel: Bericht\, Person: Pauler Paul)                9. Mita
+ rbeiterbefragung (Zeit: 10 Minuten\, Ziel: Information\, Person: Präsidi
+ um)                   10. Statistische Grunddaten (Zeit: 10 Minuten\, Zi
+ el: Information\, Person: Präsidium)       11. Bericht des Präsidiums (Z
+ eit: 30 Minuten\, Ziel: Bericht\, Person: Präsidium)                  12
+ . Verschiedenes (Zeit: 30 Minuten\, Ziel: Information)    13. Orte und T
+ ermine der nächsten Sitzungen\n(Zeit: 10 Minuten\, Ziel: Information)
+LAST-MODIFIED:20131104T115830Z
+CREATED:20120926T092233Z
+BEGIN:VALARM
+UID:89774719-61CB-4971-BE9D-2695DA1C500D
+ACTION:DISPLAY
+DESCRIPTION:
+TRIGGER;VALUE=DATE-TIME:19760401T005545Z
+X-WR-ALARMUID:B11CCE60-6F7A-4CD1-96BB-717B10C30CEB
+X-APPLE-DEFAULT-ALARM:TRUE
+END:VALARM
+END:VEVENT
+END:VCALENDAR
index cdbce17..579e613 100644 (file)
@@ -29,6 +29,9 @@ class Calendar_JsonTests extends Calendar_TestCase
     public function setUp()
     {
         parent::setUp();
+        
+        Calendar_Controller_Event::getInstance()->doContainerACLChecks(true);
+        
         $this->_uit = new Calendar_Frontend_Json();
     }
     
@@ -49,7 +52,7 @@ class Calendar_JsonTests extends Calendar_TestCase
      */
     public function testCreateEvent($now = FALSE)
     {
-        $scleverDisplayContainerId = Tinebase_Core::getPreference('Calendar')->getValueForUser(Calendar_Preference::DEFAULTCALENDAR, $this->_personas['sclever']->getId());
+        $scleverDisplayContainerId = Tinebase_Core::getPreference('Calendar')->getValueForUser(Calendar_Preference::DEFAULTCALENDAR, $this->_getPersona('sclever')->getId());
         $contentSeqBefore = Tinebase_Container::getInstance()->getContentSequence($scleverDisplayContainerId);
         
         $eventData = $this->_getEvent($now)->toArray();
@@ -65,11 +68,13 @@ class Calendar_JsonTests extends Calendar_TestCase
             'note_type_id' => Tinebase_Notes::getInstance()->getNoteTypes()->getFirstRecord()->getId(),
         ));
         $eventData['notes'] = array($note->toArray());
+        $eventData['etag'] = Tinebase_Record_Abstract::generateUID();
         
         $persistentEventData = $this->_uit->saveEvent($eventData);
         $loadedEventData = $this->_uit->getEvent($persistentEventData['id']);
         
         $this->_assertJsonEvent($eventData, $loadedEventData, 'failed to create/load event');
+        $this->assertEquals($eventData['etag'], $loadedEventData['etag']);
         
         $contentSeqAfter = Tinebase_Container::getInstance()->getContentSequence($scleverDisplayContainerId);
         $this->assertEquals($contentSeqBefore + 1, $contentSeqAfter,
@@ -183,7 +188,7 @@ class Calendar_JsonTests extends Calendar_TestCase
         
         $eventData = $event->toArray();
         foreach ($eventData['attendee'] as $key => $attenderData) {
-            if ($eventData['attendee'][$key]['user_id'] != $this->_testUserContact->getId()) {
+            if ($eventData['attendee'][$key]['user_id'] != $this->_getTestUserContact()->getId()) {
                 unset($eventData['attendee'][$key]);
             }
         }
@@ -232,7 +237,7 @@ class Calendar_JsonTests extends Calendar_TestCase
      */
     protected function _getEventFilterArray($containerId = NULL)
     {
-        $containerId = ($containerId) ? $containerId : $this->_testCalendar->getId();
+        $containerId = ($containerId) ? $containerId : $this->_getTestCalendar()->getId();
         return array(
             array('field' => 'container_id', 'operator' => 'equals', 'value' => $containerId),
             array('field' => 'period', 'operator' => 'within', 'value' =>
@@ -256,7 +261,7 @@ class Calendar_JsonTests extends Calendar_TestCase
                 'from'  => '2009-03-25 00:00:00',
                 'until' => '2009-03-25 23:59:59',
             )),
-            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+            array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
         );
         
         $searchResultData = $this->_uit->searchEvents($filter, array());
@@ -275,7 +280,7 @@ class Calendar_JsonTests extends Calendar_TestCase
     public function testSearchEventsWithOutPeriodFilter()
     {
         $eventData = $this->testCreateRecurEvent();
-        $filter = array(array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()));
+        $filter = array(array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()));
         
         $searchResultData = $this->_uit->searchEvents($filter, array());
         $returnedFilter = $searchResultData['filter'];
@@ -292,7 +297,7 @@ class Calendar_JsonTests extends Calendar_TestCase
     {
         Calendar_Config::getInstance()->set(Calendar_Config::MAX_JSON_DEFAULT_FILTER_PERIOD_FROM, 12);
         
-        $filter = array(array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()));
+        $filter = array(array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()));
         $searchResultData = $this->_uit->searchEvents($filter, array());
         
         $now = Tinebase_DateTime::now()->setTime(0,0,0);
@@ -350,7 +355,7 @@ class Calendar_JsonTests extends Calendar_TestCase
         $eventData = $this->testCreateEvent();
         $numAttendee = count($eventData['attendee']);
         $eventData['attendee'][$numAttendee] = array(
-