Merge branch 'pu/2013.10-longrun'
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 11 Sep 2014 10:07:53 +0000 (12:07 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 11 Sep 2014 10:07:53 +0000 (12:07 +0200)
523 files changed:
bin/tn.php
docs/ext-doc.xml
scripts/packaging/Univention/debian/changelog
scripts/packaging/Univention/debian/etc/apache.conf
scripts/packaging/Univention/debian/patches/01_database_settings.diff [new file with mode: 0644]
scripts/packaging/Univention/debian/patches/02_setupuser_settings.diff [new file with mode: 0644]
scripts/packaging/Univention/debian/patches/03_caching_settings.diff [new file with mode: 0644]
scripts/packaging/Univention/debian/patches/04_logger_settings.diff [new file with mode: 0644]
scripts/packaging/Univention/debian/patches/05_path_settings.diff [new file with mode: 0644]
scripts/packaging/Univention/debian/patches/config.inc.php.dist.diff [deleted file]
scripts/packaging/Univention/debian/patches/series
scripts/packaging/Univention/debian/tine20-tinebase.install
scripts/packaging/build-tine20-packages.sh
scripts/packaging/debian/changelog
scripts/packaging/debian/etc/apache.conf
scripts/packaging/debian/patches/01_database_settings.diff [new file with mode: 0644]
scripts/packaging/debian/patches/02_setupuser_settings.diff [new file with mode: 0644]
scripts/packaging/debian/patches/03_caching_settings.diff [new file with mode: 0644]
scripts/packaging/debian/patches/04_logger_settings.diff [new file with mode: 0644]
scripts/packaging/debian/patches/05_path_settings.diff [new file with mode: 0644]
scripts/packaging/debian/patches/config.inc.php.dist.diff [deleted file]
scripts/packaging/debian/patches/series
scripts/packaging/debian/tine20-tinebase.install
scripts/packaging/fedora/SOURCES/tine20-httpd.conf
scripts/packaging/fedora/SPECS/tine20.spec
tests/tine20/Addressbook/Export/definitions/adb_tagmatrix_ods.xml [new file with mode: 0644]
tests/tine20/Addressbook/Frontend/CardDAVTest.php
tests/tine20/Addressbook/JsonTest.php
tests/tine20/Admin/CliTest.php
tests/tine20/Admin/JsonTest.php
tests/tine20/Admin/files/import_groups.csv [new file with mode: 0644]
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/Frontend/files/invitation_request_external.ics
tests/tine20/Calendar/Frontend/iMIPTest.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/tine.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/Setup/DemoDataTests.php
tests/tine20/Calendar/TestCase.php
tests/tine20/Courses/JsonTest.php
tests/tine20/Crm/Acl/RolesTest.php [new file with mode: 0644]
tests/tine20/Crm/AllTests.php
tests/tine20/Crm/Export/XlsTest.php
tests/tine20/Crm/JsonTest.php
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 97% 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/AllTests.php
tests/tine20/HumanResources/ModelConfigurationTest.php [new file with mode: 0644]
tests/tine20/Inventory/Import/CsvTest.php
tests/tine20/Phone/JsonTest.php
tests/tine20/Projects/JsonTest.php
tests/tine20/Sales/AllTests.php
tests/tine20/Sales/CustomFieldTest.php [new file with mode: 0644]
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/Tinebase/Acl/RolesTest.php
tests/tine20/Tinebase/AllTests.php
tests/tine20/Tinebase/CustomFieldTest.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/MailTest.php [new file with mode: 0644]
tests/tine20/Tinebase/ModelConfigurationTest.php
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/TagsTest.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/ActiveSync/translations/de.po
tine20/ActiveSync/translations/en.po
tine20/ActiveSync/translations/template.pot
tine20/Addressbook/Controller/List.php
tine20/Addressbook/Export/Doc.php [new file with mode: 0644]
tine20/Addressbook/Export/definitions/adb_by_company_xls.xml [new file with mode: 0644]
tine20/Addressbook/Export/definitions/adb_default_doc.xml [new file with mode: 0644]
tine20/Addressbook/Export/templates/addressbook_contact_letter.docx [new file with mode: 0644]
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/Setup/Initialize.php
tine20/Addressbook/Setup/Update/Release3.php
tine20/Addressbook/Setup/Update/Release8.php [new file with mode: 0644]
tine20/Addressbook/Setup/setup.xml
tine20/Addressbook/css/Addressbook.css
tine20/Addressbook/js/ContactGrid.js
tine20/Addressbook/translations/de.po
tine20/Addressbook/translations/en.po
tine20/Addressbook/translations/template.pot
tine20/Admin/Controller/User.php
tine20/Admin/Frontend/Cli.php
tine20/Admin/Import/Group/Csv.php [new file with mode: 0644]
tine20/Admin/Import/User/Csv.php [moved from tine20/Admin/Import/Csv.php with 97% similarity]
tine20/Admin/Import/definitions/admin_group_import_csv.xml [new file with mode: 0644]
tine20/Admin/Import/definitions/admin_user_import_csv.xml
tine20/Admin/Import/definitions/admin_user_import_csv_for_emailuser.xml
tine20/Admin/css/Admin.css
tine20/Admin/translations/de.po
tine20/Admin/translations/en.po
tine20/Admin/translations/template.pot
tine20/Calendar/Backend/Sql.php
tine20/Calendar/Calendar.jsb2
tine20/Calendar/Config.php
tine20/Calendar/Controller.php
tine20/Calendar/Controller/Event.php
tine20/Calendar/Controller/EventNotifications.php
tine20/Calendar/Controller/MSEventFacade.php
tine20/Calendar/Convert/Event/VCalendar/Abstract.php
tine20/Calendar/Convert/Event/VCalendar/KDE.php [changed mode: 0644->0755]
tine20/Calendar/Convert/Event/VCalendar/MacOSX.php
tine20/Calendar/Exception/InvalidUrl.php [new file with mode: 0644]
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/Json.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/Frontend/iMIP.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/Import/definitions/cal_import_ical.xml [new file with mode: 0644]
tine20/Calendar/Model/Attender.php
tine20/Calendar/Model/AttenderFilter.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/EventEditDialog.js
tine20/Calendar/js/EventUI.js
tine20/Calendar/js/ImportDialog.js [new file with mode: 0644]
tine20/Calendar/js/MainScreenCenterPanel.js
tine20/Calendar/js/Model.js
tine20/Calendar/js/MonthView.js
tine20/Calendar/js/TreePanel.js
tine20/Calendar/js/iMIPDetailsPanel.js
tine20/Calendar/translations/de.po
tine20/Calendar/translations/en.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/Courses/translations/de.po
tine20/Courses/translations/en.po
tine20/Courses/translations/template.pot
tine20/Crm/Setup/Initialize.php
tine20/Crm/Setup/Update/Release3.php
tine20/Crm/Setup/Update/Release5.php
tine20/Crm/translations/de.po
tine20/Crm/translations/en.po
tine20/Crm/translations/template.pot
tine20/ExampleApplication/ExampleApplication.jsb2
tine20/ExampleApplication/js/Example.js [new file with mode: 0644]
tine20/ExampleApplication/js/ExampleDetailsPanel.js [moved from tine20/ExampleApplication/js/ExampleRecordDetailsPanel.js with 92% similarity]
tine20/ExampleApplication/js/ExampleGridPanel.js [moved from tine20/ExampleApplication/js/ExampleRecordGridPanel.js with 65% similarity]
tine20/ExampleApplication/js/ExampleRecordEditDialog.js
tine20/ExampleApplication/translations/de.po
tine20/ExampleApplication/translations/en.po
tine20/ExampleApplication/translations/template.pot
tine20/Felamimail/Controller.php
tine20/Felamimail/Controller/Message.php
tine20/Felamimail/Frontend/WebDAV.php
tine20/Felamimail/Setup/Initialize.php
tine20/Felamimail/Setup/Update/Release3.php
tine20/Felamimail/css/Felamimail.css
tine20/Felamimail/translations/de.po
tine20/Felamimail/translations/en.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/en.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/Frontend/Json.php
tine20/HumanResources/Setup/Initialize.php
tine20/HumanResources/Setup/Update/Release6.php
tine20/HumanResources/Setup/Update/Release7.php
tine20/HumanResources/js/DatePicker.js
tine20/HumanResources/js/FreeTimeGridPanel.js
tine20/HumanResources/translations/de.po
tine20/HumanResources/translations/en.po
tine20/HumanResources/translations/template.pot
tine20/Inventory/Setup/Initialize.php
tine20/Inventory/Setup/Update/Release7.php
tine20/Inventory/translations/de.po
tine20/Inventory/translations/en.po
tine20/Inventory/translations/template.pot
tine20/Phone/Setup/Initialize.php
tine20/Phone/Setup/Update/Release7.php
tine20/Phone/Setup/setup.xml
tine20/Phone/translations/de.po
tine20/Phone/translations/en.po
tine20/Phone/translations/template.pot
tine20/Projects/Model/Project.php
tine20/Projects/Setup/Initialize.php
tine20/Projects/Setup/Update/Release1.php
tine20/Projects/translations/de.po
tine20/Projects/translations/en.po
tine20/Projects/translations/template.pot
tine20/RequestTracker/css/RequestTracker.css
tine20/RequestTracker/translations/de.po
tine20/RequestTracker/translations/en.po
tine20/RequestTracker/translations/template.pot
tine20/Sales/Controller/NumberableAbstract.php
tine20/Sales/Setup/Initialize.php
tine20/Sales/Setup/Update/Release5.php
tine20/Sales/Setup/Update/Release8.php
tine20/Sales/translations/de.po
tine20/Sales/translations/en.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/de.po
tine20/Setup/translations/en.po
tine20/Setup/translations/template.pot
tine20/SimpleFAQ/Model/Faq.php
tine20/SimpleFAQ/Setup/Initialize.php
tine20/SimpleFAQ/translations/de.po
tine20/SimpleFAQ/translations/en.po
tine20/SimpleFAQ/translations/template.pot
tine20/Sipgate/Model/Line.php
tine20/Sipgate/js/CallStateWindow.js
tine20/Sipgate/translations/de.po
tine20/Sipgate/translations/en.po
tine20/Sipgate/translations/template.pot
tine20/Tasks/Backend/Sql.php
tine20/Tasks/Convert/Task/VCalendar/Abstract.php
tine20/Tasks/Convert/Task/VCalendar/EMClient.php
tine20/Tasks/Convert/Task/VCalendar/KDE.php [changed mode: 0644->0755]
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/Tasks/translations/de.po
tine20/Tasks/translations/en.po
tine20/Tasks/translations/template.pot
tine20/Timetracker/Setup/Initialize.php
tine20/Timetracker/Setup/Update/Release3.php
tine20/Timetracker/Setup/Update/Release5.php
tine20/Timetracker/Setup/setup.xml
tine20/Timetracker/translations/de.po
tine20/Timetracker/translations/en.po
tine20/Timetracker/translations/template.pot
tine20/Tinebase/Acl/Roles.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/Filter/GroupSelect.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
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/EmailUser/Sql.php
tine20/Tinebase/Export.php
tine20/Tinebase/Export/Abstract.php
tine20/Tinebase/Export/Richtext/Doc.php [new file with mode: 0644]
tine20/Tinebase/Export/Spreadsheet/Abstract.php
tine20/Tinebase/Export/Spreadsheet/Ods.php
tine20/Tinebase/Export/Spreadsheet/Xls.php
tine20/Tinebase/FileSystem.php
tine20/Tinebase/FileSystem/RecordAttachments.php
tine20/Tinebase/Frontend/Abstract.php
tine20/Tinebase/Frontend/Cli/Abstract.php
tine20/Tinebase/Frontend/Http/Abstract.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/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/Import/Csv/Abstract.php
tine20/Tinebase/ImportExportDefinition.php
tine20/Tinebase/Mail.php
tine20/Tinebase/Model/ContainerFilter.php
tine20/Tinebase/Model/CustomField/ConfigFilter.php
tine20/Tinebase/Model/Filter/Container.php
tine20/Tinebase/Model/Filter/GrantsFilterGroup.php [new file with mode: 0644]
tine20/Tinebase/Model/Grants.php
tine20/Tinebase/Model/GrantsFilter.php [new file with mode: 0644]
tine20/Tinebase/Model/Import.php
tine20/Tinebase/Model/ImportExportDefinition.php
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/TagFilter.php
tine20/Tinebase/Model/Tree/Node.php
tine20/Tinebase/Model/Tree/Node/Path.php
tine20/Tinebase/Model/User.php
tine20/Tinebase/PersistentFilter.php
tine20/Tinebase/Pluggable/Abstract.php [new file with mode: 0644]
tine20/Tinebase/Record/RecordSet.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/Tags.php
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/widgets/EditRecord.css
tine20/Tinebase/css/widgets/FilterToolbar.css
tine20/Tinebase/css/widgets/TagsPanel.css
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/ux/Printer/print.css
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/ImportDialog.js
tine20/Tinebase/js/widgets/dialog/SimpleImportDialog.js [new file with mode: 0644]
tine20/Tinebase/js/widgets/form/FileUploadButton.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/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/Tinebase/views/deactivationNotification.php [new file with mode: 0644]
tine20/Tool/Application/templates/Backend/ExampleRecord.php [deleted file]
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/ExampleRecordDetailsPanel.js [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/Voipmanager/translations/de.po
tine20/Voipmanager/translations/en.po
tine20/Voipmanager/translations/template.pot
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/themes/tine20/resources/css/tine20.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 1936373..e791085 100644 (file)
@@ -1,3 +1,9 @@
+tine20 (2014.09.0~preview1-0) natty; urgency=low
+
+  * New upstream release "Koriander" Preview 1
+
+ -- Philipp Schüle <p.schuele@metaways.de>  Thu, 04 Sep 2014 14:51:30 +0200
+
 tine20 (2013.10.6-0) natty; urgency=low
 
   * New upstream release "Collin" Service Release 5
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>
diff --git a/scripts/packaging/Univention/debian/patches/01_database_settings.diff b/scripts/packaging/Univention/debian/patches/01_database_settings.diff
new file mode 100644 (file)
index 0000000..278e52d
--- /dev/null
@@ -0,0 +1,17 @@
+--- a/config.inc.php.dist
++++ b/config.inc.php.dist
+@@ -9,10 +9,10 @@
+     // set 'count' equal zero to disable captcha, or set to number of invalid logins before request captcha.
+     'captcha' => array('count'=>0), 
+     'database' => array(
+-        'host'          => 'ENTER DATABASE HOSTNAME',
+-        'dbname'        => 'ENTER DATABASE NAME',
+-        'username'      => 'ENTER DATABASE USERNAME',
+-        'password'      => 'ENTER DATABASE PASSWORD',
++        'host'          => '_DBC_DBSERVER_',
++        'dbname'        => '_DBC_DBNAME_',
++        'username'      => '_DBC_DBUSER_',
++        'password'      => '_DBC_DBPASS_',
+         'adapter'       => 'pdo_mysql',
+         'tableprefix'   => 'tine20_',
+     ),
diff --git a/scripts/packaging/Univention/debian/patches/02_setupuser_settings.diff b/scripts/packaging/Univention/debian/patches/02_setupuser_settings.diff
new file mode 100644 (file)
index 0000000..4ea58c8
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/config.inc.php.dist
++++ b/config.inc.php.dist
+@@ -17,8 +17,8 @@
+         'tableprefix'   => 'tine20_',
+     ),
+     'setupuser' => array(
+-        'username'      => 'SETUP USERNAME',
+-        'password'      => 'SETUP PASSWORD' 
++        'username'      => '_SETUPUSERNAME_',
++        'password'      => '_SETUPPASSWORD_' 
+     ),
+     /* // optional cache (recommended)
diff --git a/scripts/packaging/Univention/debian/patches/03_caching_settings.diff b/scripts/packaging/Univention/debian/patches/03_caching_settings.diff
new file mode 100644 (file)
index 0000000..ef1c698
--- /dev/null
@@ -0,0 +1,17 @@
+--- a/config.inc.php.dist
++++ b/config.inc.php.dist
+@@ -21,13 +21,11 @@
+         'password'      => '_SETUPPASSWORD_' 
+     ),
+-    /* // optional cache (recommended)
+     'caching' => array (
+         'active' => true,
+-        'path' => 'PATH TO CACHE (NEEDS TO BE WRITEABLE BY WEBSERVER)',
++        'path' => '/var/lib/tine20/cache',
+         'lifetime' => 3600,
+     ),
+-    */
+     /* // optional logger
+     'logger' => array (
diff --git a/scripts/packaging/Univention/debian/patches/04_logger_settings.diff b/scripts/packaging/Univention/debian/patches/04_logger_settings.diff
new file mode 100644 (file)
index 0000000..e0b8ec1
--- /dev/null
@@ -0,0 +1,17 @@
+--- a/config.inc.php.dist
++++ b/config.inc.php.dist
+@@ -27,12 +27,10 @@
+         'lifetime' => 3600,
+     ),
+-    /* // optional logger
+     'logger' => array (
+         'active' => true,
+-        'filename' => 'LOG FILE (NEEDS TO BE WRITEABLE BY WEBSERVER)',
+-        'priority' => '7',
++        'filename' => '/var/log/tine20/tine20.log',
++        'priority' => '3',
+     ),
+-    */
+ );
diff --git a/scripts/packaging/Univention/debian/patches/05_path_settings.diff b/scripts/packaging/Univention/debian/patches/05_path_settings.diff
new file mode 100644 (file)
index 0000000..ce88b67
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/config.inc.php.dist
++++ b/config.inc.php.dist
+@@ -32,5 +32,9 @@
+         'filename' => '/var/log/tine20/tine20.log',
+         'priority' => '3',
+     ),
++    'tmpdir'     => '/var/lib/tine20/tmp',
++    'sessiondir' => '/var/lib/tine20/sessions',
++    'filesdir'   => '/var/lib/tine20/files',
++    'mapPanel'   => 1
+ );
diff --git a/scripts/packaging/Univention/debian/patches/config.inc.php.dist.diff b/scripts/packaging/Univention/debian/patches/config.inc.php.dist.diff
deleted file mode 100644 (file)
index 089b706..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
---- a/config.inc.php.dist
-+++ b/config.inc.php.dist
-@@ -9,32 +9,29 @@
-     // set 'count' equal zero to disable captcha, or set to number of invalid logins before request captcha.
-     'captcha' => array('count'=>0), 
-     'database' => array(
--        'host'          => 'ENTER DATABASE HOSTNAME',
--        'dbname'          => 'ENTER DATABASE NAME',
--        'username'      => 'ENTER DATABASE USERNAME',
--        'password'      => 'ENTER DATABASE PASSWORD',
-+        'host'          => '_DBC_DBSERVER_',
-+        'dbname'          => '_DBC_DBNAME_',
-+        'username'      => '_DBC_DBUSER_',
-+        'password'      => '_DBC_DBPASS_',
-         'adapter'       => 'pdo_mysql',
-         'tableprefix'   => 'tine20_',
-     ),
-     'setupuser' => array(
--        'username'      => 'SETUP USERNAME',
--        'password'      => 'SETUP PASSWORD' 
-+        'username'      => '_SETUPUSERNAME_',
-+        'password'      => '_SETUPPASSWORD_' 
-     ),
--    
--    /* // optional cache (recommended)
-     'caching' => array (
-         'active' => true,
--        'path' => 'PATH TO CACHE (NEEDS TO BE WRITEABLE BY WEBSERVER)',
-+        'path' => '/var/lib/tine20/cache',
-         'lifetime' => 3600,
-     ),
--    */
--    
--    /* // optional logger
-     'logger' => array (
-         'active' => true,
--        'filename' => 'LOG FILE (NEEDS TO BE WRITEABLE BY WEBSERVER)',
--        'priority' => '7',
-+        'filename' => '/var/log/tine20/tine20.log',
-+        'priority' => '3',
-     ),
--    */
-+    'tmpdir'     => '/var/lib/tine20/tmp',
-+    'sessiondir' => '/var/lib/tine20/sessions',
-+    'filesdir'   => '/var/lib/tine20/files',
-+    'mapPanel'   => 1
- );
--
index a50e7f2..4b0d280 100644 (file)
@@ -1 +1,5 @@
-config.inc.php.dist.diff
+01_database_settings.diff
+02_setupuser_settings.diff
+03_caching_settings.diff
+04_logger_settings.diff
+05_path_settings.diff
index 1f884be..a9b8aa1 100644 (file)
@@ -15,4 +15,5 @@ setup.php                /usr/share/tine20
 status.php               /usr/share/tine20
 themes                   /usr/share/tine20
 tine20.php               /usr/share/tine20
+init_plugins.php         /usr/share/tine20
 debian/etc/php5.ini      /etc/tine20
index f76f576..2a34f5a 100755 (executable)
@@ -11,11 +11,12 @@ BASEDIR=`readlink -f ./tine20build`
 TEMPDIR="$BASEDIR/temp"
 MISCPACKAGESDIR="$BASEDIR/packages/misc"
 
-CODENAME="Collin"
+CODENAME="Koriander"
 GITURL="http://git.tine20.org/git/tine20"
 
 RELEASE=""
-GITBRANCH=""
+GITBRANCH="master"
+#GITBRANCH="2014.09"
 PACKAGEDIR=""
 
 PATH=$MISCPACKAGESDIR:$TEMPDIR/tine20/vendor/bin:$PATH
@@ -250,7 +251,7 @@ function createArchives()
                     echo -n "building "
                     local FILES="Addressbook Admin Setup Tinebase Zend images library vendor docs fonts themes" 
                     local FILES="$FILES config.inc.php.dist index.php langHelper.php setup.php tine20.php bootstrap.php worker.php status.php"
-                    local FILES="$FILES CREDITS LICENSE PRIVACY README RELEASENOTES chrome_web_app.json"
+                    local FILES="$FILES CREDITS LICENSE PRIVACY README RELEASENOTES init_plugins.php chrome_web_app.json"
                     
                     (cd $TEMPDIR/tine20; tar cjf ../../packages/tine20/$RELEASE/tine20-${UCFILE}_$RELEASE.tar.bz2 $FILES)
                     (cd $TEMPDIR/tine20; zip -qr ../../packages/tine20/$RELEASE/tine20-${UCFILE}_$RELEASE.zip     $FILES)
index 1936373..e791085 100644 (file)
@@ -1,3 +1,9 @@
+tine20 (2014.09.0~preview1-0) natty; urgency=low
+
+  * New upstream release "Koriander" Preview 1
+
+ -- Philipp Schüle <p.schuele@metaways.de>  Thu, 04 Sep 2014 14:51:30 +0200
+
 tine20 (2013.10.6-0) natty; urgency=low
 
   * New upstream release "Collin" Service Release 5
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>
diff --git a/scripts/packaging/debian/patches/01_database_settings.diff b/scripts/packaging/debian/patches/01_database_settings.diff
new file mode 100644 (file)
index 0000000..278e52d
--- /dev/null
@@ -0,0 +1,17 @@
+--- a/config.inc.php.dist
++++ b/config.inc.php.dist
+@@ -9,10 +9,10 @@
+     // set 'count' equal zero to disable captcha, or set to number of invalid logins before request captcha.
+     'captcha' => array('count'=>0), 
+     'database' => array(
+-        'host'          => 'ENTER DATABASE HOSTNAME',
+-        'dbname'        => 'ENTER DATABASE NAME',
+-        'username'      => 'ENTER DATABASE USERNAME',
+-        'password'      => 'ENTER DATABASE PASSWORD',
++        'host'          => '_DBC_DBSERVER_',
++        'dbname'        => '_DBC_DBNAME_',
++        'username'      => '_DBC_DBUSER_',
++        'password'      => '_DBC_DBPASS_',
+         'adapter'       => 'pdo_mysql',
+         'tableprefix'   => 'tine20_',
+     ),
diff --git a/scripts/packaging/debian/patches/02_setupuser_settings.diff b/scripts/packaging/debian/patches/02_setupuser_settings.diff
new file mode 100644 (file)
index 0000000..4ea58c8
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/config.inc.php.dist
++++ b/config.inc.php.dist
+@@ -17,8 +17,8 @@
+         'tableprefix'   => 'tine20_',
+     ),
+     'setupuser' => array(
+-        'username'      => 'SETUP USERNAME',
+-        'password'      => 'SETUP PASSWORD' 
++        'username'      => '_SETUPUSERNAME_',
++        'password'      => '_SETUPPASSWORD_' 
+     ),
+     /* // optional cache (recommended)
diff --git a/scripts/packaging/debian/patches/03_caching_settings.diff b/scripts/packaging/debian/patches/03_caching_settings.diff
new file mode 100644 (file)
index 0000000..ef1c698
--- /dev/null
@@ -0,0 +1,17 @@
+--- a/config.inc.php.dist
++++ b/config.inc.php.dist
+@@ -21,13 +21,11 @@
+         'password'      => '_SETUPPASSWORD_' 
+     ),
+-    /* // optional cache (recommended)
+     'caching' => array (
+         'active' => true,
+-        'path' => 'PATH TO CACHE (NEEDS TO BE WRITEABLE BY WEBSERVER)',
++        'path' => '/var/lib/tine20/cache',
+         'lifetime' => 3600,
+     ),
+-    */
+     /* // optional logger
+     'logger' => array (
diff --git a/scripts/packaging/debian/patches/04_logger_settings.diff b/scripts/packaging/debian/patches/04_logger_settings.diff
new file mode 100644 (file)
index 0000000..e0b8ec1
--- /dev/null
@@ -0,0 +1,17 @@
+--- a/config.inc.php.dist
++++ b/config.inc.php.dist
+@@ -27,12 +27,10 @@
+         'lifetime' => 3600,
+     ),
+-    /* // optional logger
+     'logger' => array (
+         'active' => true,
+-        'filename' => 'LOG FILE (NEEDS TO BE WRITEABLE BY WEBSERVER)',
+-        'priority' => '7',
++        'filename' => '/var/log/tine20/tine20.log',
++        'priority' => '3',
+     ),
+-    */
+ );
diff --git a/scripts/packaging/debian/patches/05_path_settings.diff b/scripts/packaging/debian/patches/05_path_settings.diff
new file mode 100644 (file)
index 0000000..ce88b67
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/config.inc.php.dist
++++ b/config.inc.php.dist
+@@ -32,5 +32,9 @@
+         'filename' => '/var/log/tine20/tine20.log',
+         'priority' => '3',
+     ),
++    'tmpdir'     => '/var/lib/tine20/tmp',
++    'sessiondir' => '/var/lib/tine20/sessions',
++    'filesdir'   => '/var/lib/tine20/files',
++    'mapPanel'   => 1
+ );
diff --git a/scripts/packaging/debian/patches/config.inc.php.dist.diff b/scripts/packaging/debian/patches/config.inc.php.dist.diff
deleted file mode 100644 (file)
index 089b706..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
---- a/config.inc.php.dist
-+++ b/config.inc.php.dist
-@@ -9,32 +9,29 @@
-     // set 'count' equal zero to disable captcha, or set to number of invalid logins before request captcha.
-     'captcha' => array('count'=>0), 
-     'database' => array(
--        'host'          => 'ENTER DATABASE HOSTNAME',
--        'dbname'          => 'ENTER DATABASE NAME',
--        'username'      => 'ENTER DATABASE USERNAME',
--        'password'      => 'ENTER DATABASE PASSWORD',
-+        'host'          => '_DBC_DBSERVER_',
-+        'dbname'          => '_DBC_DBNAME_',
-+        'username'      => '_DBC_DBUSER_',
-+        'password'      => '_DBC_DBPASS_',
-         'adapter'       => 'pdo_mysql',
-         'tableprefix'   => 'tine20_',
-     ),
-     'setupuser' => array(
--        'username'      => 'SETUP USERNAME',
--        'password'      => 'SETUP PASSWORD' 
-+        'username'      => '_SETUPUSERNAME_',
-+        'password'      => '_SETUPPASSWORD_' 
-     ),
--    
--    /* // optional cache (recommended)
-     'caching' => array (
-         'active' => true,
--        'path' => 'PATH TO CACHE (NEEDS TO BE WRITEABLE BY WEBSERVER)',
-+        'path' => '/var/lib/tine20/cache',
-         'lifetime' => 3600,
-     ),
--    */
--    
--    /* // optional logger
-     'logger' => array (
-         'active' => true,
--        'filename' => 'LOG FILE (NEEDS TO BE WRITEABLE BY WEBSERVER)',
--        'priority' => '7',
-+        'filename' => '/var/log/tine20/tine20.log',
-+        'priority' => '3',
-     ),
--    */
-+    'tmpdir'     => '/var/lib/tine20/tmp',
-+    'sessiondir' => '/var/lib/tine20/sessions',
-+    'filesdir'   => '/var/lib/tine20/files',
-+    'mapPanel'   => 1
- );
--
index a50e7f2..4b0d280 100644 (file)
@@ -1 +1,5 @@
-config.inc.php.dist.diff
+01_database_settings.diff
+02_setupuser_settings.diff
+03_caching_settings.diff
+04_logger_settings.diff
+05_path_settings.diff
index 1f884be..a9b8aa1 100644 (file)
@@ -15,4 +15,5 @@ setup.php                /usr/share/tine20
 status.php               /usr/share/tine20
 themes                   /usr/share/tine20
 tine20.php               /usr/share/tine20
+init_plugins.php         /usr/share/tine20
 debian/etc/php5.ini      /etc/tine20
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 7fd9245..e1b46d6 100644 (file)
@@ -270,6 +270,7 @@ fi
 %{_datadir}/%{name}/setup.php
 %{_datadir}/%{name}/status.php
 %{_datadir}/%{name}/%{name}.php
+%{_datadir}/%{name}/init_plugins.php
 %{_datadir}/%{name}/themes
 
 %dir %{_sysconfdir}/%{name}/
diff --git a/tests/tine20/Addressbook/Export/definitions/adb_tagmatrix_ods.xml b/tests/tine20/Addressbook/Export/definitions/adb_tagmatrix_ods.xml
new file mode 100644 (file)
index 0000000..22c1fd9
--- /dev/null
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<config>
+    <model>Addressbook_Model_Contact</model>
+    <name>adb_tagmatrix_ods</name>
+    <type>export</type>
+    <plugin>Addressbook_Export_Ods</plugin>
+    <description>default ods contact export definition</description>
+    <header>1</header>
+    <headers>
+        <header>{date}</header>
+        <header>{user}</header>
+    </headers>
+    <columns>
+        <!--column>
+            <identifier>account_id</identifier>
+        </column-->
+        <column>
+            <identifier>id</identifier>
+        </column>
+        <column>
+            <identifier>tags</identifier>
+            <type>tags</type>
+            <separateColumns>1</separateColumns>
+        </column>
+    </columns>
+</config>
index e8b0fe1..2256ef9 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('Addressbook')->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,7 +81,7 @@ 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();
     
index 199d7bc..2e43685 100644 (file)
@@ -18,7 +18,7 @@ require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'TestHelper.php'
 /**
  * Test class for Addressbook_Frontend_Json
  */
-class Addressbook_JsonTest extends PHPUnit_Framework_TestCase
+class Addressbook_JsonTest extends TestCase
 {
     /**
      * set geodata for contacts
@@ -150,7 +150,12 @@ class Addressbook_JsonTest extends PHPUnit_Framework_TestCase
         }
         
         if (! empty($this->objects['createdTagIds'])) {
-            Tinebase_Tags::getInstance()->deleteTags($this->objects['createdTagIds']);
+            try {
+                Tinebase_Tags::getInstance()->deleteTags($this->objects['createdTagIds'], TRUE);
+                $this->objects['createdTagIds'] = array();
+            } catch (Tinebase_Exception_AccessDenied $e) {
+                $this->objects['createdTagIds'] = array();
+            }
         }
     }
 
@@ -667,33 +672,6 @@ class Addressbook_JsonTest extends PHPUnit_Framework_TestCase
     }
     
     /**
-     * get tag
-     * 
-     * @param string $tagType
-     * @param string $tagName
-     * @return Tinebase_Model_Tag
-     */
-    protected function _getTag($tagType = Tinebase_Model_Tag::TYPE_SHARED, $tagName = NULL)
-    {
-        if ($tagName) {
-            try {
-                $tag = Tinebase_Tags::getInstance()->getTagByName($tagName);
-                return $tag;
-            } catch (Tinebase_Exception_NotFound $tenf) {
-            }
-        } else {
-            $tagName = Tinebase_Record_Abstract::generateUID();
-        }
-        
-        return new Tinebase_Model_Tag(array(
-            'type'          => $tagType,
-            'name'          => $tagName,
-            'description'   => 'testTagDescription',
-            'color'         => '#009B31',
-        ));
-    }
-
-    /**
      * testExportXlsWithCustomfield
      * 
      * @see 0006634: custom fields missing in XLS export
@@ -726,6 +704,84 @@ class Addressbook_JsonTest extends PHPUnit_Framework_TestCase
     }
     
     /**
+     * each tag should have an own column
+     */
+    public function testExportOdsWithTagMatrix()
+    {
+        $filter = new Tinebase_Model_TagFilter(array());
+        try {
+            $allTags = Tinebase_Tags::getInstance()->searchTags($filter);
+            if ($allTags->count()) {
+                Tinebase_Tags::getInstance()->deleteTags($allTags->getId(), TRUE);
+            }
+        } catch (Tinebase_Exception_AccessDenied $e) {
+            $this->markTestSkipped('This fails each 2nd time.');
+        }
+        
+        $controller = Addressbook_Controller_Contact::getInstance();
+        
+        $t1 = $this->_getTag(Tinebase_Model_Tag::TYPE_SHARED, 'tag1');
+        $this->objects['createdTagIds'][] = $t1->getId();
+        
+        $c1 = new Addressbook_Model_Contact(array(
+            'n_given'           => 'ali',
+            'n_family'          => 'PHPUNIT',
+            'org_name'          => 'test',
+            'container_id'      => $this->container->id,
+            'tags' => array($t1)
+        ));
+        
+        $c1 = $controller->create($c1);
+        $this->_contactIdsToDelete[] = $c1->getId();
+        
+        $t2 = $this->_getTag(Tinebase_Model_Tag::TYPE_SHARED, 'tag2');
+        $this->objects['createdTagIds'][] = $t2->getId();
+        
+        // this tag should not occur, this is the addressbook application
+        $crmAppId = Tinebase_Application::getInstance()->getApplicationByName('Crm')->getId();
+        $t3 = $this->_getTag(Tinebase_Model_Tag::TYPE_SHARED, 'tag3', array($crmAppId));
+        $this->objects['createdTagIds'][] = $t3->getId();
+        
+        $c2 = new Addressbook_Model_Contact(array(
+            'n_given'           => 'alisabeth',
+            'n_family'          => 'PHPUNIT',
+            'org_name'          => 'test',
+            'container_id'      => $this->container->id,
+            'tags' => array($t2)
+        ));
+        
+        $c2 = $controller->create($c2);
+        $this->_contactIdsToDelete[] = $c2->getId();
+        
+        $this->assertNotEmpty($c1->tags);
+        $this->assertNotEmpty($c2->tags);
+        
+        $filter = new Addressbook_Model_ContactFilter(array(array(
+            'field'    => 'n_family',
+            'operator' => 'equals',
+            'value'    =>  'PHPUNIT'
+        )));
+        
+        $definition = dirname(__FILE__) . '/Export/definitions/adb_tagmatrix_ods.xml';
+        $exporter = new Addressbook_Export_Ods($filter, Addressbook_Controller_Contact::getInstance(), array('definitionFilename' => $definition));
+        $doc = $exporter->generate();
+        
+        $xml = $this->_getContentXML($doc);
+        
+        $ns = $xml->getNamespaces(true);
+        $spreadsheetXml = $xml->children($ns['office'])->{'body'}->{'spreadsheet'};
+        
+        $headerRowXml = $spreadsheetXml->children($ns['table'])->{'table'}->{'table-row'}->{1};
+        
+        // the tags should exist in the header row
+        $this->assertEquals('tag1', (string) $headerRowXml->children($ns['table'])->{'table-cell'}->{1}->children($ns['text'])->{0});
+        $this->assertEquals('tag2', (string) $headerRowXml->children($ns['table'])->{'table-cell'}->{2}->children($ns['text'])->{0});
+        
+        // if there is no more header column, tag3 is not shown
+        $this->assertEquals(3, (string) $headerRowXml->children($ns['table'])->{'table-cell'}->count());
+    }
+    
+    /**
      * test import
      * 
      * @see 0006226: Data truncated for column 'adr_two_lon'
@@ -1542,6 +1598,7 @@ Steuernummer 33/111/32212";
             'description'   => 'hidden group',
             'visibility'    => Tinebase_Model_Group::VISIBILITY_HIDDEN
         ));
+        
         try {
             $hiddenGroup = Admin_Controller_Group::getInstance()->create($hiddenGroup);
         } catch (Exception $e) {
@@ -1556,6 +1613,7 @@ Steuernummer 33/111/32212";
             'operator' => 'equals',
             'value'    => 'hiddengroup'
         ));
+        
         $result = $this->_instance->searchLists($filter, array());
         $this->assertEquals(0, $result['totalcount'], 'should not find hidden list: ' . print_r($result, TRUE));
     }
index 4e10540..73bbedb 100644 (file)
@@ -129,7 +129,7 @@ class Admin_CliTest extends TestCase
         $this->objects['configSemicolon'] = '<?xml version="1.0" encoding="UTF-8"?>
         <config>
             <model>Tinebase_Model_FullUser</model>
-            <plugin>Admin_Import_Csv</plugin>
+            <plugin>Admin_Import_User_Csv</plugin>
             <type>import</type>
             <headline>1</headline>
             <dryrun>0</dryrun>
@@ -161,7 +161,7 @@ class Admin_CliTest extends TestCase
         $this->objects['configEmailuser'] = '<?xml version="1.0" encoding="UTF-8"?>
         <config>
             <model>Tinebase_Model_FullUser</model>
-            <plugin>Admin_Import_Csv</plugin>
+            <plugin>Admin_Import_User_Csv</plugin>
             <type>import</type>
             <headline>1</headline>
             <dryrun>0</dryrun>
@@ -303,7 +303,7 @@ class Admin_CliTest extends TestCase
                 'name'              => $_definition,
                 'type'              => 'import',
                 'model'             => 'Tinebase_Model_FullUser',
-                'plugin'            => 'Admin_Import_Csv',
+                'plugin'            => 'Admin_Import_User_Csv',
                 'plugin_options'    => $_config
             )));
         }
@@ -444,4 +444,33 @@ class Admin_CliTest extends TestCase
         }
         unlink("test2.csv");
     }
+    
+    /**
+     * tests if import with members from csv works correctly
+     */
+    public function testImportGroups()
+    {
+        $opts = new Zend_Console_Getopt('abp:');
+        $opts->setArguments(array(dirname(__FILE__) . '/files/import_groups.csv', 'definition=admin_group_import_csv'));
+        
+        // start import (dry run)
+        ob_start();
+        $this->_cli->importGroups($opts);
+        $out = ob_get_clean();
+        
+        $this->assertStringStartsWith('Imported 2 records.', $out);
+        
+        $be = new Tinebase_Group_Sql();
+        $menGroup = $be->getGroupByName('men');
+        $members = $be->getGroupMembers($menGroup);
+        
+        $this->assertEquals(3, count($members));
+        $this->assertEquals('displayed', $menGroup->visibility);
+        
+        $womenGroup = $be->getGroupByName('women');
+        $members = $be->getGroupMembers($womenGroup);
+        
+        $this->assertEquals(2, count($members));
+        $this->assertEquals('displayed', $womenGroup->visibility);
+    }
 }
index 5aea9a8..d0c600b 100644 (file)
@@ -334,6 +334,39 @@ class Admin_JsonTest extends TestCase
         
         $this->assertEquals('disabled', $account->accountStatus);
     }
+
+    /**
+     * test send deactivation notification
+     * 
+     * @see 0009956: send mail on account deactivation
+     */
+    public function testAccountDeactivationNotification()
+    {
+        $smtpConfig = Tinebase_Config::getInstance()->get(Tinebase_Config::SMTP);
+        if (! isset($smtpConfig->from) && ! isset($smtpConfig->primarydomain)) {
+            $this->markTestSkipped('no notification service address configured.');
+        }
+        
+        Tinebase_Config::getInstance()->set(Tinebase_Config::ACCOUNT_DEACTIVATION_NOTIFICATION, true);
+        
+        $userArray = $this->testSaveAccount();
+        
+        self::flushMailer();
+        
+        $this->_json->setAccountState(array($userArray['accountId']), 'disabled');
+        
+        $messages = self::getMessages();
+        
+        $this->assertEquals(1, count($messages), 'did not get notification message');
+        
+        $message = $messages[0];
+        $bodyText = $message->getBodyText(/* textOnly = */ true);
+        
+        $translate = Tinebase_Translation::getTranslation('Tinebase');
+        $this->assertEquals($translate->_('Your Tine 2.0 account has been deactivated'), $message->getSubject());
+        $this->assertContains($userArray['accountLoginName'], $bodyText);
+        $this->assertContains(Tinebase_Core::getHostname(), $bodyText);
+    }
     
     /**
      * try to reset password
diff --git a/tests/tine20/Admin/files/import_groups.csv b/tests/tine20/Admin/files/import_groups.csv
new file mode 100644 (file)
index 0000000..b7be8fb
--- /dev/null
@@ -0,0 +1,2 @@
+"women";"Women in our Company";"rwright sclever"
+"men";"Men in our Company";"pwulf jsmith jmcblack"
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 4069d76..5574bef 100644 (file)
@@ -100,7 +100,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,
@@ -110,7 +110,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
@@ -120,7 +120,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
@@ -130,7 +130,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
@@ -140,7 +140,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
@@ -151,7 +151,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',
@@ -164,7 +164,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',
@@ -190,7 +190,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',
@@ -203,7 +203,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',
@@ -221,7 +221,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 8e46ede..0bb4061 100644 (file)
@@ -62,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');
@@ -186,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();
         
@@ -342,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,
@@ -363,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,
                         ))),
                     )
                 )
@@ -387,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);
@@ -426,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,
@@ -471,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,
@@ -515,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;
@@ -550,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,
@@ -572,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,
@@ -591,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,
@@ -602,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,
@@ -624,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,
@@ -654,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,
@@ -675,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,
@@ -690,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..120c856 100644 (file)
@@ -25,11 +25,6 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
      */
     protected $_notificationController;
     
-    /**
-     * @var Tinebase_Model_Container
-     */
-    protected $_testCalendar;
-    
    /**
     * email test class
     *
@@ -91,12 +86,28 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
         $this->_assertMail('pwulf, sclever, jmcblack, rwright', 'invit');
         
         self::flushMailer();
-        $persistentEvent = $this->_eventController->delete($persistentEvent);
+       
+        $persistentEvent = $this->_eventController->delete($persistentEvent); 
         $this->_assertMail('jsmith', NULL);
         $this->_assertMail('pwulf, sclever, jmcblack, rwright', 'cancel');
     }
 
     /**
+     * Test event creation with muted invitation
+     */
+    public function testMuteToogle()
+    {
+        $event = $this->_getEvent(false, /* $mute = */ 1);
+        $event->attendee = $this->_getPersonaAttendee('jsmith, pwulf, sclever, jmcblack, rwright');
+
+        self::flushMailer();
+        $persistentEvent = $this->_eventController->create($event);
+        $this->_assertMail('jsmith, pwulf, sclever, jmcblack, rwright', NULL);
+
+        $this->assertEquals($event->mute, 1);
+    }
+
+    /**
      * testInvitationWithAttachment
      * 
      * @see 0008592: append event file attachments to invitation mail
@@ -158,11 +169,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 +246,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 +263,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 +281,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 +331,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 +386,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 +401,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 +418,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 +430,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 +562,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 +612,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 +664,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 +736,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 +758,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 +1042,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 +1143,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 +1204,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 +1228,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..163b385 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,29 +291,56 @@ 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
                 )
             )),
         ));
         $eventsFound = $this->_controller->search($filter, new Tinebase_Model_Pagination());
         $this->assertEquals(1, count($eventsFound), 'sclever is groupmember');
     }
-        
+    
+    public function testAttendeeNotInFilter()
+    {
+        foreach(array(Tinebase_Core::getUser()->contact_id, $this->_personasContacts['sclever']->getId()) as $attId) {
+            $event = $this->_getEvent();
+            $event->attendee = new Tinebase_Record_RecordSet('Calendar_Model_Attender', array(
+                    array('user_id' => $attId),
+            ));
+            $persistentEvent = $this->_controller->create($event);
+        }
+    
+        $filter = new Calendar_Model_EventFilter(array(
+                array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()),
+                array('field' => 'attender'    , 'operator' => 'notin',  'value' => array(
+                        array(
+                                'user_type' => Calendar_Model_Attender::USERTYPE_USER,
+                                'user_id'   => $this->_personasContacts['sclever']->getId()
+                        )
+                )),
+        ));
+        $eventsFound = $this->_controller->search($filter, new Tinebase_Model_Pagination());
+        $this->assertEquals(1, count($eventsFound), 'should be one event only');
+        $this->assertEquals(
+                Tinebase_Core::getUser()->contact_id, 
+                $eventsFound->getFirstRecord()->attendee->getFirstRecord()->user_id,
+                'sclevers event should not be found');
+    }
+    
     public function testGetFreeBusyInfo()
     {
         $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 +369,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 +384,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 +397,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 +432,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 +457,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 +473,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 +670,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 +682,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 +695,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 +710,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 +722,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 +836,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 +861,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 +940,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 +1019,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 +1273,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'
@@ -1265,8 +1287,11 @@ class Calendar_Controller_EventTests extends Calendar_TestCase
      * returns a simple event
      *
      * @return Calendar_Model_Event
+     * @param bool $_now
+     * @param bool $mute
+     * @todo replace with TestCase::_getEvent
      */
-    protected function _getEvent($_now=FALSE)
+    protected function _getEvent($_now = FALSE, $mute = NULL)
     {
         $event = new Calendar_Model_Event(array(
             'summary'     => 'Mittagspause',
@@ -1274,7 +1299,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 +1366,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 2e3fd0f..8271250 100644 (file)
@@ -55,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
         ));
         
@@ -127,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());
@@ -143,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());
@@ -169,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,
         ));
         
@@ -202,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);
@@ -312,6 +312,7 @@ class Calendar_Controller_MSEventFacadeTest extends Calendar_TestCase
         $updatedEvent = $this->_uit->update($event);
         $updatedAlarm = $updatedEvent->exdate[0]->alarms->getFirstRecord();
         
+        $this->assertNotNull($persistentAlarm);
         $diff = $persistentAlarm->diff($updatedAlarm);
         $this->assertTrue($diff->isEmpty(), 'no diff');
         $this->assertTrue(Calendar_Controller_Alarm::getAcknowledgeTime($updatedEvent->alarms->getFirstRecord()) instanceof Tinebase_DateTime, 'ack time missing');
@@ -421,7 +422,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 6f4c47c..ed6806c 100644 (file)
@@ -35,7 +35,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');
@@ -85,7 +85,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,
         ));
         
@@ -98,7 +98,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);
@@ -169,14 +169,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);
@@ -185,7 +185,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');
@@ -210,14 +210,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);
@@ -228,7 +228,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);
@@ -249,7 +249,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();
@@ -292,7 +292,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();
@@ -305,7 +305,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);
@@ -323,15 +323,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');
@@ -347,15 +347,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);
@@ -377,8 +377,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);
@@ -421,7 +421,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(),
         ));
         
@@ -467,7 +467,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);
@@ -504,7 +504,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),
         ))));
         
@@ -563,7 +563,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(),
         ));
         
@@ -601,7 +601,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);
@@ -634,7 +634,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(),
         ));
         
@@ -650,7 +650,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
@@ -680,7 +680,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);
@@ -701,7 +701,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);
@@ -722,14 +722,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);
@@ -738,7 +738,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');
@@ -789,7 +789,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..ad2de2c 100644 (file)
@@ -67,6 +67,7 @@ class Calendar_Frontend_WebDAV_ContainerTest extends PHPUnit_Framework_TestCase
     protected function tearDown()
     {
         Tinebase_TransactionManager::getInstance()->rollBack();
+        Calendar_Config::getInstance()->set(Calendar_Config::SKIP_DOUBLE_EVENTS, '');
     }
     
     /**
@@ -81,9 +82,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 +91,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 +102,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);
@@ -194,7 +186,7 @@ class Calendar_Frontend_WebDAV_ContainerTest extends PHPUnit_Framework_TestCase
      * test getChildren
      * 
      */
-    public function testGetChildren()
+    public function testGetChildren($skipAssertions = true)
     {
         $event = $this->testCreateFile()->getRecord();
         
@@ -207,8 +199,23 @@ class Calendar_Frontend_WebDAV_ContainerTest extends PHPUnit_Framework_TestCase
         
         $children = $container->getChildren();
         
-        $this->assertEquals(1, count($children));
-        $this->assertTrue($children[0] instanceof Calendar_Frontend_WebDAV_Event);
+        if (! $skipAssertions) {
+            $this->assertEquals(1, count($children));
+            $this->assertTrue($children[0] instanceof Calendar_Frontend_WebDAV_Event);
+        }
+        
+        return $children;
+    }
+    
+    public function testGetChildrenSkipDoubleEvents()
+    {
+        Calendar_Config::getInstance()->set(Calendar_Config::SKIP_DOUBLE_EVENTS, 'personal');
+        $children = $this->testGetChildren(true);
+        $this->assertEquals(0, count($children));
+        
+        Calendar_Config::getInstance()->set(Calendar_Config::SKIP_DOUBLE_EVENTS, 'shared');
+        $children = $this->testGetChildren(true);
+        $this->assertEquals(2, count($children));
     }
     
     /**
@@ -294,6 +301,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..79d0c36 100644 (file)
@@ -4,16 +4,11 @@
  * 
  * @package     Calendar
  * @license     http://www.gnu.org/licenses/agpl.html
- * @copyright   Copyright (c) 2011-2013 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(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestHelper.php';
-
-/**
  * Test class for Calendar_Frontend_WebDAV_Event
  */
 class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
@@ -63,17 +58,6 @@ class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
     }
 
     /**
-     * tear down tests
-     *
-     */
-    public function tearDown()
-    {
-        parent::tearDown();
-        
-        Tinebase_Core::set(Tinebase_Core::USER, $this->_testUser);
-    }
-    
-    /**
      * test create event with internal organizer
      * 
      * @return Calendar_Frontend_WebDAV_Event
@@ -137,8 +121,14 @@ class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
         $event = Calendar_Frontend_WebDAV_Event::create($this->objects['initialContainer'], "$id.ics", $vcalendar);
         
         $record = $event->getRecord();
-
+        $container = Tinebase_Container::getInstance()->getContainerById($record->container_id);
+        $ownAttendee = Calendar_Model_Attender::getOwnAttender($record->attendee);
+        
         $this->assertEquals('New Event', $record->summary);
+        $this->assertEquals('l.kneschke@metaways.de', $container->name, 'event no in invitation calendar');
+        $this->assertTrue(!! $ownAttendee, 'own attendee missing');
+        $this->assertEquals(1, $record->seq, 'tine20 seq starts with 1');
+        $this->assertEquals(0, $record->external_seq, 'external seq not set -> 0');
         
         return $event;
     }
@@ -241,6 +231,8 @@ class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
         $event->put($vcalendarStreamException);
         
         $this->_checkExdate($event);
+        
+        return $event;
     }
     
     /**
@@ -256,33 +248,47 @@ 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 +297,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->_getPersonasDefaultCals('sclever');
+        $pwulf = new Calendar_Model_Attender(array(
+            'user_type'    => Calendar_Model_Attender::USERTYPE_USER,
+            'user_id'      => $this->_getPersonasContacts('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()
@@ -399,6 +451,8 @@ class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
         $record = $event->getRecord();
         
         $this->assertEquals('New Event', $record->summary);
+        $this->assertEquals(2, $record->seq, 'tine20 seq should have increased');
+        $this->assertEquals(0, $record->external_seq, 'external seq must not have increased');
     }
     
     /**
@@ -420,6 +474,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 +654,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->_getPersonasDefaultCals('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());
@@ -696,7 +770,6 @@ class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
     
     /**
      * validate that users can set alarms for events with external organizers
-     * 
      */
     public function testSetAlarmForEventWithExternalOrganizer()
     {
@@ -728,19 +801,13 @@ class Calendar_Frontend_WebDAV_EventTest extends Calendar_TestCase
         $vcalendar = preg_replace(
             array(
                 '/l.kneschke@metaway\n s.de/',
-                '/unittest@\n tine20.org/',
-                '/un\n ittest@tine20.org/',
-                '/unittest@tine20.org/',
-                '/unittest@ti\n ne20.org/',
-                '/pwulf\n @tine20.org/',
+                '/un[\r\n ]{0,3}ittest@[\r\n ]{0,3}ti[\r\n ]{0,3}ne20.org/',
+                '/pwulf(\n )?@tine20.org/',
                 '/sclever@tine20.org/',
             ), 
             array(
                 $unittestUserEmail,
                 $unittestUserEmail,
-                $unittestUserEmail,
-                $unittestUserEmail,
-                $unittestUserEmail,
                 array_value('pwulf', Zend_Registry::get('personas'))->accountEmailAddress,
                 array_value('sclever', Zend_Registry::get('personas'))->accountEmailAddress,
             ), 
@@ -793,7 +860,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 +898,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;
+    }
 }