|
2 | 2 |
|
3 | 3 | namespace Illuminate\Tests\Database;
|
4 | 4 |
|
5 |
| -use Illuminate\Database\ConnectionInterface; |
6 | 5 | use Illuminate\Database\Query\Builder;
|
7 | 6 | use Illuminate\Database\Query\Expression;
|
8 | 7 | use Illuminate\Database\Query\Grammars\Grammar;
|
9 |
| -use Illuminate\Database\Query\Processors\Processor; |
10 | 8 | use Mockery as m;
|
11 | 9 | use PHPUnit\Framework\TestCase;
|
12 | 10 | use ReflectionClass;
|
@@ -43,79 +41,4 @@ public function testWhereRawReturnsStringWhenStringPassed()
|
43 | 41 |
|
44 | 42 | $this->assertSame('select * from "users"', $rawQuery);
|
45 | 43 | }
|
46 |
| - |
47 |
| - public function testCompileInsertSingleValue() |
48 |
| - { |
49 |
| - $builder = $this->getBuilder(); |
50 |
| - $grammar = $builder->getGrammar(); |
51 |
| - |
52 |
| - $sql = $grammar-> compileInsert( $builder, [ 'name' => 'John Doe', 'email' => '[email protected]']); |
53 |
| - $this->assertSame('insert into "users" ("name", "email") values (?, ?)', $sql); |
54 |
| - } |
55 |
| - |
56 |
| - public function testCompileInsertMultipleValues() |
57 |
| - { |
58 |
| - $builder = $this->getBuilder(); |
59 |
| - $grammar = $builder->getGrammar(); |
60 |
| - $values = [ |
61 |
| - [ 'name' => 'John Doe', 'email' => '[email protected]'], |
62 |
| - [ 'name' => 'Alice Wong', 'email' => '[email protected]'], |
63 |
| - ]; |
64 |
| - |
65 |
| - $sql = $grammar->compileInsert($builder, $values); |
66 |
| - $this->assertSame('insert into "users" ("name", "email") values (?, ?), (?, ?)', $sql); |
67 |
| - } |
68 |
| - |
69 |
| - public function testCompileInsertSingleValueWhereFirstKeyIsArray() |
70 |
| - { |
71 |
| - $builder = $this->getBuilder(); |
72 |
| - $grammar = $builder->getGrammar(); |
73 |
| - $value = [ |
74 |
| - 'configuration' => [ |
75 |
| - 'dark_mode' => false, |
76 |
| - 'language' => 'en', |
77 |
| - ], |
78 |
| - 'name' => 'John Doe', |
79 |
| - |
80 |
| - ]; |
81 |
| - |
82 |
| - $sql = $grammar->compileInsert($builder, $value); |
83 |
| - |
84 |
| - $this->assertSame('insert into "users" ("configuration", "name", "email") values (?, ?, ?)', $sql); |
85 |
| - } |
86 |
| - |
87 |
| - public function testCompileInsertSingleValueWhereFirstKeyIsNotArray() |
88 |
| - { |
89 |
| - $builder = $this->getBuilder(); |
90 |
| - $grammar = $builder->getGrammar(); |
91 |
| - |
92 |
| - $value = [ |
93 |
| - 'name' => 'John Doe', |
94 |
| - 'configuration' => [ |
95 |
| - 'dark_mode' => false, |
96 |
| - 'language' => 'en', |
97 |
| - ], |
98 |
| - |
99 |
| - ]; |
100 |
| - |
101 |
| - $sql = $grammar->compileInsert($builder, $value); |
102 |
| - |
103 |
| - $this->assertSame('insert into "users" ("name", "configuration", "email") values (?, ?, ?)', $sql); |
104 |
| - } |
105 |
| - |
106 |
| - protected function getConnection() |
107 |
| - { |
108 |
| - return m::mock(ConnectionInterface::class); |
109 |
| - } |
110 |
| - |
111 |
| - protected function getBuilder($tableName = 'users') |
112 |
| - { |
113 |
| - $grammar = new Grammar; |
114 |
| - $processor = m::mock(Processor::class); |
115 |
| - |
116 |
| - $builder = new Builder($this->getConnection(), $grammar, $processor); |
117 |
| - $builder->from = $tableName; |
118 |
| - |
119 |
| - return $builder; |
120 |
| - } |
121 | 44 | }
|
0 commit comments