mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-19 07:53:14 +00:00
Fix Typos
This commit is contained in:
@@ -213,7 +213,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
|
|||||||
protected function evaluateAtom(Response $response)
|
protected function evaluateAtom(Response $response)
|
||||||
{
|
{
|
||||||
$dom_doc = new DOMDocument();
|
$dom_doc = new DOMDocument();
|
||||||
$doc->preserveWhiteSpace = false;
|
$dom_doc->preserveWhiteSpace = false;
|
||||||
$dom_doc->loadXML($response->getContent());
|
$dom_doc->loadXML($response->getContent());
|
||||||
|
|
||||||
$xpath = new DOMXPath($dom_doc);
|
$xpath = new DOMXPath($dom_doc);
|
||||||
|
@@ -19,7 +19,7 @@ class Feed_XML_RSS_ImageTest extends PhraseanetPHPUnitAbstract
|
|||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$this->this->link = 'http://www.example.org';
|
$this->link = 'http://www.example.org';
|
||||||
$this->title = 'Un beau titre';
|
$this->title = 'Un beau titre';
|
||||||
$this->url = 'http://www.example.org/image.jpg';
|
$this->url = 'http://www.example.org/image.jpg';
|
||||||
$this->width = 42;
|
$this->width = 42;
|
||||||
|
@@ -4,206 +4,220 @@ require_once __DIR__ . '/../PhraseanetPHPUnitAbstract.class.inc';
|
|||||||
|
|
||||||
class http_requestTest extends PHPUnit_Framework_TestCase
|
class http_requestTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var http_request
|
||||||
|
*/
|
||||||
|
protected $object;
|
||||||
|
|
||||||
/**
|
protected function setUp()
|
||||||
* @var http_request
|
{
|
||||||
*/
|
$this->object = new http_request();
|
||||||
protected $object;
|
}
|
||||||
|
|
||||||
protected function setUp()
|
/**
|
||||||
{
|
* Tears down the fixture, for example, closes a network connection.
|
||||||
$this->object = new http_request();
|
* This method is called after a test is executed.
|
||||||
}
|
*/
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
}
|
||||||
* Tears down the fixture, for example, closes a network connection.
|
|
||||||
* This method is called after a test is executed.
|
|
||||||
*/
|
|
||||||
protected function tearDown()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
/**
|
||||||
|
* @todo Implement testGetInstance().
|
||||||
|
*/
|
||||||
|
public function testGetInstance()
|
||||||
|
{
|
||||||
|
$this->assertInstanceOf('http_request', http_request::getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Implement testGetInstance().
|
* @todo Implement testIs_ajax().
|
||||||
*/
|
*/
|
||||||
public function testGetInstance()
|
public function testIs_ajax()
|
||||||
{
|
{
|
||||||
$this->assertInstanceOf('http_request', http_request::getInstance());
|
$this->assertFalse($this->object->is_ajax());
|
||||||
}
|
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
|
||||||
|
$this->assertTrue($this->object->is_ajax());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Implement testIs_ajax().
|
* @todo Implement testComes_from_flash().
|
||||||
*/
|
*/
|
||||||
public function testIs_ajax()
|
public function testComes_from_flash()
|
||||||
{
|
{
|
||||||
$this->assertFalse($this->object->is_ajax());
|
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
|
||||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
|
$this->assertFalse($this->object->comes_from_flash());
|
||||||
$this->assertTrue($this->object->is_ajax());
|
$_SERVER['HTTP_USER_AGENT'] = 'Shockwave Flash';
|
||||||
}
|
$this->assertTrue($this->object->comes_from_flash());
|
||||||
|
$_SERVER['HTTP_USER_AGENT'] = 'Shockwave Flash Player';
|
||||||
|
$this->assertTrue($this->object->comes_from_flash());
|
||||||
|
$_SERVER['HTTP_USER_AGENT'] = 'Adobe Flash Player';
|
||||||
|
$this->assertTrue($this->object->comes_from_flash());
|
||||||
|
$_SERVER['HTTP_USER_AGENT'] = 'Adobe Flash Player 10';
|
||||||
|
$this->assertTrue($this->object->comes_from_flash());
|
||||||
|
$_SERVER['HTTP_USER_AGENT'] = 'Flash';
|
||||||
|
$this->assertTrue($this->object->comes_from_flash());
|
||||||
|
$_SERVER['HTTP_USER_AGENT'] = 'Flash Player';
|
||||||
|
$this->assertTrue($this->object->comes_from_flash());
|
||||||
|
$_SERVER['HTTP_USER_AGENT'] = 'Flash ';
|
||||||
|
$this->assertTrue($this->object->comes_from_flash());
|
||||||
|
$_SERVER['HTTP_USER_AGENT'] = 'Flashs ';
|
||||||
|
$this->assertFalse($this->object->comes_from_flash());
|
||||||
|
$_SERVER['HTTP_USER_AGENT'] = $user_agent;
|
||||||
|
$this->assertFalse($this->object->comes_from_flash());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Implement testComes_from_flash().
|
* @todo Implement testGet_code().
|
||||||
*/
|
*/
|
||||||
public function testComes_from_flash()
|
public function testGet_code()
|
||||||
{
|
{
|
||||||
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
|
$this->assertNull($this->object->get_code());
|
||||||
$this->assertFalse($this->object->comes_from_flash());
|
$_SERVER['REDIRECT_STATUS'] = 301;
|
||||||
$_SERVER['HTTP_USER_AGENT'] = 'Shockwave Flash';
|
$this->assertEquals(301, $this->object->get_code());
|
||||||
$this->assertTrue($this->object->comes_from_flash());
|
$this->object->set_code(580);
|
||||||
$_SERVER['HTTP_USER_AGENT'] = 'Shockwave Flash Player';
|
$this->assertEquals(580, $this->object->get_code());
|
||||||
$this->assertTrue($this->object->comes_from_flash());
|
$this->object->set_code('a');
|
||||||
$_SERVER['HTTP_USER_AGENT'] = 'Adobe Flash Player';
|
$this->assertEquals(0, $this->object->get_code());
|
||||||
$this->assertTrue($this->object->comes_from_flash());
|
$this->object->set_code('a');
|
||||||
$_SERVER['HTTP_USER_AGENT'] = 'Adobe Flash Player 10';
|
$this->assertEquals(0, $this->object->get_code());
|
||||||
$this->assertTrue($this->object->comes_from_flash());
|
}
|
||||||
$_SERVER['HTTP_USER_AGENT'] = 'Flash';
|
|
||||||
$this->assertTrue($this->object->comes_from_flash());
|
|
||||||
$_SERVER['HTTP_USER_AGENT'] = 'Flash Player';
|
|
||||||
$this->assertTrue($this->object->comes_from_flash());
|
|
||||||
$_SERVER['HTTP_USER_AGENT'] = 'Flash ';
|
|
||||||
$this->assertTrue($this->object->comes_from_flash());
|
|
||||||
$_SERVER['HTTP_USER_AGENT'] = 'Flashs ';
|
|
||||||
$this->assertFalse($this->object->comes_from_flash());
|
|
||||||
$_SERVER['HTTP_USER_AGENT'] = $user_agent;
|
|
||||||
$this->assertFalse($this->object->comes_from_flash());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Implement testGet_code().
|
* @todo Implement testSet_code().
|
||||||
*/
|
*/
|
||||||
public function testGet_code()
|
public function testSet_code()
|
||||||
{
|
{
|
||||||
$this->assertNull($this->object->get_code());
|
$this->object->set_code(302);
|
||||||
$_SERVER['REDIRECT_STATUS'] = 301;
|
$this->assertEquals(302, $this->object->get_code());
|
||||||
$this->assertEquals(301, $this->object->get_code());
|
}
|
||||||
$this->object->set_code(580);
|
|
||||||
$this->assertEquals(580, $this->object->get_code());
|
|
||||||
$this->object->set_code('a');
|
|
||||||
$this->assertEquals(0, $this->object->get_code());
|
|
||||||
$this->object->set_code('a');
|
|
||||||
$this->assertEquals(0, $this->object->get_code());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Implement testSet_code().
|
* @todo Implement testGet_parms().
|
||||||
*/
|
*/
|
||||||
public function testSet_code()
|
public function testGet_parms()
|
||||||
{
|
{
|
||||||
$this->object->set_code(302);
|
$_GET = array('lili' => '25', 'popo' => array('tip', 'top'));
|
||||||
$this->assertEquals(302, $this->object->get_code());
|
$_POST = array('Plili' => '25', 'Gpopo' => array('mtip', 'btop'));
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
$parm = $this->object->get_parms('lili', 'Plili', 'popo', 'Gpopo', 'notexists');
|
||||||
* @todo Implement testGet_parms().
|
|
||||||
*/
|
|
||||||
public function testGet_parms()
|
|
||||||
{
|
|
||||||
$_GET = array('lili' => '25', 'popo' => array('tip', 'top'));
|
|
||||||
$_POST = array('Plili' => '25', 'Gpopo' => array('mtip', 'btop'));
|
|
||||||
$parm = $this->object->get_parms('lili', 'Plili', 'popo', 'Gpopo', 'notexists');
|
|
||||||
$this->assertEquals($_GET['lili'], $parm['lili']);
|
|
||||||
$this->assertEquals($_POST['Plili'], $parm['Plili']);
|
|
||||||
$this->assertEquals($_GET['popo'], $parm['popo']);
|
|
||||||
$this->assertEquals($_POST['Gpopo'], $parm['Gpopo']);
|
|
||||||
$this->assertNull($parm['notexists']);
|
|
||||||
|
|
||||||
$parm = $this->object->get_parms(
|
$this->assertEquals($_GET['lili'], $parm['lili']);
|
||||||
|
$this->assertEquals($_POST['Plili'], $parm['Plili']);
|
||||||
|
$this->assertEquals($_GET['popo'], $parm['popo']);
|
||||||
|
$this->assertEquals($_POST['Gpopo'], $parm['Gpopo']);
|
||||||
|
$this->assertNull($parm['notexists']);
|
||||||
|
|
||||||
|
$parm = $this->object->get_parms(
|
||||||
array(
|
array(
|
||||||
'lili' => http_request::SANITIZE_NUMBER_INT
|
'lili' => http_request::SANITIZE_NUMBER_INT
|
||||||
, 'Plili'
|
, 'Plili'
|
||||||
, 'popo'
|
, 'popo'
|
||||||
, 'Gpopo' => http_request::SANITIZE_STRING
|
|
||||||
, 'notexists' => http_request::SANITIZE_STRING
|
, 'notexists' => http_request::SANITIZE_STRING
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals((int)$_GET['lili'], $parm['lili']);
|
$this->assertEquals((int) $_GET['lili'], $parm['lili']);
|
||||||
$this->assertTrue(is_int($parm['lili']));
|
$this->assertTrue(is_int($parm['lili']));
|
||||||
$this->assertEquals($_POST['Plili'], $parm['Plili']);
|
$this->assertEquals($_POST['Plili'], $parm['Plili']);
|
||||||
$this->assertEquals($_GET['popo'], $parm['popo']);
|
$this->assertEquals($_GET['popo'], $parm['popo']);
|
||||||
$this->assertEquals('Array', $parm['Gpopo']);
|
$this->assertEquals('', $parm['notexists']);
|
||||||
$this->assertEquals('',$parm['notexists']);
|
|
||||||
|
|
||||||
$_GET = $_POST = array();
|
$_GET = $_POST = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function testGet_parmsArraToString()
|
||||||
* @todo Implement testGet_parms_from_serialized_datas().
|
{
|
||||||
*/
|
$_POST = array('Plili' => '25', 'Gpopo' => array('mtip', 'btop'));
|
||||||
public function testGet_parms_from_serialized_datas()
|
|
||||||
{
|
try {
|
||||||
// Remove the following lines when you implement this test.
|
$this->object->get_parms(array('Gpopo' => http_request::SANITIZE_STRING));
|
||||||
$this->markTestIncomplete(
|
|
||||||
|
if (version_compare(PHP_VERSION, '5.4', '>=')) {
|
||||||
|
$this->fail('Should raise an error notice');
|
||||||
|
}
|
||||||
|
} catch (\PHPUnit_Framework_Error_Notice $e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
$_GET = $_POST = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @todo Implement testGet_parms_from_serialized_datas().
|
||||||
|
*/
|
||||||
|
public function testGet_parms_from_serialized_datas()
|
||||||
|
{
|
||||||
|
// Remove the following lines when you implement this test.
|
||||||
|
$this->markTestIncomplete(
|
||||||
'This test has not been implemented yet.'
|
'This test has not been implemented yet.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Implement testHas_post_datas().
|
* @todo Implement testHas_post_datas().
|
||||||
*/
|
*/
|
||||||
public function testHas_post_datas()
|
public function testHas_post_datas()
|
||||||
{
|
{
|
||||||
$this->assertFalse($this->object->has_post_datas());
|
$this->assertFalse($this->object->has_post_datas());
|
||||||
$_POST = array('TOPPy'=>null);
|
$_POST = array('TOPPy' => null);
|
||||||
$this->assertTrue($this->object->has_post_datas());
|
$this->assertTrue($this->object->has_post_datas());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Implement testGet_post_datas().
|
* @todo Implement testGet_post_datas().
|
||||||
*/
|
*/
|
||||||
public function testGet_post_datas()
|
public function testGet_post_datas()
|
||||||
{
|
{
|
||||||
$post = $_POST = array('Plili' => '25', 'Gpopo' => array('mtip', 'btop'));
|
$post = $_POST = array('Plili' => '25', 'Gpopo' => array('mtip', 'btop'));
|
||||||
$this->assertEquals($post, $this->object->get_post_datas());
|
$this->assertEquals($post, $this->object->get_post_datas());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Implement testHas_get_datas().
|
* @todo Implement testHas_get_datas().
|
||||||
*/
|
*/
|
||||||
public function testHas_get_datas()
|
public function testHas_get_datas()
|
||||||
{
|
{
|
||||||
$this->assertFalse($this->object->has_get_datas());
|
$this->assertFalse($this->object->has_get_datas());
|
||||||
$_GET = array('TOPPy'=>null);
|
$_GET = array('TOPPy' => null);
|
||||||
$this->assertTrue($this->object->has_get_datas());
|
$this->assertTrue($this->object->has_get_datas());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Implement testHas_datas().
|
* @todo Implement testHas_datas().
|
||||||
*/
|
*/
|
||||||
public function testHas_datas()
|
public function testHas_datas()
|
||||||
{
|
{
|
||||||
$_POST = $_GET = array();
|
$_POST = $_GET = array();
|
||||||
$this->assertFalse($this->object->has_datas());
|
$this->assertFalse($this->object->has_datas());
|
||||||
$_POST = array('malal'=>true);
|
$_POST = array('malal' => true);
|
||||||
$this->assertTrue($this->object->has_datas());
|
$this->assertTrue($this->object->has_datas());
|
||||||
$_GET = array('malal'=>true);
|
$_GET = array('malal' => true);
|
||||||
$_POST = array();
|
$_POST = array();
|
||||||
$this->assertTrue($this->object->has_datas());
|
$this->assertTrue($this->object->has_datas());
|
||||||
$_GET = array('malal'=>true);
|
$_GET = array('malal' => true);
|
||||||
$_POST = array('malal'=>true);
|
$_POST = array('malal' => true);
|
||||||
$this->assertTrue($this->object->has_datas());
|
$this->assertTrue($this->object->has_datas());
|
||||||
$_POST = $_GET = array();
|
$_POST = $_GET = array();
|
||||||
$this->assertFalse($this->object->has_datas());
|
$this->assertFalse($this->object->has_datas());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Implement testFilter().
|
* @todo Implement testFilter().
|
||||||
*/
|
*/
|
||||||
public function testFilter()
|
public function testFilter()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
// Remove the following lines when you implement this test.
|
||||||
$this->markTestIncomplete(
|
$this->markTestIncomplete(
|
||||||
'This test has not been implemented yet.'
|
'This test has not been implemented yet.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @todo Implement testIs_command_line().
|
|
||||||
*/
|
|
||||||
public function testIs_command_line()
|
|
||||||
{
|
|
||||||
$this->assertTrue($this->object->is_command_line());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @todo Implement testIs_command_line().
|
||||||
|
*/
|
||||||
|
public function testIs_command_line()
|
||||||
|
{
|
||||||
|
$this->assertTrue($this->object->is_command_line());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,166 +4,185 @@ require_once __DIR__ . '/PhraseanetPHPUnitAbstract.class.inc';
|
|||||||
|
|
||||||
class registryTest extends PhraseanetPHPUnitAbstract
|
class registryTest extends PhraseanetPHPUnitAbstract
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* @var registry
|
|
||||||
*/
|
|
||||||
protected $object;
|
|
||||||
|
|
||||||
public function setUp()
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
$this->object = registry::get_instance();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testGet()
|
|
||||||
{
|
|
||||||
$this->testSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSet()
|
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Set value with default type (string)
|
* @var registry
|
||||||
*/
|
*/
|
||||||
$this->object->set('key_test', 'value1', registry::TYPE_STRING);
|
protected $object;
|
||||||
$this->assertTrue($this->object->get('key_test') === 'value1');
|
|
||||||
|
|
||||||
$this->object->set('key_test', 1, registry::TYPE_STRING);
|
public function setUp()
|
||||||
$this->assertTrue($this->object->get('key_test') === '1');
|
{
|
||||||
|
parent::setUp();
|
||||||
|
$this->object = registry::get_instance();
|
||||||
|
}
|
||||||
|
|
||||||
$this->object->set('key_test', '1', registry::TYPE_STRING);
|
public function testGet()
|
||||||
$this->assertTrue($this->object->get('key_test') === '1');
|
{
|
||||||
|
$this->testSet();
|
||||||
|
}
|
||||||
|
|
||||||
$this->object->set('key_test', array('caca'), registry::TYPE_STRING);
|
public function testSet()
|
||||||
$this->assertTrue($this->object->get('key_test') === 'Array');
|
{
|
||||||
|
/**
|
||||||
|
* Set value with default type (string)
|
||||||
|
*/
|
||||||
|
$this->object->set('key_test', 'value1', registry::TYPE_STRING);
|
||||||
|
$this->assertTrue($this->object->get('key_test') === 'value1');
|
||||||
|
|
||||||
|
$this->object->set('key_test', 1, registry::TYPE_STRING);
|
||||||
|
$this->assertTrue($this->object->get('key_test') === '1');
|
||||||
|
|
||||||
/**
|
$this->object->set('key_test', '1', registry::TYPE_STRING);
|
||||||
* Set value with type (string)
|
$this->assertTrue($this->object->get('key_test') === '1');
|
||||||
*/
|
|
||||||
$this->object->set('key_test', 'value1', registry::TYPE_STRING);
|
|
||||||
$this->assertTrue($this->object->get('key_test') === 'value1');
|
|
||||||
|
|
||||||
$this->object->set('key_test', 1, registry::TYPE_STRING);
|
/**
|
||||||
$this->assertTrue($this->object->get('key_test') === '1');
|
* Set value with type (string)
|
||||||
|
*/
|
||||||
|
$this->object->set('key_test', 'value1', registry::TYPE_STRING);
|
||||||
|
$this->assertTrue($this->object->get('key_test') === 'value1');
|
||||||
|
|
||||||
$this->object->set('key_test', '1', registry::TYPE_STRING);
|
$this->object->set('key_test', 1, registry::TYPE_STRING);
|
||||||
$this->assertTrue($this->object->get('key_test') === '1');
|
$this->assertTrue($this->object->get('key_test') === '1');
|
||||||
|
|
||||||
$this->object->set('key_test', array('caca'), registry::TYPE_STRING);
|
$this->object->set('key_test', '1', registry::TYPE_STRING);
|
||||||
$this->assertTrue($this->object->get('key_test') === 'Array');
|
$this->assertTrue($this->object->get('key_test') === '1');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set value with type (int)
|
* Set value with type (int)
|
||||||
*/
|
*/
|
||||||
$this->object->set('key_test', 'value1', registry::TYPE_INTEGER);
|
$this->object->set('key_test', 'value1', registry::TYPE_INTEGER);
|
||||||
$this->assertTrue($this->object->get('key_test') === 0);
|
$this->assertTrue($this->object->get('key_test') === 0);
|
||||||
|
|
||||||
$this->object->set('key_test', 1, registry::TYPE_INTEGER);
|
$this->object->set('key_test', 1, registry::TYPE_INTEGER);
|
||||||
$this->assertTrue($this->object->get('key_test') === 1);
|
$this->assertTrue($this->object->get('key_test') === 1);
|
||||||
|
|
||||||
$this->object->set('key_test', '1', registry::TYPE_INTEGER);
|
$this->object->set('key_test', '1', registry::TYPE_INTEGER);
|
||||||
$this->assertTrue($this->object->get('key_test') === 1);
|
$this->assertTrue($this->object->get('key_test') === 1);
|
||||||
|
|
||||||
$this->object->set('key_test', array('caca'), registry::TYPE_INTEGER);
|
$this->object->set('key_test', array('caca'), registry::TYPE_INTEGER);
|
||||||
$this->assertTrue($this->object->get('key_test') === 1);
|
$this->assertTrue($this->object->get('key_test') === 1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set value with type boolean
|
* Set value with type boolean
|
||||||
*/
|
*/
|
||||||
$this->object->set('key_test', 'value1', registry::TYPE_BOOLEAN);
|
$this->object->set('key_test', 'value1', registry::TYPE_BOOLEAN);
|
||||||
$this->assertTrue($this->object->get('key_test') === true);
|
$this->assertTrue($this->object->get('key_test') === true);
|
||||||
|
|
||||||
$this->object->set('key_test', 1, registry::TYPE_BOOLEAN);
|
$this->object->set('key_test', 1, registry::TYPE_BOOLEAN);
|
||||||
$this->assertTrue($this->object->get('key_test') === true);
|
$this->assertTrue($this->object->get('key_test') === true);
|
||||||
|
|
||||||
$this->object->set('key_test', '1', registry::TYPE_BOOLEAN);
|
$this->object->set('key_test', '1', registry::TYPE_BOOLEAN);
|
||||||
$this->assertTrue($this->object->get('key_test') === true);
|
$this->assertTrue($this->object->get('key_test') === true);
|
||||||
|
|
||||||
$this->object->set('key_test', array('caca'), registry::TYPE_BOOLEAN);
|
$this->object->set('key_test', array('caca'), registry::TYPE_BOOLEAN);
|
||||||
$this->assertTrue($this->object->get('key_test') === true);
|
$this->assertTrue($this->object->get('key_test') === true);
|
||||||
|
|
||||||
$this->object->set('key_test', '0', registry::TYPE_BOOLEAN);
|
$this->object->set('key_test', '0', registry::TYPE_BOOLEAN);
|
||||||
$this->assertTrue($this->object->get('key_test') === false);
|
$this->assertTrue($this->object->get('key_test') === false);
|
||||||
|
|
||||||
$this->object->set('key_test', 0, registry::TYPE_BOOLEAN);
|
$this->object->set('key_test', 0, registry::TYPE_BOOLEAN);
|
||||||
$this->assertTrue($this->object->get('key_test') === false);
|
$this->assertTrue($this->object->get('key_test') === false);
|
||||||
|
|
||||||
$this->object->set('key_test', false, registry::TYPE_BOOLEAN);
|
$this->object->set('key_test', false, registry::TYPE_BOOLEAN);
|
||||||
$this->assertTrue($this->object->get('key_test') === false);
|
$this->assertTrue($this->object->get('key_test') === false);
|
||||||
|
|
||||||
$this->object->set('key_test', true, registry::TYPE_BOOLEAN);
|
$this->object->set('key_test', true, registry::TYPE_BOOLEAN);
|
||||||
$this->assertTrue($this->object->get('key_test') === true);
|
$this->assertTrue($this->object->get('key_test') === true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set value with type array
|
* Set value with type array
|
||||||
*/
|
*/
|
||||||
$this->object->set('key_test', 'value1', registry::TYPE_ARRAY);
|
$this->object->set('key_test', 'value1', registry::TYPE_ARRAY);
|
||||||
$this->assertTrue($this->object->get('key_test') === array('value1'));
|
$this->assertTrue($this->object->get('key_test') === array('value1'));
|
||||||
|
|
||||||
$this->object->set('key_test', 1, registry::TYPE_ARRAY);
|
$this->object->set('key_test', 1, registry::TYPE_ARRAY);
|
||||||
$this->assertTrue($this->object->get('key_test') === array(1));
|
$this->assertTrue($this->object->get('key_test') === array(1));
|
||||||
|
|
||||||
$this->object->set('key_test', '1', registry::TYPE_ARRAY);
|
$this->object->set('key_test', '1', registry::TYPE_ARRAY);
|
||||||
$this->assertTrue($this->object->get('key_test') === array('1'));
|
$this->assertTrue($this->object->get('key_test') === array('1'));
|
||||||
|
|
||||||
$this->object->set('key_test', array('caca'), registry::TYPE_ARRAY);
|
$this->object->set('key_test', array('caca'), registry::TYPE_ARRAY);
|
||||||
$this->assertTrue($this->object->get('key_test') === array('caca'));
|
$this->assertTrue($this->object->get('key_test') === array('caca'));
|
||||||
|
|
||||||
$this->object->set('key_test', '0', registry::TYPE_ARRAY);
|
$this->object->set('key_test', '0', registry::TYPE_ARRAY);
|
||||||
$this->assertTrue($this->object->get('key_test') === array('0'));
|
$this->assertTrue($this->object->get('key_test') === array('0'));
|
||||||
|
|
||||||
$this->object->set('key_test', 0, registry::TYPE_ARRAY);
|
$this->object->set('key_test', 0, registry::TYPE_ARRAY);
|
||||||
$this->assertTrue($this->object->get('key_test') === array(0));
|
$this->assertTrue($this->object->get('key_test') === array(0));
|
||||||
|
|
||||||
$this->object->set('key_test', false, registry::TYPE_ARRAY);
|
$this->object->set('key_test', false, registry::TYPE_ARRAY);
|
||||||
$this->assertTrue($this->object->get('key_test') === array(false));
|
$this->assertTrue($this->object->get('key_test') === array(false));
|
||||||
|
|
||||||
$this->object->set('key_test', true, registry::TYPE_ARRAY);
|
$this->object->set('key_test', true, registry::TYPE_ARRAY);
|
||||||
$this->assertTrue($this->object->get('key_test') === array(true));
|
$this->assertTrue($this->object->get('key_test') === array(true));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set value with type enum_multi
|
* Set value with type enum_multi
|
||||||
*/
|
*/
|
||||||
$this->object->set('key_test', 'value1', registry::TYPE_ENUM_MULTI);
|
$this->object->set('key_test', 'value1', registry::TYPE_ENUM_MULTI);
|
||||||
$this->assertTrue($this->object->get('key_test') === array('value1'));
|
$this->assertTrue($this->object->get('key_test') === array('value1'));
|
||||||
|
|
||||||
$this->object->set('key_test', 1, registry::TYPE_ENUM_MULTI);
|
$this->object->set('key_test', 1, registry::TYPE_ENUM_MULTI);
|
||||||
$this->assertTrue($this->object->get('key_test') === array(1));
|
$this->assertTrue($this->object->get('key_test') === array(1));
|
||||||
|
|
||||||
$this->object->set('key_test', '1', registry::TYPE_ENUM_MULTI);
|
$this->object->set('key_test', '1', registry::TYPE_ENUM_MULTI);
|
||||||
$this->assertTrue($this->object->get('key_test') === array('1'));
|
$this->assertTrue($this->object->get('key_test') === array('1'));
|
||||||
|
|
||||||
$this->object->set('key_test', array('caca'), registry::TYPE_ENUM_MULTI);
|
$this->object->set('key_test', array('caca'), registry::TYPE_ENUM_MULTI);
|
||||||
$this->assertTrue($this->object->get('key_test') === array('caca'));
|
$this->assertTrue($this->object->get('key_test') === array('caca'));
|
||||||
|
|
||||||
$this->object->set('key_test', '0', registry::TYPE_ENUM_MULTI);
|
$this->object->set('key_test', '0', registry::TYPE_ENUM_MULTI);
|
||||||
$this->assertTrue($this->object->get('key_test') === array('0'));
|
$this->assertTrue($this->object->get('key_test') === array('0'));
|
||||||
|
|
||||||
$this->object->set('key_test', 0, registry::TYPE_ENUM_MULTI);
|
$this->object->set('key_test', 0, registry::TYPE_ENUM_MULTI);
|
||||||
$this->assertTrue($this->object->get('key_test') === array(0));
|
$this->assertTrue($this->object->get('key_test') === array(0));
|
||||||
|
|
||||||
$this->object->set('key_test', false, registry::TYPE_ENUM_MULTI);
|
$this->object->set('key_test', false, registry::TYPE_ENUM_MULTI);
|
||||||
$this->assertTrue($this->object->get('key_test') === array(false));
|
$this->assertTrue($this->object->get('key_test') === array(false));
|
||||||
|
|
||||||
$this->object->set('key_test', true, registry::TYPE_ENUM_MULTI);
|
$this->object->set('key_test', true, registry::TYPE_ENUM_MULTI);
|
||||||
$this->assertTrue($this->object->get('key_test') === array(true));
|
$this->assertTrue($this->object->get('key_test') === array(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIs_set()
|
public function testSetArrayToString()
|
||||||
{
|
{
|
||||||
$this->object->set('key_test', 'value', registry::TYPE_STRING);
|
try {
|
||||||
$this->assertTrue($this->object->is_set('key_test'));
|
$this->object->set('key_test', array('caca'), registry::TYPE_STRING);
|
||||||
$this->assertFalse($this->object->is_set('keifgjkqskodfqsflqkspfoqsfp'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testUn_set()
|
if (version_compare(PHP_VERSION, '5.4', '>=')) {
|
||||||
{
|
$this->fail('Should raise an error notice');
|
||||||
$this->testIs_set();
|
}
|
||||||
$this->object->un_set('key_test');
|
|
||||||
$this->assertFalse($this->object->is_set('key_test'));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$this->assertTrue($this->object->get('key_test') === 'Array');
|
||||||
|
} catch (\PHPUnit_Framework_Error_Notice $e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$this->object->set('key_test', array('caca'), registry::TYPE_STRING);
|
||||||
|
|
||||||
|
if (version_compare(PHP_VERSION, '5.4', '>=')) {
|
||||||
|
$this->fail('Should raise an error notice');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertTrue($this->object->get('key_test') === 'Array');
|
||||||
|
} catch (\PHPUnit_Framework_Error_Notice $e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testIs_set()
|
||||||
|
{
|
||||||
|
$this->object->set('key_test', 'value', registry::TYPE_STRING);
|
||||||
|
$this->assertTrue($this->object->is_set('key_test'));
|
||||||
|
$this->assertFalse($this->object->is_set('keifgjkqskodfqsflqkspfoqsfp'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testUn_set()
|
||||||
|
{
|
||||||
|
$this->testIs_set();
|
||||||
|
$this->object->un_set('key_test');
|
||||||
|
$this->assertFalse($this->object->is_set('key_test'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@ class connexionReportTest extends PhraseanetPHPUnitAbstract
|
|||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$date = new Datetime();
|
$date = new Datetime();
|
||||||
$thid->dmax = $date->format("Y-m-d H:i:s");
|
$this->dmax = $date->format("Y-m-d H:i:s");
|
||||||
$date->modify('-6 month');
|
$date->modify('-6 month');
|
||||||
$this->dmin = $date->format("Y-m-d H:i:s");
|
$this->dmin = $date->format("Y-m-d H:i:s");
|
||||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||||
|
@@ -28,7 +28,7 @@ class downloadReportTest extends PhraseanetPHPUnitAbstract
|
|||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$date = new Datetime();
|
$date = new Datetime();
|
||||||
$thid->dmax = $date->format("Y-m-d H:i:s");
|
$this->dmax = $date->format("Y-m-d H:i:s");
|
||||||
$date->modify('-6 month');
|
$date->modify('-6 month');
|
||||||
$this->dmin = $date->format("Y-m-d H:i:s");
|
$this->dmin = $date->format("Y-m-d H:i:s");
|
||||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||||
|
@@ -28,7 +28,7 @@ class filterTest extends PhraseanetPHPUnitAbstract
|
|||||||
public function setup()
|
public function setup()
|
||||||
{
|
{
|
||||||
$date = new Datetime();
|
$date = new Datetime();
|
||||||
$thid->dmax = $date->format("Y-m-d H:i:s");
|
$this->dmax = $date->format("Y-m-d H:i:s");
|
||||||
$date->modify('-6 month');
|
$date->modify('-6 month');
|
||||||
$this->dmin = $date->format("Y-m-d H:i:s");
|
$this->dmin = $date->format("Y-m-d H:i:s");
|
||||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||||
|
@@ -28,7 +28,7 @@ class questionReportTest extends PhraseanetPHPUnitAbstract
|
|||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$date = new Datetime();
|
$date = new Datetime();
|
||||||
$thid->dmax = $date->format("Y-m-d H:i:s");
|
$this->dmax = $date->format("Y-m-d H:i:s");
|
||||||
$date->modify('-6 month');
|
$date->modify('-6 month');
|
||||||
$this->dmin = $date->format("Y-m-d H:i:s");
|
$this->dmin = $date->format("Y-m-d H:i:s");
|
||||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||||
|
@@ -41,7 +41,7 @@ class reportTest extends PhraseanetPHPUnitAbstract
|
|||||||
</description>
|
</description>
|
||||||
</record>';
|
</record>';
|
||||||
$date = new Datetime();
|
$date = new Datetime();
|
||||||
$thid->dmax = $date->format("Y-m-d H:i:s");
|
$this->dmax = $date->format("Y-m-d H:i:s");
|
||||||
$date->modify('-6 month');
|
$date->modify('-6 month');
|
||||||
$this->dmin = $date->format("Y-m-d H:i:s");
|
$this->dmin = $date->format("Y-m-d H:i:s");
|
||||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||||
|
Reference in New Issue
Block a user