FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
framework/tests/Database/DatabaseMigrationCreatorTest.php at master · JavaDevl/framework · GitHub
JavaDevl
/
framework
Public
forked from
laravel/framework
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
framework
/
tests
/
Database
/
DatabaseMigrationCreatorTest.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
54 lines (42 loc) · 2.16 KB
Breadcrumbs
framework
/
tests
/
Database
/
DatabaseMigrationCreatorTest.php
Copy path
File metadata and controls
executable file
·
54 lines (42 loc) · 2.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
use
Mockery
as
m
;
class
DatabaseMigrationCreatorTest
extends
PHPUnit_Framework_TestCase
{
public
function
tearDown
()
{
m::
close
();
}
public
function
testBasicCreateMethodStoresMigrationFile
()
{
$
creator
=
$
this
->
getCreator
();
unset(
$
_SERVER
[
'
__migration.creator
'
]);
$
creator
->
afterCreate
(
function
() {
$
_SERVER
[
'
__migration.creator
'
] =
true
; });
$
creator
->
expects
(
$
this
->
any
())->
method
(
'
getDatePrefix
'
)->
will
(
$
this
->
returnValue
(
'
foo
'
));
$
creator
->
getFilesystem
()->
shouldReceive
(
'
get
'
)->
once
()->
with
(
$
creator
->
getStubPath
().
'
/blank.stub
'
)->
andReturn
(
'
DummyClass
'
);
$
creator
->
getFilesystem
()->
shouldReceive
(
'
put
'
)->
once
()->
with
(
'
foo/foo_create_bar.php
'
,
'
CreateBar
'
);
$
creator
->
create
(
'
create_bar
'
,
'
foo
'
);
$
this
->
assertTrue
(
$
_SERVER
[
'
__migration.creator
'
]);
unset(
$
_SERVER
[
'
__migration.creator
'
]);
}
public
function
testTableUpdateMigrationStoresMigrationFile
()
{
$
creator
=
$
this
->
getCreator
();
$
creator
->
expects
(
$
this
->
any
())->
method
(
'
getDatePrefix
'
)->
will
(
$
this
->
returnValue
(
'
foo
'
));
$
creator
->
getFilesystem
()->
shouldReceive
(
'
get
'
)->
once
()->
with
(
$
creator
->
getStubPath
().
'
/update.stub
'
)->
andReturn
(
'
DummyClass DummyTable
'
);
$
creator
->
getFilesystem
()->
shouldReceive
(
'
put
'
)->
once
()->
with
(
'
foo/foo_create_bar.php
'
,
'
CreateBar baz
'
);
$
creator
->
create
(
'
create_bar
'
,
'
foo
'
,
'
baz
'
);
}
public
function
testTableCreationMigrationStoresMigrationFile
()
{
$
creator
=
$
this
->
getCreator
();
$
creator
->
expects
(
$
this
->
any
())->
method
(
'
getDatePrefix
'
)->
will
(
$
this
->
returnValue
(
'
foo
'
));
$
creator
->
getFilesystem
()->
shouldReceive
(
'
get
'
)->
once
()->
with
(
$
creator
->
getStubPath
().
'
/create.stub
'
)->
andReturn
(
'
DummyClass DummyTable
'
);
$
creator
->
getFilesystem
()->
shouldReceive
(
'
put
'
)->
once
()->
with
(
'
foo/foo_create_bar.php
'
,
'
CreateBar baz
'
);
$
creator
->
create
(
'
create_bar
'
,
'
foo
'
,
'
baz
'
,
true
);
}
protected
function
getCreator
()
{
$
files
= m::
mock
(
'
Illuminate\Filesystem\Filesystem
'
);
return
$
this
->
getMock
(
'
Illuminate\Database\Migrations\MigrationCreator
'
, [
'
getDatePrefix
'
], [
$
files
]);
}
}
Back
|
FazBrowse Home
|
New Git URL