<?php use t0t1\mysfw\module; use t0t1\mysfw\frame; // XXX temp require_once '_unit_tests/unit_testing_init.php'; $ut_initializer = new unit_testing_initializer(); $ut_initializer->load('module/cookie/cookie.php'); class mysfw_cookie_Test extends PHPUnit_Framework_TestCase { public function setUp() { $this->x = new module\cookie(); $mocked_popper = $this->getMock('t0t1\\mysfw\\frame\\contract\\popper'); $mocked_configurator = $this->getMock('t0t1\\mysfw\\frame\\contract\\configurator'); // $this->init_configurator($mocked_configurator); $this->x->set_popper($mocked_popper); $this->x->set_configurator($mocked_configurator); $this->x->get_ready(); } public function test_init() { $this->assertNull($this->x->get('gni')); return $this->x; } /** * @depends test_init * @expectedException Exception * @expectedMessage Failed to set cookie with values : {"name":"gni","value":"gna","expire":null,"path":null,"domain":null,"secure":null,"http_only":null} */ public function test_set($v)
<?php use t0t1\mysfw\module; use t0t1\mysfw\frame; /** * XXX mysfw_view::reveal() tests to be completed */ // XXX temp require_once '_unit_tests/unit_testing_init.php'; $ut_initializer = new unit_testing_initializer(); $ut_initializer->load('module/session/session.php'); class mysfw_session_Test extends PHPUnit_Framework_TestCase { public function setUp() { $this->x = new module\session(); $mocked_popper = $this->getMock('t0t1\\mysfw\\frame\\contract\\popper'); $mocked_configurator = $this->getMock('t0t1\\mysfw\\frame\\contract\\configurator'); $this->x->set_popper($mocked_popper); $this->x->set_configurator($mocked_configurator); $this->x->get_ready(); } public function test_init() { $this->assertNull($this->x->get('gni')); return $this->x; } /** * @depends test_init */ public function test_start($v)
<?php use t0t1\mysfw\module; use t0t1\mysfw\frame; /** * XXX To test multi-values and multi-criteria SQL statements * XXX To test all exceptions potentially raised * XXX To test _all_ data needing escaping * XXX _get_ready() is out in coverage report. Why ? */ // XXX temp require_once '_unit_tests/unit_testing_init.php'; $ut_initializer = new unit_testing_initializer(); $ut_initializer->load('frame/contract/data_storage.php'); $ut_initializer->load('module/mysql_data_storage/mysql_data_storage.php'); class mysql_data_storage_fake extends module\mysql_data_storage { protected function _get_ready() { } public function set_mysqli($x) { $this->_m = $x; return $this; } public function get_mysqli() { return $this->_m; } } class mysql_data_storage_Test extends PHPUnit_Framework_TestCase
<?php use t0t1\mysfw\module; use t0t1\mysfw\frame; //XXX To be completed // require_once 'vfsStream/vfsStream.php'; // XXX temp require_once '_unit_tests/unit_testing_init.php'; $ut_initializer = new unit_testing_initializer(); $ut_initializer->load('module/configurator/configurator.php'); $ut_initializer->load('module/file_reporter/file_reporter.php'); class file_reporterTest extends PHPUnit_Framework_TestCase { protected $_x; public function init_configurator($configurator) { $map = [['report_dir', '_default_', 'relative dir/'], ['root', '_default_', '/root/'], ['report_file_name', '_default_', 'report.log']]; $configurator->expects($this->any())->method('inform')->will($this->returnValueMap($map)); } public function setUp() { $this->_x = new module\file_reporter(); $mocked_popper = $this->getMock('t0t1\\mysfw\\frame\\contract\\popper'); $mocked_configurator = $this->getMock('t0t1\\mysfw\\frame\\contract\\configurator'); $mocked_file_utility = $this->getMock('t0t1\\mysfw\\frame\\contract\\file_utility', ['project_full_path', 'full_path', 'is_path_absolute']); $mocked_file_utility->expects($this->any())->method('project_full_path')->willReturn('/non-existent dir/file.prout'); $mocked_popper->expects($this->any())->method('pop')->will($this->returnValueMap([['file_utility', '_default_', null, $mocked_file_utility]])); $this->init_configurator($mocked_configurator); $this->_x->set_popper($mocked_popper); $this->_x->set_configurator($mocked_configurator); //$this->_x->get_ready();
<?php use t0t1\mysfw\module; use t0t1\mysfw\frame; // XXX temp require_once '_unit_tests/unit_testing_init.php'; $ut_initializer = new unit_testing_initializer(); $ut_initializer->load('frame/contract/data_storage.php'); $ut_initializer->load('frame/contract/operator.php'); $ut_initializer->load('module/operator/operator.php'); $ut_initializer->load('module/operator/exception/too_many_entries.php'); $ut_initializer->load('module/operator/exception/no_entry.php'); class operatorTest extends PHPUnit_Framework_TestCase { protected $_x; public function init_operator() { $this->_x->get_configurator()->expects($this->any())->method('inform')->will($this->returnValue(['_id_' => null])); } public function setUp() { $this->_x = new module\operator(); $mocked_popper = $this->getMock('t0t1\\mysfw\\frame\\contract\\popper'); $mocked_data_storage = $this->getMock('t0t1\\mysfw\\frame\\contract\\data_storage'); $mocked_popper->expects($this->any())->method('indicate')->with('data_storage')->will($this->returnValue($mocked_data_storage)); $this->_x->set_popper($mocked_popper); $this->_x->set_configurator($this->getMock('t0t1\\mysfw\\frame\\contract\\configurator')); $this->_x->get_ready(); } public function test_custom_definitions() {
<?php use t0t1\mysfw\module; use t0t1\mysfw\frame; /** * XXX mysfw_view::reveal() tests to be completed */ // XXX temp require_once '_unit_tests/unit_testing_init.php'; $ut_initializer = new unit_testing_initializer(); $ut_initializer->load('frame/contract/view.php'); $ut_initializer->load('module/view/view.php'); class mysfw_view_Test extends PHPUnit_Framework_TestCase { public function setUp() { $this->x = new module\view(); $mocked_popper = $this->getMock('t0t1\\mysfw\\frame\\contract\\popper'); $mocked_configurator = $this->getMock('t0t1\\mysfw\\frame\\contract\\configurator'); // $this->init_configurator($mocked_configurator); $this->x->set_popper($mocked_popper); $this->x->set_configurator($mocked_configurator); $this->x->get_ready(); } public function test_init() { $this->assertNull($this->x->get('gni')); return $this->x; } /** * @depends test_init
<?php use t0t1\mysfw\module; use t0t1\mysfw\frame; // XXX temp require_once '_unit_tests/unit_testing_init.php'; $ut_initializer = new unit_testing_initializer(); $ut_initializer->load('frame/contract/data_storage.php'); $ut_initializer->load('module/mongodb_data_storage/mongodb_data_storage.php'); $ut_initializer->load('module/data_storage/exception/too_many_entries.php'); $ut_initializer->load('module/data_storage/exception/no_entry.php'); $ut_initializer->load('module/data_storage/exception/db_failure.php'); $ut_initializer->load('module/data_storage/exception/duplicate_key.php'); $ut_initializer->load('module/data_storage/exception/connection_failure.php'); $ut_initializer->load('module/data_storage/exception/data_storage_exception.php'); $ut_initializer->load('module/data_storage/exception/invalid_parameters.php'); $ut_initializer->load('module/data_storage/exception/no_entry.php'); $ut_initializer->load('module/data_storage/exception/wrong_key.php'); class mongoDbDataStorageTest extends PHPUnit_Framework_TestCase { protected $_x; protected $_mongo; public function setUp() { $this->_x = new module\mongodb_data_storage(); $mocked_popper = $this->getMock('t0t1\\mysfw\\frame\\contract\\popper'); $this->_x->set_popper($mocked_popper); $configurator = $this->getMock('t0t1\\mysfw\\frame\\contract\\configurator'); $this->_x->set_configurator($configurator); $this->_x->get_ready(); // test mongo db creation, will be destroy on tearDown function