コード例 #1
0
ファイル: ManagerTest.php プロジェクト: mecum/expand
 /**
  * @depends test_set
  * @depends test_exists
  */
 public function test_set_call()
 {
     $m = Manager::Create()->set('extension', function () {
         return true;
     });
     $this->assertEquals(true, $m->call(Expandable::create(), 'extension', []));
 }
コード例 #2
0
ファイル: UnifyTest.php プロジェクト: mecum/mecum
 public function test_create_manager()
 {
     $m = Manager::create()->set('extension', function () {
         return true;
     });
     $c = Unify::create($m);
     $this->assertEquals(true, $c instanceof Collection);
     $this->assertEquals(true, $c->extensions()->exists('extension'));
     $this->assertEquals(false, $c->extensions()->exists('extension2'));
 }
コード例 #3
0
ファイル: Unify.php プロジェクト: mecum/mecum
 /**
  *  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);
 }
コード例 #4
0
ファイル: ManagerExceptionTest.php プロジェクト: mecum/expand
 /**
  * @expectedException BadMethodCallException
  * @expectedExceptionCode 110
  */
 public function test_call()
 {
     $em = Manager::Create();
     $this->assertEquals(true, $em->call(Expandable::create(), 'extension', []));
 }