public function testLoadFunction() { $this->versionA->addFunction($fooA = new GlobalFunction('foo')); $this->versionB->addFunction($fooB = new GlobalFunction('foo')); $this->em->persist($this->package); $this->em->flush(); $loadedFunc = $this->provider->loadFunction('foo'); $this->assertSame($fooA, $loadedFunc, 'loadFunction() takes the first function if no package versions are set.'); $loadedFunc = $this->provider->loadFunction('FoO'); $this->assertSame($fooA, $loadedFunc, 'loadFunction() treats the name as case-insensitive.'); $this->provider->setPackageVersions(array($this->versionB)); $loadedFunc = $this->provider->loadFunction('Foo'); $this->assertSame($fooB, $loadedFunc, 'loadFunction() takes the function from one of the set packages.'); $this->provider->setPackageVersions(array($this->versionC)); $this->assertNull($this->provider->loadFunction('Foo'), 'loadFunction() returns null if function is not found in set packages.'); $this->assertNull($this->provider->loadFunction('Bar'), 'loadFunction() returns null if function does not exist.'); }