Example #1
0
 /**
  * @expectedException InvalidArgumentException
  * @expectedExceptionCode 110
  */
 public function test_exchangeArray_exception()
 {
     Collection::create()->exchangeArray('');
 }
Example #2
0
 /**
  *  Create an unify collection with specified default packages of extensions
  *
  *  @return \Mecum\Component\Unify\Collection
  */
 public static function createWith(array $libraries)
 {
     $em = Manager::create();
     // add all library specified in the input array
     foreach ($libraries as $library) {
         switch (strtolower($library)) {
             case 'json':
                 $em->add(JsonLibrary::getAll());
                 break;
             case 'xml':
                 $em->add(XmlLibrary::getAll());
                 break;
             case 'yaml':
                 $em->add(YamlLibrary::getAll());
                 break;
             case 'operation':
                 $em->add(OperationLibrary::getAll());
                 break;
             case 'math':
                 $em->add(MathLibrary::getAll());
                 break;
             case 'debug':
                 $em->add(DebugLibrary::getAll());
                 break;
         }
     }
     return Collection::create($em);
 }
Example #3
0
 public function test_clone()
 {
     $c1 = Collection::create()->offsetSet('key', 'value');
     $c2 = clone $c1;
     $this->assertEquals('value', $c1->key);
     $this->assertEquals('value', $c2->key);
 }