public function testNoteWayTooLong() { $xml = Sync::updated(self::$sessionID); $updateKey = (string) $xml['updateKey']; $content = str_repeat("1", 10000000); // Create too-long note via sync $data = '<data version="9"><items><item libraryID="' . self::$config['libraryID'] . '" itemType="note" ' . 'dateAdded="2009-03-07 04:53:20" ' . 'dateModified="2009-03-07 04:54:09" ' . 'key="AAAAAAAA"><note>' . $content . '</note></item></items></data>'; // // < 4.0.27 // Sync::useZoteroVersion("4.0.26.4"); $response = Sync::upload(self::$sessionID, $updateKey, $data, true); $xml = Sync::waitForUpload(self::$sessionID, $response, $this, true); $this->assertTrue(isset($xml->error)); $this->assertEquals("ERROR_PROCESSING_UPLOAD_DATA", $xml->error["code"]); $this->assertRegExp('/^The note \'.+\' in your library is too long /', (string) $xml->error); $this->assertRegExp('/ copy and paste \'AAAAAAAA\' into /', (string) $xml->error); // // >=4.0.27 // Sync::useZoteroVersion(); $response = Sync::upload(self::$sessionID, $updateKey, $data, true); $xml = Sync::waitForUpload(self::$sessionID, $response, $this, true); $this->assertTrue(isset($xml->error)); $this->assertEquals("NOTE_TOO_LONG", $xml->error["code"]); $this->assertRegExp('/^The note \'.+\' in your library is too long /', (string) $xml->error); $this->assertRegExp('/\\/AAAAAAAA$/', (string) $xml->item); }