Skip to content

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
miya0001 committed Dec 24, 2016
2 parents a03713b + 17d9e5d commit ee658ce
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/Context/RawWordPressContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ protected function get_contents( $url, $method = 'GET', $params = array() )
*/
protected function login( $user, $password )
{
$this->getSession( 'default' )->visit( $this->locatePath( '/wp-login.php' ) );
$this->getSession()->visit( $this->locatePath( '/wp-login.php' ) );
$this->wait_the_element( "#loginform" );

$element = $this->getSession( 'default' )->getPage();
$element = $this->getSession()->getPage();
$element->fillField( "user_login", $user );
$element->fillField( "user_pass", $password );

Expand Down Expand Up @@ -154,7 +154,7 @@ protected function login( $user, $password )
*/
protected function is_current_url( $url )
{
$current_url = $this->getSession( 'default' )->getCurrentUrl();
$current_url = $this->getSession()->getCurrentUrl();

if ( $url === substr( $current_url, 0 - strlen( $url ) ) ) {
return true;
Expand All @@ -176,15 +176,15 @@ protected function logout()
return; // user isn't login.
}

$page = $this->getSession( 'default' )->getPage();
$page = $this->getSession()->getPage();
$logout = $page->find( "css", "#wp-admin-bar-logout a" );

if ( ! empty( $logout ) ) {
$this->getSession( 'default' )->visit( $this->locatePath( $logout->getAttribute( "href" ) ) );
$this->getSession()->visit( $this->locatePath( $logout->getAttribute( "href" ) ) );

for ( $i = 0; $i < $this->timeout; $i++ ) {
try {
$url = $this->getSession( 'default' )->getCurrentUrl();
$url = $this->getSession()->getCurrentUrl();
if ( strpos( $url, "loggedout=true" ) ) {
return true;
}
Expand All @@ -207,7 +207,7 @@ protected function logout()
*/
protected function is_logged_in()
{
$page = $this->getSession( 'default' )->getPage();
$page = $this->getSession()->getPage();
if ( $page->find( "css", ".logged-in" ) ) {
return true;
} elseif ( $page->find( "css", ".wp-admin" ) ) {
Expand All @@ -226,7 +226,7 @@ protected function is_logged_in()
*/
protected function wait_the_element( $selector )
{
$page = $this->getSession( 'default' )->getPage();
$page = $this->getSession()->getPage();
$element = $page->find( 'css', $selector );

for ( $i = 0; $i < $this->timeout; $i++ ) {
Expand Down Expand Up @@ -257,7 +257,7 @@ protected function get_plugins()
throw new \Exception( "You are not logged in" );
}

$session = $this->getSession( 'default' );
$session = $this->getSession();
$session->visit( $this->locatePath( $this->get_admin_url() . '/plugins.php' ) );
$page = $session->getPage();
$e = $page->findAll( 'css', "#the-list tr" );
Expand Down Expand Up @@ -295,8 +295,8 @@ protected function get_current_theme()
throw new \Exception( "You are not logged in" );
}

$this->getSession( 'default' )->visit( $this->locatePath( $this->get_admin_url() . '/themes.php' ) );
$page = $this->getSession( 'default' )->getPage();
$this->getSession()->visit( $this->locatePath( $this->get_admin_url() . '/themes.php' ) );
$page = $this->getSession()->getPage();
$e = $page->find( 'css', ".theme.active" );
if ( $e ) {
$theme = $e->getAttribute( "data-slug" );
Expand All @@ -316,8 +316,8 @@ protected function get_current_theme()
*/
protected function get_wp_version()
{
$this->getSession( 'default' )->visit( $this->locatePath( '/' ) );
$page = $this->getSession( 'default' )->getPage();
$this->getSession()->visit( $this->locatePath( '/' ) );
$page = $this->getSession()->getPage();
$meta = $page->find( 'css', "meta[name=generator]" );
if ( $meta ) {
$version = $meta->getAttribute( "content" );
Expand Down

0 comments on commit ee658ce

Please sign in to comment.