Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: ithinkihaveacat/byron
base: d1d8488a01
...
head fork: ithinkihaveacat/byron
compare: c7b124d250
  • 4 commits
  • 9 files changed
  • 0 commit comments
  • 1 contributor
View
3  README.md
@@ -12,6 +12,9 @@ Hahahahahaha.
# Requirements
+The library uses a few PHP modules. Either install these from packages, or
+build PHP with something like:
+
$ ./configure --enable-mbstring --with-openssl --with-xsl && make && make install
# Build Status
View
6 lib/Client/Flickr.php
@@ -17,14 +17,14 @@ class Flickr extends \Byron\Client {
public function __construct($key) // Makes $key mandatory
{
if (!array_key_exists("api_key", $key)) {
- throw new \Exception("key [api_key] not provided");
+ throw new \InvalidArgumentException("key [api_key] not provided");
}
if (empty($key["api_key"])) {
- throw new \Exception("key [api_key] is empty");
+ throw new \InvalidArgumentException("key [api_key] is empty");
}
foreach (array("api_secret", "api_token") as $k) {
if (empty($key[$k])) {
- throw new \Exception("key [$k] is empty");
+ throw new \InvalidArgumentException("key [$k] is empty");
}
}
parent::__construct($key);
View
8 tests/medium/CacheMemcachedTest.php
@@ -7,9 +7,15 @@ class CacheMemcachedTest extends CacheTest
public function setUp()
{
+ if (!extension_loaded("memcached")) {
+ $this->markTestSkipped("Skipping test, the [memcached] extension is not available");
+ }
$memcached = new \Memcached();
$memcached->addServer('127.0.0.1', '11211');
- // $memcached->setOption(Memcached::OPT_SERIALIZER, Memcached::SERIALIZER_JSON);
+ $version = $memcached->getVersion();
+ if ($version['127.0.0.1:11211'] == "0.0.0") { // "1.4.7" for good server
+ $this->markTestSkipped("Skipping test, can't connect to memcached server");
+ }
$this->cache = new \Byron\Cache\Memcached($memcached);
}
View
5 tests/medium/CacheRedisTest.php
@@ -13,6 +13,11 @@ public function setUp()
"port" => "6379",
"database" => "0"
));
+ try {
+ $redis->ping();
+ } catch (\Predis\Network\ConnectionException $e) {
+ $this->markTestSkipped("Skipping test, can't connect to redis");
+ }
$this->cache = new \Byron\Cache\Redis($redis);
}
View
8 tests/medium/CacheTest.php
@@ -4,7 +4,9 @@
{
public function tearDown()
{
- $this->cache->flush();
+ if (!is_null($this->cache)) {
+ $this->cache->flush();
+ }
}
public function testGet_NonexistantKey_ReturnsFalse()
@@ -32,14 +34,14 @@ public function testSetAndGet_ArrayOfArrays_ThrowsException()
$this->cache->set("foo", $v);
}
- public function testSetAndGetSerialised()
+ public function testSetAndGet_Json_ReturnsJson()
{
$v = array("foo" => str_repeat("x", 40), "bar" => array("quux" => 1));
$this->cache->set("foo", json_encode($v));
$this->assertEquals($v, json_decode($this->cache->get("foo"), true));
}
- public function testAdd()
+ public function testAdd_String_ReturnsString()
{
$k = "foo";
$v1 = "qqqqqq";
View
38 tests/medium/LonelyPlanetTest.php
@@ -1,38 +0,0 @@
-<?php
-
-class LonelyPlanetTest extends PHPUnit_Framework_Testcase {
-
- public function testPlaces() {
-
- $lp = new \Byron\Client\LonelyPlanet();
-
- $res = $lp->places("london");
-
- $this->assertEquals(3, count($res));
- $this->assertEquals("London", $res[0]["short-name"]);
-
- }
-
- public function testAroundere() {
-
- $lp = new \Byron\Client\LonelyPlanet();
-
- // http://www.getlatlon.com/
- $res = $lp->aroundere(51.5392827, -0.09769); // N1 2SN
- $this->assertGreaterThan(5, count($res));
- $this->assertEquals("25 Canonbury Lane", $res[0]["name"]);
-
- }
-
- public function testPoi() {
-
- $lp = new \Byron\Client\LonelyPlanet();
-
- $res = $lp->poi(370755); // Screen on the Green
-
- $this->assertEquals("Screen on the Green", $res[0]["name"]);
- $this->assertGreaterThan(10, strlen($res[0]["review"]));
-
- }
-
-}
View
25 tests/medium/Yahoo.php
@@ -1,25 +0,0 @@
-<?php
-
-$text = <<<END
-Once I started doing felonies, it became less hard. No matter how liberal I
-am, I’m still outraged by crimes of violence. Regardless of whether I can
-sympathize with the causes that lead these individuals to do these crimes,
-the effects are outrageous. -- Sonia Sotomayor
-END;
-
-class YahooTest extends PHPUnit_Framework_Testcase {
-
- public function testTermExtraction() {
-
- global $text;
-
- $yahoo = $this->getBroker()->getYahooService();
-
- $tag = $yahoo->termExtraction($text);
-
- $this->assertContains("crimes", $tag);
- $this->assertNotContains("banana", $tag);
-
- }
-
-}
View
8 tests/medium/FlickrTest.php → tests/small/FlickrTest.php
@@ -4,21 +4,21 @@ class FlickrTest extends PHPUnit_Framework_Testcase {
public function testConstruct_NoArguments_ThrowsException()
{
- $this->setExpectedException('Exception');
+ $this->setExpectedException('PHPUnit_Framework_Error_Warning');
$flickr = new \Byron\Client\Flickr();
}
public function testConstruct_NoApiKey_ThrowsException()
{
- $this->setExpectedException('Exception');
+ $this->setExpectedException('InvalidArgumentException');
$flickr = new \Byron\Client\Flickr(array());
}
public function testConstruct_ApiKeyIsNull_ThrowsException()
{
- $this->setExpectedException('Exception');
+ $this->setExpectedException('InvalidArgumentException');
$flickr = new \Byron\Client\Flickr(array(
"api_key" => null,
@@ -29,7 +29,7 @@ public function testConstruct_ApiKeyIsNull_ThrowsException()
public function testConstruct_ApiSecretIsNull_ThrowsException()
{
- $this->setExpectedException('Exception');
+ $this->setExpectedException('InvalidArgumentException');
$flickr = new \Byron\Client\Flickr(array(
"api_key" => null,
View
0  tests/medium/GeoTest.php → tests/small/GeoTest.php
File renamed without changes

No commit comments for this range

Something went wrong with that request. Please try again.