@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | m::mock('Pyjac\ORM\DatabaseConnectionStringFactoryInterface'); |
22 | 22 | |
23 | 23 | $databaseConnectionStringFactory->shouldReceive('createDatabaseSourceString') |
24 | - ->with(['DRIVER' => 'sqlite', 'HOSTNAME' => '127.0.0.1', 'USERNAME' => '', 'PASSWORD' => '', 'DBNAME' => 'potatoORM', 'PORT' => '54320'])->once()->andReturn('sqlite::memory:'); |
|
24 | + ->with(['DRIVER' => 'sqlite', 'HOSTNAME' => '127.0.0.1', 'USERNAME' => '', 'PASSWORD' => '', 'DBNAME' => 'potatoORM', 'PORT' => '54320'])->once()->andReturn('sqlite::memory:'); |
|
25 | 25 | |
26 | 26 | $this->databaseConnection = m::mock('Pyjac\ORM\DatabaseConnection'); |
27 | 27 | |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | { |
37 | 37 | $this->databaseConnection->shouldReceive('createConnection')->with('sqlite::memory:')->once()->andReturn(''); |
38 | 38 | $this->model->expects($this->any()) |
39 | - ->method('getTableName') |
|
40 | - ->will($this->returnValue(strtolower(get_class($this->model).'s'))); |
|
39 | + ->method('getTableName') |
|
40 | + ->will($this->returnValue(strtolower(get_class($this->model).'s'))); |
|
41 | 41 | |
42 | 42 | $this->assertEquals($this->model->getTableName(), strtolower(get_class($this->model).'s')); |
43 | 43 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | $databaseConnectionStringFactory = |
16 | 16 | m::mock('Pyjac\ORM\DatabaseConnectionStringFactoryInterface'); |
17 | 17 | $databaseConnectionStringFactory->shouldReceive('createDatabaseSourceString') |
18 | - ->with(['DRIVER' => 'sqlite', 'HOSTNAME' => '127.0.0.1', 'USERNAME' => '', 'PASSWORD' => '', 'DBNAME' => 'potatoORM', 'PORT' => '54320'])->once()->andReturn('sqlite::memory:'); |
|
18 | + ->with(['DRIVER' => 'sqlite', 'HOSTNAME' => '127.0.0.1', 'USERNAME' => '', 'PASSWORD' => '', 'DBNAME' => 'potatoORM', 'PORT' => '54320'])->once()->andReturn('sqlite::memory:'); |
|
19 | 19 | |
20 | 20 | $this->databaseConnection = new DatabaseConnection($databaseConnectionStringFactory); |
21 | 21 | } |
@@ -160,16 +160,16 @@ |
||
160 | 160 | ]); |
161 | 161 | } |
162 | 162 | |
163 | - /** |
|
164 | - * Load needed configuration values from the .env file using Dotenv. |
|
165 | - * |
|
166 | - * @return void |
|
167 | - */ |
|
168 | - public function loadEnv() |
|
169 | - { |
|
170 | - if (!getenv('APP_ENV')) { |
|
171 | - $dotenv = new \Dotenv\Dotenv(__DIR__.'/../../../'); |
|
172 | - $dotenv->overload(); |
|
173 | - } |
|
174 | - } |
|
163 | + /** |
|
164 | + * Load needed configuration values from the .env file using Dotenv. |
|
165 | + * |
|
166 | + * @return void |
|
167 | + */ |
|
168 | + public function loadEnv() |
|
169 | + { |
|
170 | + if (!getenv('APP_ENV')) { |
|
171 | + $dotenv = new \Dotenv\Dotenv(__DIR__.'/../../../'); |
|
172 | + $dotenv->overload(); |
|
173 | + } |
|
174 | + } |
|
175 | 175 | } |
@@ -24,23 +24,23 @@ discard block |
||
24 | 24 | */ |
25 | 25 | protected $databaseConnection; |
26 | 26 | |
27 | - /** |
|
28 | - * The id of the model. |
|
29 | - * |
|
30 | - * @property string $id |
|
31 | - */ |
|
32 | - |
|
33 | - /** |
|
34 | - * Create a model instance. |
|
35 | - */ |
|
36 | - public function __construct(DatabaseConnectionInterface $databaseConnection = null) |
|
37 | - { |
|
27 | + /** |
|
28 | + * The id of the model. |
|
29 | + * |
|
30 | + * @property string $id |
|
31 | + */ |
|
32 | + |
|
33 | + /** |
|
34 | + * Create a model instance. |
|
35 | + */ |
|
36 | + public function __construct(DatabaseConnectionInterface $databaseConnection = null) |
|
37 | + { |
|
38 | 38 | if ($databaseConnection == null) { |
39 | 39 | $this->databaseConnection = DatabaseConnection::getInstance()->databaseConnection; |
40 | 40 | } else { |
41 | 41 | $this->databaseConnection = $databaseConnection; |
42 | 42 | } |
43 | - } |
|
43 | + } |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Sets into $properties the $key => $value pairs. |
@@ -65,23 +65,23 @@ discard block |
||
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | - /** |
|
69 | - * Get all the model properties. |
|
70 | - * |
|
71 | - * @return array |
|
72 | - */ |
|
73 | - public function getProperties() |
|
74 | - { |
|
75 | - return $this->properties; |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * Set model properties. |
|
80 | - */ |
|
81 | - public function setProperties(array $properties) |
|
82 | - { |
|
83 | - $this->properties = $properties; |
|
84 | - } |
|
68 | + /** |
|
69 | + * Get all the model properties. |
|
70 | + * |
|
71 | + * @return array |
|
72 | + */ |
|
73 | + public function getProperties() |
|
74 | + { |
|
75 | + return $this->properties; |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * Set model properties. |
|
80 | + */ |
|
81 | + public function setProperties(array $properties) |
|
82 | + { |
|
83 | + $this->properties = $properties; |
|
84 | + } |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Pluralize the name of the child class. |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | class User extends Model |
8 | 8 | { |
9 | - //protected $table = 'users'; |
|
9 | + //protected $table = 'users'; |
|
10 | 10 | } |
11 | 11 | |
12 | 12 |