示例#1
0
文件: MiscTest.php 项目: jasny/Q
 /**
  * Test implode_recursive()
  */
 function test_implode_assoc()
 {
     $this->assertSame('a=test, b=another test, k.I=x, k.II=y, k.III="z=10", k.IV.abc=22, k.IV.def=33, c=go test', Q\implode_assoc(', ', array('a' => "test", 'b' => "another test", 'k' => array('I' => "x", 'II' => "y", 'III' => "z=10", 'IV' => array('abc' => 22, 'def' => 33)), 'c' => "go test")));
     $this->assertSame('a=test, b=another test, k=(I=x, II=y, III="z=10", IV=(abc=22, def=33)), c=go test', Q\implode_assoc(', ', array('a' => "test", 'b' => "another test", 'k' => array('I' => "x", 'II' => "y", 'III' => "z=10", 'IV' => array('abc' => 22, 'def' => 33)), 'c' => "go test"), '%s=%s', '%s=(', ')'));
     $this->assertSame('a:"test" + b:"another test" + k:[I:"x" + II:"y" + III:"z=10" + IV:[abc:"22" + def:"33"]] + c:"go test"', Q\implode_assoc(' + ', array('a' => "test", 'b' => "another test", 'k' => array('I' => "x", 'II' => "y", 'III' => "z=10", 'IV' => array('abc' => 22, 'def' => 33)), 'c' => "go test"), '%s:%s', '%s:[', ']', true));
 }
示例#2
0
文件: MainTest.php 项目: jasny/Q
 /**
  * Tests Auth->authz() with no hash
  */
 public function testAuthz_INVALID_SESSION_NoChecksum()
 {
     putenv('AUTH=' . escapeshellarg(Q\implode_assoc(";", array('uid' => 1))));
     $this->setExpectedException('Q\\Auth_SessionException', "Invalid session checksum");
     $this->Auth->authz();
     $this->assertEquals(Auth::INVALID_CHECKSUM, $this->Auth->getStatus(), 'status code');
     $this->assertNotNull($this->Auth->user(), 'user');
     $this->assertEquals(1, $this->Auth->user()->getId(), 'id');
 }