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

[PHP] Run unit tests on 'tests' directory #7675

Merged
merged 3 commits into from
Feb 22, 2018

Conversation

ackintosh
Copy link
Contributor

@ackintosh ackintosh commented Feb 16, 2018

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: 3.0.0 branch for changes related to OpenAPI spec 3.0. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

By #7200, the test directory is completely cleaned and all the test code is integrated into tests. So we have to run unit tests which in the tests directory.

@ackintosh
Copy link
Contributor Author

https://travis-ci.org/swagger-api/swagger-codegen/builds/342288933#L5767

🤔 💦

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (bundle-test) on project PhpPetstoreClientTests: Command execution failed. Cannot run program "vendor/bin/phpunit tests" (in directory "/home/travis/build/swagger-api/swagger-codegen/samples/client/petstore/php/SwaggerClient-php"): error=2, No such file or directory -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :PhpPetstoreClientTests

@wing328
Copy link
Contributor

wing328 commented Feb 18, 2018

@ackintosh no worry. I'll take a look later this week.

@@ -46,7 +46,7 @@
<goal>exec</goal>
</goals>
<configuration>
<executable>vendor/bin/phpunit</executable>
<executable>vendor/bin/phpunit tests</executable>
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to do something like the following instead:

                        <configuration>
                            <executable>vendor/bin/phpunit</executable>
                            <arguments>
                                <argument>tests</argument>
                            </arguments>
                        </configuration>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks 😭 ✨

@ackintosh
Copy link
Contributor Author

ackintosh commented Feb 19, 2018

https://travis-ci.org/swagger-api/swagger-codegen/builds/343299617?utm_source=github_status&utm_medium=notification

  1. Swagger\Client\PetApiTest::testInvalidArgument
    Failed asserting that exception of type "\InvalidArgumentException" is thrown.

public function testInvalidArgument()
{
// the argument is required, and we must specify one or some from 'available', 'pending', 'sold'
$this->api->findPetsByStatus([]);
}

hmm...
I think this means that we have a different issue: PetApi::findPetsByStatus() accepts an empty array 😕
PetApi::findPetsByStatus() should throw an exception if an empty array is passed.

@wing328 wing328 merged commit 91bd7ac into swagger-api:master Feb 22, 2018
@ackintosh ackintosh deleted the run-unit-test-on-tests-dir branch February 24, 2018 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants