public function newFromApplication(ApplicationInterface $application) { // create a new AppNode and initialize it $appNode = new AppNode(); $appNode->initFromApplication($application); $appNode->setParentUuid($this->getSystemConfiguration()->getUuid()); // persist the AppNode instance $this->persist($appNode); }
/** * Will test if we can successfully add an app to the configuration based on a given application object * * @return null */ public function testNewFromApplication() { // create a basic mock for our abstract service class $mockApp = $this->getMock('\\AppserverIo\\Psr\\Application\\ApplicationInterface'); $mockApp->expects($this->once())->method('getName')->will($this->returnValue(__METHOD__)); $this->appService->newFromApplication($mockApp); $apps = $this->appService->getSystemConfiguration()->getApps(); $foundApp = false; foreach ($apps as $app) { if ($app->getName() === __METHOD__) { $foundApp = true; break; } } $this->assertTrue($foundApp); }