Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
OpsPortal
lavoisiercli
Commits
8d2422b6
Commit
8d2422b6
authored
Feb 04, 2016
by
Thibaut Salanon
Browse files
add port with hostname
parent
7b2efebb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
2 deletions
+41
-2
.gitignore
.gitignore
+1
-0
src/Lavoisier/Query.php
src/Lavoisier/Query.php
+27
-2
tests/QueryTest.php
tests/QueryTest.php
+13
-0
No files found.
.gitignore
View file @
8d2422b6
/vendor/
/composer.lock
/.idea/
src/Lavoisier/Query.php
View file @
8d2422b6
...
...
@@ -42,8 +42,18 @@ class Query
public
function
__construct
(
$hostname
,
$view
=
''
,
$operation
=
'lavoisier'
,
$accept
=
'xml'
)
{
$this
->
setSecureMode
(
false
);
$this
->
hostname
=
$hostname
;
$this
->
port
=
'8080'
;
if
(
parse_url
(
$hostname
,
PHP_URL_HOST
)
!=
null
){
$this
->
hostname
=
parse_url
(
$hostname
,
PHP_URL_HOST
);
}
else
{
$this
->
hostname
=
parse_url
(
$hostname
,
PHP_URL_PATH
);
}
if
(
parse_url
(
$hostname
,
PHP_URL_PORT
)
!=
null
){
$this
->
port
=
strval
(
parse_url
(
$hostname
,
PHP_URL_PORT
));
}
else
{
$this
->
port
=
'8080'
;
}
$this
->
operation
=
$operation
;
$this
->
view
=
$view
;
$this
->
path
=
''
;
...
...
@@ -83,6 +93,21 @@ class Query
$this
->
port
=
$port
;
}
public
function
getPort
()
{
return
$this
->
port
;
}
public
function
getHostname
()
{
return
$this
->
hostname
;
}
public
function
setHostname
(
$hostname
)
{
$this
->
hostname
=
$hostname
;
}
public
function
setOperation
(
$operation
)
{
$this
->
operation
=
$operation
;
...
...
tests/QueryTest.php
View file @
8d2422b6
...
...
@@ -90,4 +90,17 @@ class QueryTest extends \PHPUnit_Framework_TestCase
}
public
function
testParsedUrl
(){
$q
=
new
Query
(
'cclavoisierfr.in2p3.fr:8080'
,
'OPSCORE_SITE'
,
'lavoisier'
);
$this
->
assertEquals
(
'cclavoisierfr.in2p3.fr'
,
$q
->
getHostname
());
$this
->
assertEquals
(
'8080'
,
$q
->
getPort
());
$q
=
new
Query
(
'cclavoisierfr.in2p3.fr'
,
'OPSCORE_SITE'
,
'lavoisier'
);
$this
->
assertEquals
(
'cclavoisierfr.in2p3.fr'
,
$q
->
getHostname
());
$this
->
assertEquals
(
'8080'
,
$q
->
getPort
());
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment