Пример #1
0
 public function testGetSlimInstance()
 {
     $expectedConfig = array('version' => '0.0.0', 'debug' => false, 'mode' => 'testing');
     $testCase = new WebTestCase();
     $slim = $testCase->getSlimInstance();
     $this->assertInstanceOf('\\Slim\\Slim', $slim);
     foreach ($expectedConfig as $key => $value) {
         $this->assertSame($expectedConfig[$key], $slim->config($key));
     }
 }
Пример #2
0
 public function testGetSlimInstance()
 {
     $expectedConfig = array('version' => '0.0.0', 'debug' => false, 'mode' => 'testing');
     $testCase = new WebTestCase();
     $slim = $testCase->getSlimInstance();
     self::assertInstanceOf('\\Slim\\App', $slim);
     foreach ($expectedConfig as $key => $value) {
         self::assertSame($expectedConfig[$key], $slim->getContainer()->get('settings')[$key]);
     }
 }
Пример #3
0
 private function getSlimInstance()
 {
     if (!$this->slim) {
         $testCase = new WebTestCase();
         $this->slim = $testCase->getSlimInstance();
         $methods = $this->getValidRequestMethods();
         $callback = function () {
             echo 'This is a test!';
         };
         foreach ($methods as $method) {
             $this->slim->{$method}($this->getValidUri(), $callback);
         }
     }
     return $this->slim;
 }
 private function getSlimInstance()
 {
     if (!$this->slim) {
         $testCase = new WebTestCase();
         $this->slim = $testCase->getSlimInstance();
         $methods = $this->getValidRequestMethods();
         $callback = function ($req, $res) {
             return $res->write('This is a test!');
         };
         foreach ($methods as $method) {
             $this->slim->map([$method], $this->getValidUri(), $callback);
         }
     }
     return $this->slim;
 }