mirror of
https://0xacab.org/radar/radar-wp.git
synced 2025-06-09 05:06:26 +02:00
Make sure radar depenency is in repo, and upgrade for Price Categories.
This commit is contained in:
parent
c83d681db3
commit
70825293ae
124 changed files with 29219 additions and 19 deletions
22
vendor/events-radar/radar-api-php/tests/Entity/EntityTest.php
vendored
Normal file
22
vendor/events-radar/radar-api-php/tests/Entity/EntityTest.php
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Radar\Connect\Tests\Entity;
|
||||
|
||||
use Guzzle\Tests\GuzzleTestCase;
|
||||
use Radar\Connect\Connect;
|
||||
use Guzzle\Http\Client;
|
||||
|
||||
abstract class EntityTestCase extends GuzzleTestCase {
|
||||
/**
|
||||
* @see Connect\parseResponse
|
||||
*/
|
||||
protected function parseResponse($response) {
|
||||
// Reflection... clue... it shouldn't be quite like that!
|
||||
$reflectionClient = new \ReflectionClass('Radar\Connect\Connect');
|
||||
$parseResponse = $reflectionClient->getMethod('parseResponse');
|
||||
$parseResponse->setAccessible(true);
|
||||
// Argh fix me.
|
||||
$client = new Connect(new Client());
|
||||
return $parseResponse->invokeArgs($client, array($response));
|
||||
}
|
||||
}
|
64
vendor/events-radar/radar-api-php/tests/Entity/EventTest.php
vendored
Normal file
64
vendor/events-radar/radar-api-php/tests/Entity/EventTest.php
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
namespace Radar\Connect\Tests\Entity;
|
||||
|
||||
use Radar\Connect\Entity\Event;
|
||||
|
||||
class EventTest extends EntityTestCase {
|
||||
public function testRequestParse() {
|
||||
$response = $this->getMockResponse('event');
|
||||
$event = $this->parseResponse($response);
|
||||
|
||||
$this->assertEquals(count($event), 1);
|
||||
$event = reset($event);
|
||||
// Basic properties
|
||||
$this->assertEquals($event->getUuid(), '69300100-b104-4c37-b651-48351543e8a6');
|
||||
$this->assertEquals($event->getVuuid(), 'a66a7c7d-5ed4-487e-92b8-ee876b91e2d6');
|
||||
$this->assertEquals($event->getInternalId(), '9171');
|
||||
$this->assertEquals($event->getInternalVid(), '9680');
|
||||
// Node level fields
|
||||
$this->assertEquals($event->apiUri(), 'https://new-radar.squat.net/api/1.0/node/69300100-b104-4c37-b651-48351543e8a6');
|
||||
$body_text = "<p>This is a handy event that site devs are using.</p>\n";
|
||||
$this->assertEquals($event->getBody(), $body_text);
|
||||
$this->assertEquals($event->getBodyRaw(), array('value' => $body_text, 'summary' => '', 'format' => 'rich_text_editor'));
|
||||
$this->assertEquals($event->getUrlView(),'https://new-radar.squat.net/en/event/amsterdam/joes-garage/2014-02-24/test-event');
|
||||
$this->assertEquals($event->getUrlEdit(),'https://new-radar.squat.net/en/node/9171/edit');
|
||||
$this->assertEquals($event->getStatus(), TRUE);
|
||||
$this->assertEquals($event->getCreated()->getTimestamp(),'1424807163');
|
||||
$this->assertEquals($event->getUpdated()->getTimestamp(),'1424807163');
|
||||
// Node level references
|
||||
$categories = $event->getCategories();
|
||||
$this->assertTrue($categories[0] instanceof \Radar\Connect\Entity\TaxonomyTerm);
|
||||
$this->assertEquals($categories[0]->apiUri(),'https://new-radar.squat.net/api/1.0/taxonomy_term/e85a688d-03ac-4008-a3cb-1adb7e8f718a');
|
||||
$topics = $event->getTopics();
|
||||
$this->assertTrue($topics[0] instanceof \Radar\Connect\Entity\TaxonomyTerm);
|
||||
$this->assertEquals($topics[0]->apiUri(), 'https://new-radar.squat.net/api/1.0/taxonomy_term/6c73cff2-9dc9-41db-a79e-f54bf4c010f7');
|
||||
// Simple fields.
|
||||
$this->assertTrue($event instanceof Event);
|
||||
$this->assertEquals($event->getTitle(), 'Test event');
|
||||
//$this->assertEquals($event->getImageRaw(), '');
|
||||
$this->assertEquals($event->getPrice(), 'Suggested donation €3');
|
||||
$this->assertEquals($event->getEmail(), 'joe@squat.net');
|
||||
$this->assertEquals($event->getLinkRaw(), array(array('url' => 'http://www.joesgarage.nl/', 'attributes' => array())));
|
||||
$this->assertEquals($event->getLink(), array('http://www.joesgarage.nl/'));
|
||||
$this->assertEquals($event->getPhone(), '01-12345');
|
||||
// Entity references.
|
||||
$price = $event->getPriceCategory();
|
||||
$this->assertTrue($price[0] instanceof \Radar\Connect\Entity\TaxonomyTerm);
|
||||
$this->assertEquals($price[0]->apiUri(), 'https://new-radar.squat.net/api/1.0/taxonomy_term/9d943d0c-e2bf-408e-9110-4bfb044f60c0');
|
||||
$this->assertEquals($price[1]->apiUri(), 'https://new-radar.squat.net/api/1.0/taxonomy_term/6f4101f4-cd9b-49f2-91a3-203d2b47a3ed');
|
||||
$groups = $event->getGroups();
|
||||
$this->assertTrue($groups[0] instanceof \Radar\Connect\Entity\Group);
|
||||
$this->assertEquals($groups[0]->apiUri(), 'https://new-radar.squat.net/api/1.0/node/0df4bcd7-54b4-4559-a960-60b5042d3d48');
|
||||
$raw_dates = $event->getDatesRaw();
|
||||
$this->assertEquals($raw_dates[0]['value'], '1393271100');
|
||||
$this->assertEquals($raw_dates[0]['time_end'], '2014-02-24T21:00:00+01:00');
|
||||
$dates = $event->getDates();
|
||||
$this->assertTrue($dates[0]['start'] instanceof \DateTime);
|
||||
$this->assertEquals($dates[0]['start']->getTimestamp(), '1393271100');
|
||||
$this->assertEquals($dates[0]['end']->getTimezone()->getName(), '+01:00');
|
||||
$locations = $event->getLocations();
|
||||
$this->assertTrue($locations[0] instanceof \Radar\Connect\Entity\Location);
|
||||
$this->assertEquals($locations[0]->apiUri(), 'https://new-radar.squat.net/api/1.0/location/3c58abc1-e095-4db5-996d-2a064cebb2d3');
|
||||
}
|
||||
}
|
54
vendor/events-radar/radar-api-php/tests/Entity/GroupTest.php
vendored
Normal file
54
vendor/events-radar/radar-api-php/tests/Entity/GroupTest.php
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace Radar\Connect\Tests\Entity;
|
||||
|
||||
use Radar\Connect\Entity\Group;
|
||||
|
||||
class GroupTest extends EntityTestCase {
|
||||
public function testRequestParse() {
|
||||
$response = $this->getMockResponse('group');
|
||||
$group = $this->parseResponse($response);
|
||||
|
||||
$this->assertEquals(count($group), 1);
|
||||
$group = reset($group);
|
||||
// Basic properties
|
||||
$this->assertEquals($group->getUuid(), '0df4bcd7-54b4-4559-a960-60b5042d3d48');
|
||||
$this->assertEquals($group->getVuuid(), 'c6df91b9-58bd-4a5f-a52e-64ec18f267f0');
|
||||
$this->assertEquals($group->getInternalId(), '41');
|
||||
$this->assertEquals($group->getInternalVid(), '8935');
|
||||
// Node level fields
|
||||
$this->assertEquals($group->apiUri(), 'https://new-radar.squat.net/api/1.0/node/0df4bcd7-54b4-4559-a960-60b5042d3d48');
|
||||
$body_text = "<p>Joe's Garage is een ontmoetingsplek voor al dan niet krakers uit de transvaalbuurt en omstreken.</p>\n";
|
||||
$this->assertEquals($group->getBody(), $body_text);
|
||||
$this->assertEquals($group->getBodyRaw(), array('value' => $body_text, 'summary' => '', 'format' => 'rich_text_editor'));
|
||||
$this->assertEquals($group->getUrlView(),'https://new-radar.squat.net/nl/amsterdam/joes-garage?language=nl');
|
||||
$this->assertEquals($group->getUrlEdit(),'https://new-radar.squat.net/nl/node/41/edit?language=nl');
|
||||
$this->assertEquals($group->getStatus(), TRUE);
|
||||
$this->assertEquals($group->getCreated()->getTimestamp(),'1409775185');
|
||||
$this->assertEquals($group->getUpdated()->getTimestamp(),'1424352703');
|
||||
// Node level references
|
||||
$categories = $group->getCategories();
|
||||
$this->assertEquals(count($categories), 6);
|
||||
$this->assertTrue($categories[0] instanceof \Radar\Connect\Entity\TaxonomyTerm);
|
||||
$this->assertEquals($categories[0]->apiUri(),'https://new-radar.squat.net/api/1.0/taxonomy_term/e97f372b-29bc-460b-bff6-35d2462411ff?language=nl');
|
||||
$topics = $group->getTopics();
|
||||
$this->assertTrue($topics[0] instanceof \Radar\Connect\Entity\TaxonomyTerm);
|
||||
$this->assertEquals($topics[0]->apiUri(), 'https://new-radar.squat.net/api/1.0/taxonomy_term/82f00d0a-03df-40ec-a06d-67b875675858?language=nl');
|
||||
// Simple fields.
|
||||
$this->assertTrue($group instanceof Group);
|
||||
$this->assertEquals($group->getTitle(), 'Joe\'s Garage');
|
||||
//$this->assertEquals($group->getImageRaw(), '');
|
||||
//$this->assertEquals($group->getGroupLogoRaw(), '');
|
||||
$this->assertEquals($group->getEmail(), 'joe@squat.net');
|
||||
$this->assertEquals($group->getLinkRaw(), array(array('url' => 'http://www.joesgarage.nl/', 'attributes' => array())));
|
||||
$this->assertEquals($group->getLink(), array('http://www.joesgarage.nl/'));
|
||||
$this->assertEquals($group->getPhone(), null);
|
||||
$opening_times = "<p>Maandag: 19u <strong>Volkseten Vegazulu</strong></p>\n<p>Dinsdag: 11u/15u <strong>Kraakspreekuur, (daarna is er een borrel)</strong></p>\n<p>Dinsdag: 20u/21u30 <strong>Kraakspreekuur Oost</strong></p>\n<p>Woensdag: 15u/18u <strong>Lonely Collective Day Cafe</strong></p>\n<p>Donderdag: 19u <strong>Volkseten Vegazulu</strong></p>\n<p>Zaterdag: 14u/18u <strong>Weggeefwinkel</strong></p>\n<p>Zondag: 20u <strong>Filmavonden/Infoavonden</strong></p>\n";
|
||||
$this->assertEquals($group->getOpeningTimesRaw(), array('value' => $opening_times, 'format' => 'rich_text_editor'));
|
||||
$this->assertEquals($group->getOpeningTimes(), $opening_times);
|
||||
// Entity references.
|
||||
$locations = $group->getLocations();
|
||||
$this->assertTrue($locations[0] instanceof \Radar\Connect\Entity\Location);
|
||||
$this->assertEquals($locations[0]->apiUri(), 'https://new-radar.squat.net/api/1.0/location/3c58abc1-e095-4db5-996d-2a064cebb2d3?language=nl');
|
||||
}
|
||||
}
|
51
vendor/events-radar/radar-api-php/tests/Entity/ListingsGroupTest.php
vendored
Normal file
51
vendor/events-radar/radar-api-php/tests/Entity/ListingsGroupTest.php
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace Radar\Connect\Tests\Entity;
|
||||
|
||||
use Radar\Connect\Entity\ListingsGroup;
|
||||
|
||||
class ListingsGroupTest extends EntityTestCase {
|
||||
public function testRequestParse() {
|
||||
$response = $this->getMockResponse('listings_group');
|
||||
$group = $this->parseResponse($response);
|
||||
|
||||
$this->assertEquals(count($group), 1);
|
||||
$group = reset($group);
|
||||
// Basic properties
|
||||
$this->assertEquals($group->getUuid(), '9e43dac6-e1da-4f60-8428-de9f32ac9eb0');
|
||||
$this->assertEquals($group->getVuuid(), 'bf8e2d7e-3f35-44cf-aace-12aadba16948');
|
||||
$this->assertEquals($group->getInternalId(), '1599');
|
||||
$this->assertEquals($group->getInternalVid(), '8976');
|
||||
$this->assertEquals($group->getLanguage(), 'de');
|
||||
// Node level fields
|
||||
$this->assertEquals($group->apiUri(), 'https://new-radar.squat.net/api/1.0/node/9e43dac6-e1da-4f60-8428-de9f32ac9eb0');
|
||||
$body_text = "<p>Berliner Terminkalender für linke Subkultur und Politik</p>\n";
|
||||
$this->assertEquals($group->getBody(), $body_text);
|
||||
$this->assertEquals($group->getBodyRaw(), array('value' => $body_text, 'summary' => '', 'format' => 'rich_text_editor'));
|
||||
$this->assertEquals($group->getUrlView(),'https://new-radar.squat.net/en/node/1599');
|
||||
$this->assertEquals($group->getUrlEdit(),'https://new-radar.squat.net/en/node/1599/edit');
|
||||
$this->assertEquals($group->getStatus(), TRUE);
|
||||
$this->assertEquals($group->getCreated()->getTimestamp(),'1415355772');
|
||||
$this->assertEquals($group->getUpdated()->getTimestamp(),'1424428820');
|
||||
// Node level references
|
||||
$categories = $group->getCategories();
|
||||
$this->assertEquals(count($categories), 0);
|
||||
$topics = $group->getTopics();
|
||||
$this->assertEquals(count($topics), 0);
|
||||
// Simple fields.
|
||||
$this->assertTrue($group instanceof ListingsGroup);
|
||||
$this->assertEquals($group->getTitle(), 'Stressfaktor');
|
||||
//$this->assertEquals($group->getImageRaw(), '');
|
||||
//$this->assertEquals($group->getGroupLogoRaw(), '');
|
||||
$this->assertEquals($group->getEmail(), 'stressfaktor@squat.net');
|
||||
$this->assertEquals($group->getLinkRaw(), array(array('url' => 'http://stressfaktor.squat.net', 'title'=> '', 'attributes' => array())));
|
||||
$this->assertEquals($group->getLink(), array('http://stressfaktor.squat.net'));
|
||||
$this->assertEquals($group->getPhone(), null);
|
||||
// Entity references.
|
||||
$locations = $group->getLocations();
|
||||
$this->assertEquals(count($locations), 0);
|
||||
$listed_groups = $group->getGroupsListed();
|
||||
$this->assertEquals(count($listed_groups), 76);
|
||||
$this->assertEquals($listed_groups[0]->apiUri(), 'https://new-radar.squat.net/api/1.0/node/da296694-ae72-47a9-9073-e450143b9c58');
|
||||
}
|
||||
}
|
23
vendor/events-radar/radar-api-php/tests/Entity/LocationTest.php
vendored
Normal file
23
vendor/events-radar/radar-api-php/tests/Entity/LocationTest.php
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Radar\Connect\Tests\Entity;
|
||||
|
||||
use Radar\Connect\Entity\Location;
|
||||
|
||||
class LocationTest extends EntityTestCase {
|
||||
public function testRequestParse() {
|
||||
$response = $this->getMockResponse('location');
|
||||
$location = $this->parseResponse($response);
|
||||
|
||||
$this->assertEquals(count($location), 1);
|
||||
$location = reset($location);
|
||||
$this->assertTrue($location instanceof Location);
|
||||
|
||||
$this->assertEquals('X-B-Liebig Liebigstr. 34 Berlin Germany', $location->getTitle());
|
||||
$this->assertEquals('X-B-Liebig, Liebigstr. 34, Berlin', $location->getAddress());
|
||||
$this->assertEquals('X-B-Liebig, 10247, DE', $location->getAddress(array('name_line', 'postal_code', 'country')));
|
||||
$this->assertEquals('U-Bhf. Frankfurter Tor', $location->getDirections());
|
||||
$point = $location->getLocation();
|
||||
$this->assertEquals('POINT (13.4570431 52.5179561)', $point->out('wkt'));
|
||||
}
|
||||
}
|
25
vendor/events-radar/radar-api-php/tests/Entity/TaxonomyTermTest.php
vendored
Normal file
25
vendor/events-radar/radar-api-php/tests/Entity/TaxonomyTermTest.php
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace Radar\Connect\Tests\Entity;
|
||||
|
||||
use Radar\Connect\Entity\TaxonomyTerm;
|
||||
|
||||
class TaxonomyTermTest extends EntityTestCase {
|
||||
public function testRequestParse() {
|
||||
$response = $this->getMockResponse('taxonomy_term');
|
||||
$term = $this->parseResponse($response);
|
||||
|
||||
$this->assertEquals(count($term), 1);
|
||||
$term = reset($term);
|
||||
$this->assertTrue($term instanceof TaxonomyTerm);
|
||||
|
||||
$this->assertEquals($term->getTitle(), 'action/protest/camp');
|
||||
$this->assertEquals($term->apiUri(), 'https://new-radar.squat.net/api/1.0/taxonomy_term/e85a688d-03ac-4008-a3cb-1adb7e8f718a');
|
||||
$this->assertEquals($term->getUuid(), 'e85a688d-03ac-4008-a3cb-1adb7e8f718a');
|
||||
$this->assertEquals($term->getVuuid(), null);
|
||||
$this->assertEquals($term->getInternalId(), 7);
|
||||
$this->assertEquals($term->getInternalVid(), null);
|
||||
$this->assertEquals($term->getNodeCount(), 10);
|
||||
$this->assertEquals($term->getVocabulary(), 'category');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue