public function test_should_register_and_get_works_fine() { Context::register('key1', 'val1'); Context::register('key2', new StdClass()); Context::unregister('key2'); Context::unregister('I_am_not_exists'); $this->assertEquals('val1', Context::get('key1', 'val2')); $this->assertEquals('default', Context::get('key2', 'default')); }
public function test_should_import_hello_works_fine() { $controller = new \Myfox\App\Control\Import(); \Myfox\Lib\Context::register('__ip__', '119.32.212.64'); ob_start(); $controller->execute('hello', array('table' => 'numsplit')); $output = ob_get_contents(); $this->assertContains('[1100] Access Denied.', $output); \Myfox\Lib\Context::register('__ip__', '127.0.0.1'); ob_clean(); ob_start(); $controller->execute('hello', array('table' => 'numsplit')); $output = ob_get_contents(); $this->assertContains('[1200] Param "route" is required.', $output); ob_clean(); ob_start(); $controller->execute('hello', array('table' => 'numsplit', 'file' => 'ftp://*****:*****@www.helloworld.com/test_file.txt', 'route' => 'cid:1,thedate:20111001', 'lines' => 1111111)); $output = ob_get_contents(); $this->assertContains('[0] OK', $output); @ob_clean(); }