Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix issue #5163 #5236

Merged
merged 4 commits into from
Dec 18, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Codeception/Step.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Codeception\Step\Argument\FormattedOutput;
use Codeception\Step\Meta as MetaStep;
use Codeception\Util\Locator;
use PHPUnit\Framework\MockObject\MockObject;

abstract class Step
{
Expand Down Expand Up @@ -173,7 +174,7 @@ protected function getClassName($argument)
{
if ($argument instanceof \Closure) {
return 'Closure';
} elseif ((isset($argument->__mocked))) {
span class="pl-s1"> } elseif ($argument instanceof MockObject) {
dh9325 marked this conversation as resolved.
Show resolved Hide resolved
return $this->formatClassName($argument->__mocked);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, what if there is no __mocked property but an object is still MockObject?

Copy link
Contributor Author

@dh9325 dh9325 Nov 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavertMik Have applied changes as requested but AppVeyor build failed (it looks like AppVeyor error)

elseif ($argument instanceof MockObject && isset($argument->__mocked) are you happy with this?

}

Expand Down
4 changes: 4 additions & 0 deletions tests/unit/Codeception/StepTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use Codeception\Util\Stub;
use Facebook\WebDriver\WebDriverBy;
use Codeception\Util\Locator;

Expand Down Expand Up @@ -32,6 +33,9 @@ public function testGetArguments()

$step = $this->getStep([null, [['PDO', 'getAvailableDrivers']]]);
$this->assertEquals('["PDO","getAvailableDrivers"]', $step->getArgumentsAsString());

$step = $this->getStep([null, [[Stub::make($this, []), 'testGetArguments']]]);
$this->assertEquals('["StepTest","testGetArguments"]', $step->getArgumentsAsString());
}

public function testGetHtml()
Expand Down