AppserverIo\Appserver\Core\Api\AppServiceTest::testNewFromApplication PHP Method

testNewFromApplication() public method

Will test if we can successfully add an app to the configuration based on a given application object
public testNewFromApplication ( ) : null
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);
    }