Repository navigation
Expand file tree
/
Copy pathBundleTest.php
More file actions
63 lines (46 loc) · 1.69 KB
/
Copy pathBundleTest.php
File metadata and controls
63 lines (46 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
require_once('NingApi.php');
require_once('TestConfig.php');
class BundleTest extends PHPUnit_Framework_TestCase {
protected $ningApi;
protected function setUp() {
$subdomain = TestConfig::SUBDOMAIN;
$consumer_key = TestConfig::CONSUMER_KEY;
$consumer_secret = TestConfig::CONSUMER_SECRET;
$ningApi = new NingApi($subdomain, $consumer_key, $consumer_secret);
$this->ningApi = $ningApi;
$this->ningApi->login(TestConfig::EMAIL, TestConfig::PASSWORD);
}
private function getBundleId() {
$bundleId = 'none';
$count = 1;
$fields = 'id';
$entryContentType = 'BlogPost';
$path = sprintf('Bundle/recent?count=%s&fields=%s&entryContentType=%s', $count,
$fields, $entryContentType);
$result = $this->ningApi->get($path);
if (isset($result['entry'][0]['id'])) {
$bundleId = $result['entry'][0]['id'];
}
return $bundleId;
}
public function testGet() {
$bundleId = $this->getBundleId();
$fields = 'createdDate,author,entryContentType,categoryNames';
$path = sprintf('Bundle/?id=%s&fields=%s', $bundleId, $fields);
$result = $this->ningApi->get($path);
$this->assertTrue($result['success']);
}
public function testRecent() {
$count = 12;
$fields = 'id,entryContentType,categoryNames';
$path = sprintf('Bundle/recent?count=%s&fields=%s', $count,
$fields);
$result = $this->ningApi->get($path);
$this->assertTrue($result['success']);
return $result['entry'][0]['id'];
}
protected function tearDown() {
$this->ningApi = NULL;
}
}