FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
lhttps/tests/InitTest.php at dev · madeny/lhttps · GitHub
madeny
/
lhttps
Public
Notifications
You must be signed in to change notification settings
Fork
17
Star
176
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
lhttps
/
tests
/
InitTest.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
129 lines (77 loc) · 2.2 KB
Breadcrumbs
lhttps
/
tests
/
InitTest.php
Copy path
File metadata and controls
129 lines (77 loc) · 2.2 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
declare
(strict_types=
1
);
use
PHPUnit
\
Framework
\
TestCase
;
use
Madeny
\
lhttps
\
Config
;
use
Madeny
\
lhttps
\
Init
;
class
InitTest
extends
TestCase {
/** @test */
public
function
it_can_instance_CreatorCommand
() {
$
this
->
assertInstanceOf
(Init::class, (
new
Init
(
"
madeny.dev
"
)));
}
/** @test */
public
function
init_cert_directory
() {
$
path
= Config::
path
();
$
init
=
new
Init
(
"
madeny.dev
"
);
$
dirs
=
$
init
->
dirs
;
foreach
(
$
dirs
as
$
d
) {
$
this
->
assertEquals
(
1
,
file_exists
(
$
path
.
"
/
"
.
$
d
));
}
}
/** @test */
function
it_can_generate_root_key
()
{
$
path
= Config::
path
();
$
init
=
new
Init
(
"
madeny.dev
"
);
$
log
=
$
init
->
keygen
(
$
path
);
$
this
->
assertEquals
(
1
,
file_exists
(
$
path
.
"
/keys/root.key
"
));
$
this
->
assertEquals
(
0
,
$
log
);
}
/** @test */
function
it_can_create_ca
()
{
$
path
= Config::
path
();
$
init
=
new
Init
(
"
madeny.dev
"
);
$
log
=
$
init
->
ca
(
$
path
);
$
this
->
assertEquals
(
1
,
file_exists
(
$
path
.
"
/csr/root.pem
"
));
$
this
->
assertEquals
(
0
,
$
log
);
}
/** @test */
function
it_can_generate_domain_cert_key
()
{
$
domain
=
"
madeny.dev
"
;
$
path
= Config::
path
();
$
init
=
new
Init
(
$
domain
);
$
log
=
$
init
->
domain
(
$
path
,
$
domain
);
$
this
->
assertEquals
(
1
,
file_exists
(
$
path
.
"
/live/
$
domain
.ssl.key
"
));
$
this
->
assertEquals
(
0
,
$
log
);
}
/** @test */
function
it_can_sign_domain_ssl_key
()
{
$
domain
=
"
madeny.dev
"
;
$
path
= Config::
path
();
$
init
=
new
Init
(
$
domain
);
$
log
=
$
init
->
sign
(
$
path
,
$
domain
);
$
this
->
assertEquals
(
1
,
file_exists
(
$
path
.
"
/live/
$
domain
.ssl.crt
"
));
$
this
->
assertEquals
(
0
,
$
log
);
}
/** @test */
function
it_can_create_and_sign_domain
()
{
$
domain
=
"
madeny.dev
"
;
$
init
=
new
Init
(
$
domain
);
$
config
=
new
Config
(
$
domain
);
$
path
=
$
config
->
path
();
$
log
=
$
init
->
make
(
$
domain
);
$
file
= [
'
madeny.dev.ssl.crt
'
,
'
madeny.dev.ssl.key
'
];
foreach
(
$
file
as
$
f
) {
$
this
->
assertEquals
(
1
,
file_exists
(
$
path
.
"
/live/
"
.
$
f
));
}
$
sign
=
file_exists
(
$
path
.
"
/live/
$
domain
.ssl.crt
"
);
if
(
$
sign
==
false
) {
$
this
->
assertEquals
(
0
,
$
log
);
}
else
{
$
this
->
assertEquals
(
1
,
$
log
);
}
}
}
Back
|
FazBrowse Home
|
New Git URL