BaseTest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace iBrand\Miniprogram\Poster\Test;
  3. use Illuminate\Foundation\Testing\DatabaseMigrations;
  4. use Orchestra\Testbench\TestCase;
  5. abstract class BaseTest extends TestCase
  6. {
  7. use DatabaseMigrations;
  8. /**
  9. * set up test.
  10. */
  11. protected function setUp()
  12. {
  13. parent::setUp();
  14. $this->loadMigrationsFrom(__DIR__ . '/database');
  15. $this->seedGoods();
  16. }
  17. /**
  18. * @param \Illuminate\Foundation\Application $app
  19. */
  20. protected function getEnvironmentSetUp($app)
  21. {
  22. $app['config']->set('database.default', 'testing');
  23. $app['config']->set('database.connections.testing', [
  24. 'driver' => 'sqlite',
  25. 'database' => ':memory:',
  26. ]);
  27. $app['config']->set('repository.cache.enabled', true);
  28. $app['config']->set('ibrand.miniprogram-poster', require __DIR__ . '/../config/config.php');
  29. $app['config']->set('filesystems.disks', $app['config']->get('ibrand.miniprogram-poster.disks'), $app['config']->get('filesystems.disks'));
  30. }
  31. /**
  32. * @param \Illuminate\Foundation\Application $app
  33. *
  34. * @return array
  35. */
  36. protected function getPackageProviders($app)
  37. {
  38. return [
  39. \Orchestra\Database\ConsoleServiceProvider::class,
  40. \iBrand\Miniprogram\Poster\PhantoMmagickServiceProvider::class,
  41. ];
  42. }
  43. public function seedGoods()
  44. {
  45. GoodsTestModel::create([
  46. 'name' => '女款 防水透气抓地耐磨越野跑鞋 A1NM',
  47. ]);
  48. GoodsTestModel::create([
  49. 'name' => 'The North Face 男款 硬壳夹克/冲锋衣 A55W',
  50. ]);
  51. GoodsTestModel::create([
  52. 'name' => 'The North Face男款 跑步鞋 A04F ',
  53. ]);
  54. }
  55. }