This repository has been archived on 2018-10-11. You can view files and clone it, but cannot push or open issues or pull requests.
sleepy/tests/Type/JSONTest.php

40 lines
824 B
PHP
Raw Permalink Normal View History

2014-05-07 14:05:13 -04:00
<?php
2014-05-14 10:32:31 -04:00
use Sleepy\Type\JSON;
2014-05-07 14:05:13 -04:00
class MockJSON extends JSON {
2014-05-14 10:32:31 -04:00
2014-05-07 14:05:13 -04:00
protected $mime = '';
}
class JSONTest extends Sleepy_Testcase {
public function setUp() {
2014-05-14 10:32:31 -04:00
$this->JSON = new JSON(['foo'=>'bar']);
2014-05-07 14:05:13 -04:00
}
public function testSanity() {
2014-05-14 10:32:31 -04:00
$this->assertTrue(is_a($this->JSON, 'Sleepy\\Type\\JSON'));
$this->assertTrue(is_a($this->JSON, 'Sleepy\\Core\\Abstracts\\Type'));
$this->assertEquals(
['Sleepy\\Core\\Interfaces\\Type' => 'Sleepy\\Core\\Interfaces\\Type'],
class_implements('Sleepy\\Type\\JSON')
);
2014-05-07 14:05:13 -04:00
}
2014-05-14 10:32:31 -04:00
2014-05-07 14:05:13 -04:00
public function testNIE() {
try {
$json = new MockJSON([]);
}
2014-05-14 10:32:31 -04:00
catch (Sleepy\Exception\NotImplementedException $e) {
2014-05-07 14:05:13 -04:00
$this->assertTrue(TRUE);
}
}
2014-05-14 10:32:31 -04:00
public function testGetMime()
{
$mime = $this->JSON->get_mime();
$this->assertEquals('application/json', $mime);
}
2014-05-07 14:05:13 -04:00
}
// End of JSONTest