1 | <?php |
||
6 | class TestsBase extends TestCase |
||
|
|||
7 | { |
||
8 | protected $queriesCount; |
||
9 | |||
10 | const DB_NAME = 'translatable_test'; |
||
11 | const DB_USERNAME = 'homestead'; |
||
12 | const DB_PASSWORD = 'secret'; |
||
13 | |||
14 | public function setUp() |
||
15 | { |
||
16 | $this->dropDb(); |
||
17 | $this->createDb(); |
||
18 | |||
19 | parent::setUp(); |
||
20 | |||
21 | $this->resetDatabase(); |
||
22 | $this->countQueries(); |
||
23 | } |
||
24 | |||
25 | private function dropDb() |
||
29 | |||
30 | private function createDb() |
||
34 | |||
35 | /** |
||
36 | * @param $query |
||
37 | * return void |
||
38 | */ |
||
39 | private function runQuery($query) |
||
50 | |||
51 | public function testRunningMigration() |
||
52 | { |
||
53 | $country = Country::find(1); |
||
54 | $this->assertEquals('gr', $country->code); |
||
55 | } |
||
56 | |||
57 | protected function getPackageProviders($app) |
||
61 | |||
62 | protected function getEnvironmentSetUp($app) |
||
63 | { |
||
64 | $app['path.base'] = __DIR__.'/..'; |
||
65 | $app['config']->set('database.default', 'mysql'); |
||
66 | $app['config']->set('database.connections.mysql', [ |
||
67 | 'driver' => 'mysql', |
||
68 | 'host' => 'localhost', |
||
69 | 'database' => static::DB_NAME, |
||
70 | 'username' => static::DB_USERNAME, |
||
71 | 'password' => static::DB_PASSWORD, |
||
72 | 'charset' => 'utf8', |
||
73 | 'collation' => 'utf8_unicode_ci', |
||
74 | ]); |
||
75 | $app['config']->set('translatable.locales', ['el', 'en', 'fr', 'de', 'id']); |
||
76 | } |
||
77 | |||
78 | protected function getPackageAliases($app) |
||
82 | |||
83 | protected function countQueries() |
||
95 | |||
96 | private function beautifyQuery($query) |
||
112 | |||
113 | private function resetDatabase() |
||
114 | { |
||
115 | // Relative to the testbench app folder: vendors/orchestra/testbench/src/fixture |
||
137 | |||
138 | /** |
||
139 | * @param $bindings |
||
140 | * |
||
141 | * @return mixed |
||
142 | */ |
||
143 | private function formatBindingsForSqlInjection($bindings) |
||
157 | |||
158 | /** |
||
159 | * @param $query |
||
160 | * @param $bindings |
||
161 | * |
||
162 | * @return string |
||
163 | */ |
||
164 | private function insertBindingsIntoQuery($query, $bindings) |
||
174 | } |
||
175 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.