/** * Test get default instance */ public function testGetDefaultInstance() { $s = new Slim(); $s->setName('default'); //We must do this manually since a default app is already set in prev tests $this->assertEquals('default', $s->getName()); $this->assertInstanceOf('Slim', Slim::getInstance()); $this->assertSame($s, Slim::getInstance()); }
/** * Test Slim get instance * * Pre-conditions: * Slim app instantiated; * Set app name; * * Post-conditions: * A default app exists; * The instantiated app is returned by the name assigned to it; */ public function testGetInstance() { $app = new Slim(); $app->setName('foo'); $this->assertTrue(Slim::getInstance() instanceof Slim); $this->assertEquals('foo', $app->getName()); $this->assertSame($app, Slim::getInstance('foo')); }