diff options
author | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2010-03-28 18:08:38 +0000 |
---|---|---|
committer | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2010-03-28 18:08:38 +0000 |
commit | 74dc9ea6a4e553f38a97928617074fd76793c783 (patch) | |
tree | e50ec7dce1f4855f9447bb8f23ea21381aad0390 /tests | |
parent | 90f7d528d3f34a57d517cca268766bdbae161585 (diff) | |
download | semanticscuttle-74dc9ea6a4e553f38a97928617074fd76793c783.tar.gz semanticscuttle-74dc9ea6a4e553f38a97928617074fd76793c783.tar.bz2 |
make export_csv support filtering to multiple tags
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@702 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Api/ExportCsvTest.php | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/Api/ExportCsvTest.php b/tests/Api/ExportCsvTest.php index ee7db4b..18008e1 100644 --- a/tests/Api/ExportCsvTest.php +++ b/tests/Api/ExportCsvTest.php @@ -163,6 +163,67 @@ class Api_ExportCsvTest extends TestBaseApi /** + * Test CSV export with tag filter + */ + public function testTagFilter() + { + list($req, $uid) = $this->getAuthRequest('?tag=tag1'); + $this->addBookmark( + $uid, 'http://example.org/tag-1', 0, + array('unittest', 'tag1') + ); + $this->addBookmark( + $uid, 'http://example.org/tag-2', 0, + array('unittest', 'tag2') + ); + $this->addBookmark( + $uid, 'http://example.org/tag-3', 0, + array('unittest', 'tag1', 'tag2') + ); + + $body = $req->send()->getBody(); + $csv = $this->getCsvArray($body); + + $this->assertEquals(3, count($csv)); + $this->assertCsvHeader($csv); + + $this->assertEquals('http://example.org/tag-1', $csv[1][0]); + $this->assertEquals('http://example.org/tag-3', $csv[2][0]); + } + + + + /** + * Test CSV export with tag filter for multiple tags + */ + public function testTagFilterMultiple() + { + list($req, $uid) = $this->getAuthRequest('?tag=tag1+tag2'); + $this->addBookmark( + $uid, 'http://example.org/tag-1', 0, + array('unittest', 'tag1') + ); + $this->addBookmark( + $uid, 'http://example.org/tag-2', 0, + array('unittest', 'tag2') + ); + $this->addBookmark( + $uid, 'http://example.org/tag-3', 0, + array('unittest', 'tag1', 'tag2') + ); + + $body = $req->send()->getBody(); + $csv = $this->getCsvArray($body); + + $this->assertEquals(2, count($csv)); + $this->assertCsvHeader($csv); + + $this->assertEquals('http://example.org/tag-3', $csv[1][0]); + } + + + + /** * Asserts that the CSV array contains the correct header * * @param array $csv CSV array from getCsvArray() |