TestCase.php 870 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace fphammerle\yii2\auth\clientcert\tests;
  3. abstract class TestCase extends \PHPUnit_Framework_TestCase
  4. {
  5. public function mockApplication()
  6. {
  7. $app = new \yii\web\Application([
  8. 'id' => 'yii2-client-cert-auth-test',
  9. 'basePath' => __DIR__,
  10. // 'vendorPath' => dirname(__DIR__) . '/vendor',
  11. 'components' => [
  12. 'db' => [
  13. 'class' => '\yii\db\Connection',
  14. 'dsn' => 'sqlite::memory:',
  15. ],
  16. 'user' => [
  17. 'identityClass' => models\User::className(),
  18. ],
  19. ],
  20. ]);
  21. $this->assertEquals([], $app->db->getSchema()->getTableNames());
  22. (new migrations\CreateUserTable)->up();
  23. $this->assertNull($app->user->getIdentity());
  24. return $app;
  25. }
  26. }