From bf9eb83e1e7fcdefdbc1d32646929bb27fa63938 Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Thu, 7 Oct 2021 12:28:20 -0300 Subject: [PATCH] Exercism: Hello world --- README.md | 2 +- php/hello-world/.exercism/config.json | 12 ++++++ php/hello-world/.exercism/metadata.json | 1 + php/hello-world/HELP.md | 51 +++++++++++++++++++++++++ php/hello-world/HelloWorld.php | 6 +++ php/hello-world/HelloWorldTest.php | 38 ++++++++++++++++++ php/hello-world/README.md | 37 ++++++++++++++++++ 7 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 php/hello-world/.exercism/config.json create mode 100644 php/hello-world/.exercism/metadata.json create mode 100644 php/hello-world/HELP.md create mode 100644 php/hello-world/HelloWorld.php create mode 100644 php/hello-world/HelloWorldTest.php create mode 100644 php/hello-world/README.md diff --git a/README.md b/README.md index c140a64..06f822a 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ THE SOURCE IS PROVIDE AS-IS WITHOUT WARRANTY OF ANY KIND. USE AT YOUR RISK. KEEP | Haskell | I | | Kotlin | I | | Lua | I | -| Objective-C | | +| Objective-C | Out, exercism requires Xcode | | PHP | | | Python | | | Racket | | diff --git a/php/hello-world/.exercism/config.json b/php/hello-world/.exercism/config.json new file mode 100644 index 0000000..d7a6445 --- /dev/null +++ b/php/hello-world/.exercism/config.json @@ -0,0 +1,12 @@ +{ + "blurb": "The classical introductory exercise. Just say \"Hello, World!\"", + "authors": ["duffn"], + "contributors": ["arueckauer", "joseph-walker", "kytrinyx", "petemcfarlane"], + "files": { + "solution": ["HelloWorld.php"], + "test": ["HelloWorldTest.php"], + "example": [".meta/example.php"] + }, + "source": "This is an exercise to introduce users to using Exercism", + "source_url": "http://en.wikipedia.org/wiki/%22Hello,_world!%22_program" +} diff --git a/php/hello-world/.exercism/metadata.json b/php/hello-world/.exercism/metadata.json new file mode 100644 index 0000000..7be0f1a --- /dev/null +++ b/php/hello-world/.exercism/metadata.json @@ -0,0 +1 @@ +{"track":"php","exercise":"hello-world","id":"7b7802f384124a5680659835c6bf3e98","url":"https://exercism.org/tracks/php/exercises/hello-world","handle":"JBiason","is_requester":true,"auto_approve":false} \ No newline at end of file diff --git a/php/hello-world/HELP.md b/php/hello-world/HELP.md new file mode 100644 index 0000000..3425860 --- /dev/null +++ b/php/hello-world/HELP.md @@ -0,0 +1,51 @@ +# Help + +## Running the tests + +## Running the tests + +1. Go to the root of your PHP exercise directory, which is `/php`. + To find the Exercism workspace run + + ➜ exercism debug | grep Workspace + +1. Get [PHPUnit] if you don't have it already. + + ➜ wget -O phpunit https://phar.phpunit.de/phpunit-9.phar + ➜ chmod +x phpunit + ➜ ./phpunit --version + +2. Execute the tests: + + ➜ ./phpunit file_to_test.php + + For example, to run the tests for the Hello World exercise, you would run: + + ➜ ./phpunit HelloWorldTest.php + +[PHPUnit]: http://phpunit.de + +## Submitting your solution + +You can submit your solution using the `exercism submit HelloWorld.php` command. +This command will upload your solution to the Exercism website and print the solution page's URL. + +It's possible to submit an incomplete solution which allows you to: + +- See how others have completed the exercise +- Request help from a mentor + +## Need to get help? + +If you'd like help solving the exercise, check the following pages: + +- The [PHP track's documentation](https://exercism.org/docs/tracks/php) +- [Exercism's support channel on gitter](https://gitter.im/exercism/support) +- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs) + +Should those resources not suffice, you could submit your (incomplete) solution to request mentoring. + +To get help if you're having trouble, you can use one of the following resources: + + - [/r/php](https://www.reddit.com/r/php) is the PHP subreddit. + - [StackOverflow](https://stackoverflow.com/questions/tagged/php) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions. \ No newline at end of file diff --git a/php/hello-world/HelloWorld.php b/php/hello-world/HelloWorld.php new file mode 100644 index 0000000..a017bb7 --- /dev/null +++ b/php/hello-world/HelloWorld.php @@ -0,0 +1,6 @@ +. + * + * To disable strict typing, comment out the directive below. + */ + +declare(strict_types=1); + +class HelloWorldTest extends PHPUnit\Framework\TestCase +{ + public static function setUpBeforeClass(): void + { + require_once 'HelloWorld.php'; + } + + public function testHelloWorld(): void + { + $this->assertEquals('Hello, World!', helloWorld()); + } +} diff --git a/php/hello-world/README.md b/php/hello-world/README.md new file mode 100644 index 0000000..bc43801 --- /dev/null +++ b/php/hello-world/README.md @@ -0,0 +1,37 @@ +# Hello World + +Welcome to Hello World on Exercism's PHP Track. +If you need help running the tests or submitting your code, check out `HELP.md`. + +## Instructions + +The classical introductory exercise. Just say "Hello, World!". + +["Hello, World!"](http://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is +the traditional first program for beginning programming in a new language +or environment. + +The objectives are simple: + +- Write a function that returns the string "Hello, World!". +- Run the test suite and make sure that it succeeds. +- Submit your solution and check it at the website. + +If everything goes well, you will be ready to fetch your first real exercise. + +## Source + +### Created by + +- @duffn + +### Contributed to by + +- @arueckauer +- @joseph-walker +- @kytrinyx +- @petemcfarlane + +### Based on + +This is an exercise to introduce users to using Exercism - http://en.wikipedia.org/wiki/%22Hello,_world!%22_program \ No newline at end of file