示例#1
0
 /**
  * @depends test_create_json
  *
  */
 public function test_addJson()
 {
     $JsonString = '
         [{
             "description" : "Description 1 Json",
             "title" : "Title 1 Json"
         },{
             "description" : "Description 2 Json",
             "title" : "Title 2 Json"
         },{
             "description" : "Description 3 Json",
             "title" : "Title 3 Json "
         }]
     ';
     $c = Unify::create(true)->addJson($JsonString);
     $this->assertEquals(true, $c[1]->offsetExists('title'));
     $this->assertEquals('Description 3 Json', $c->offsetGet(2)->description);
 }
示例#2
0
 /**
  * @expectedException InvalidArgumentException
  * @expectedExceptionCode 120
  */
 public function test_create2_exception()
 {
     Unify::create(new \stdClass());
 }
示例#3
0
文件: UnifyTest.php 项目: mecum/mecum
 /**
  * @depends test_createWith
  */
 public function test_create_string()
 {
     $c = Unify::create('operation');
     $this->assertEquals(true, $c instanceof Collection);
     $this->assertEquals(true, $c->extensions()->exists('renameAll'));
     $this->assertEquals(false, $c->extensions()->exists('avg'));
     $this->assertEquals(false, $c->extensions()->exists('toHTML'));
 }