From 652f2dc3dc58e66c245b6604a484632d66711ae7 Mon Sep 17 00:00:00 2001 From: busayo Date: Sun, 31 Jan 2016 18:06:08 +0100 Subject: [PATCH 1/8] docs(changelog): Update changelog --- CHANGELOG.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f1b010..982753c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,5 +2,9 @@ All Notable changes to `laravel-quotes` will be documented in this file -## 2016-01-31 -- Initial release \ No newline at end of file +## 2016-01-31 - 1.0.0 +- Initial release + +## 2016-01-31 - 1.0.1 +- Add BlessUp() method to retrieve all keys to success that are blessed up! +- Add text to voice ability for DJkhaled quotes. The quotes are automatically read out via the terminal when you run `php artisan djkhaled:inspire`. Currently works on Mac \ No newline at end of file From 5f5eb93a4bcf18ff60da8984ed41de49ad0dc3e2 Mon Sep 17 00:00:00 2001 From: busayo Date: Mon, 1 Feb 2016 04:38:55 +0100 Subject: [PATCH 2/8] feat(quotes): Add tests --- .gitignore | 3 ++ src/Quotes.php | 4 +- tests/QuotesTest.php | 105 +++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 107 insertions(+), 5 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..65ec400 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.lock +build \ No newline at end of file diff --git a/src/Quotes.php b/src/Quotes.php index c85c1f3..2d8b294 100644 --- a/src/Quotes.php +++ b/src/Quotes.php @@ -30,10 +30,10 @@ class Quotes { private function getQuotes($category = null) { if(is_null($category)) { - return require_once("Quotes/programming.php"); + return require("Quotes/programming.php"); } - return require_once("Quotes/{$category}.php"); + return require("Quotes/{$category}.php"); } /** diff --git a/tests/QuotesTest.php b/tests/QuotesTest.php index dfff5e8..3aac841 100644 --- a/tests/QuotesTest.php +++ b/tests/QuotesTest.php @@ -11,15 +11,114 @@ namespace Unicodeveloper\Quotes\Test; +use ReflectionClass; use PHPUnit_Framework_TestCase; +use Unicodeveloper\Quotes\Quotes; +use Illuminate\Support\Collection; class QuotesTest extends PHPUnit_Framework_TestCase { + protected $quotes; + + public function setUp() + { + $this->quotes = new Quotes; + } + + /** + * Test the private GetQuotes method for design category + * @return boolean + */ + public function testGetQuotesWithDesignCategory() + { + $result = $this->invokeMethod($this->quotes, 'getQuotes', ['design']); + + $this->assertEquals($this->getTotalNumberOfQuotes('design'), count($result)); + } + + /** + * Test the private GetQuotes method for programming category + * @return boolean + */ + public function testGetQuotesWithProgrammingCategory() + { + $result = $this->invokeMethod($this->quotes, 'getQuotes', ['programming']); + + $this->assertEquals($this->getTotalNumberOfQuotes('programming'), count($result)); + } + + /** + * Test the private GetQuotes method for djkhaled category + * @return boolean + */ + public function testGetQuotesWithDjkhaledCategory() + { + $result = $this->invokeMethod($this->quotes, 'getQuotes', ['djkhaled']); + + $this->assertEquals($this->getTotalNumberOfQuotes('djkhaled'), count($result)); + } + + /** + * Test the private GetQuotes method if there is no category input + * @return boolean + */ + public function testGetQuotesWithNullCategory() + { + $result = $this->invokeMethod($this->quotes, 'getQuotes', []); + + $this->assertEquals($this->getTotalNumberOfQuotes('programming'), count($result)); + } + + /** + * Test random() actually returns a random quote + * @return boolean + */ + public function testRandomReturnsARandomQuote() + { + $result = $this->quotes->design()->random(); + + $this->assertEquals(1, count($result)); + } + + /** + * Test all() actually returns all the quotes + * @return boolean + */ + public function testAllReturnsAllQuotes() + { + $result = $this->quotes->programming()->all(); + + $this->assertEquals($this->getTotalNumberOfQuotes('programming'), count($result)); + } + + /** + * Get the number of results based on the category of quotes + * @param $category + * @return integer + */ + private function getTotalNumberOfQuotes($category) + { + $result = require( __DIR__ . "/../src/Quotes/{$category}.php"); + + return count($result); + } + /** - * Test that true does in fact equal true + * Call protected/private method of a class. + * + * @param object &$object Instantiated object that we will run method on. + * @param string $methodName Method name to call + * @param array $parameters Array of parameters to pass into method. + * + * @return mixed Method return. */ - public function testTrueIsTrue() + private function invokeMethod(&$object, $methodName, array $parameters = array()) { - $this->assertTrue(true); + $reflection = new ReflectionClass(get_class($object)); + $method = $reflection->getMethod($methodName); + $method->setAccessible(true); + + return $method->invokeArgs($object, $parameters); } + } \ No newline at end of file From 0feb86075a9c6f18992231b142f2bf9b59c335b9 Mon Sep 17 00:00:00 2001 From: busayo Date: Mon, 1 Feb 2016 04:53:00 +0100 Subject: [PATCH 3/8] docs(readme): Add coveralls badge --- .travis.yml | 1 + README.md | 1 + composer.json | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c54b003..41b2705 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,7 @@ script: after_script: - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover coverage.clover + - php vendor/bin/coveralls -v notifications: slack: red-creek:5lI8ybvl6YTcCNPosh4TE13h \ No newline at end of file diff --git a/README.md b/README.md index 7294273..6205665 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ ![](https://img.shields.io/badge/unicodeveloper-approved-brightgreen.svg) [![License](https://poser.pugx.org/unicodeveloper/laravel-quotes/license.svg)](LICENSE.md) [![Build Status](https://img.shields.io/travis/unicodeveloper/laravel-quotes.svg)](https://travis-ci.org/unicodeveloper/laravel-quotes) +[![Coverage Status](https://coveralls.io/repos/unicodeveloper/laravel-quotes/badge.svg?branch=master&service=github)](https://coveralls.io/github/unicodeveloper/laravel-quotes?branch=master) [![Quality Score](https://img.shields.io/scrutinizer/g/unicodeveloper/laravel-quotes.svg?style=flat-square)](https://scrutinizer-ci.com/g/unicodeveloper/laravel-quotes) [![Total Downloads](https://img.shields.io/packagist/dt/unicodeveloper/laravel-quotes.svg?style=flat-square)](https://packagist.org/packages/unicodeveloper/laravel-quotes) diff --git a/composer.json b/composer.json index e83d119..51686eb 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,8 @@ }, "require-dev": { "phpunit/phpunit" : "4.*", - "scrutinizer/ocular": "~1.1" + "scrutinizer/ocular": "~1.1", + "satooshi/php-coveralls": "^0.7.0" }, "autoload": { "psr-4": { From 06b65077a35911ddbf7e432bd3569a5e3ea8aa05 Mon Sep 17 00:00:00 2001 From: busayo Date: Mon, 1 Feb 2016 04:56:15 +0100 Subject: [PATCH 4/8] chore(travis): modify script to create logs directory and run coverage --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 41b2705..70c0e56 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,9 @@ matrix: install: travis_retry composer install --no-interaction --prefer-source script: + - mkdir -p build/logs - phpunit --coverage-text --coverage-clover=coverage.clover + - phpunit --coverage-clover build/logs/clover.xml after_script: - wget https://scrutinizer-ci.com/ocular.phar From a2c2f8edd38e527cfb91895a45936e7ef53c4eac Mon Sep 17 00:00:00 2001 From: busayo Date: Mon, 1 Feb 2016 05:14:35 +0100 Subject: [PATCH 5/8] docs(readme): Update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6205665..31a3268 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ![](https://img.shields.io/badge/unicodeveloper-approved-brightgreen.svg) [![License](https://poser.pugx.org/unicodeveloper/laravel-quotes/license.svg)](LICENSE.md) [![Build Status](https://img.shields.io/travis/unicodeveloper/laravel-quotes.svg)](https://travis-ci.org/unicodeveloper/laravel-quotes) -[![Coverage Status](https://coveralls.io/repos/unicodeveloper/laravel-quotes/badge.svg?branch=master&service=github)](https://coveralls.io/github/unicodeveloper/laravel-quotes?branch=master) +[![Coverage Status](https://coveralls.io/repos/unicodeveloper/laravel-quotes/badge.svg?branch=master&service=github)](https://coveralls.io/github/unicodeveloper/laravel-quotes) [![Quality Score](https://img.shields.io/scrutinizer/g/unicodeveloper/laravel-quotes.svg?style=flat-square)](https://scrutinizer-ci.com/g/unicodeveloper/laravel-quotes) [![Total Downloads](https://img.shields.io/packagist/dt/unicodeveloper/laravel-quotes.svg?style=flat-square)](https://packagist.org/packages/unicodeveloper/laravel-quotes) From 2c5497d69b1267b39ab6335fce58f5d6dfc15bd4 Mon Sep 17 00:00:00 2001 From: busayo Date: Mon, 1 Feb 2016 05:26:48 +0100 Subject: [PATCH 6/8] chore(travis): Battling and trying to fix coveralls --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 70c0e56..2185801 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,13 +14,14 @@ install: travis_retry composer install --no-interaction --prefer-source script: - mkdir -p build/logs + - php vendor/bin/phpunit -c phpunit.xml.dist - phpunit --coverage-text --coverage-clover=coverage.clover - phpunit --coverage-clover build/logs/clover.xml after_script: - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover coverage.clover - - php vendor/bin/coveralls -v + - travis_retry php vendor/bin/coveralls -v notifications: slack: red-creek:5lI8ybvl6YTcCNPosh4TE13h \ No newline at end of file From f0a77cb0d371bdc8107a5b227ab2247b9b1fbf5b Mon Sep 17 00:00:00 2001 From: busayo Date: Mon, 1 Feb 2016 05:50:11 +0100 Subject: [PATCH 7/8] docs(readme): Add coverall badges :key: --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 31a3268..fc0ff73 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ![](https://img.shields.io/badge/unicodeveloper-approved-brightgreen.svg) [![License](https://poser.pugx.org/unicodeveloper/laravel-quotes/license.svg)](LICENSE.md) [![Build Status](https://img.shields.io/travis/unicodeveloper/laravel-quotes.svg)](https://travis-ci.org/unicodeveloper/laravel-quotes) -[![Coverage Status](https://coveralls.io/repos/unicodeveloper/laravel-quotes/badge.svg?branch=master&service=github)](https://coveralls.io/github/unicodeveloper/laravel-quotes) +[![Coverage Status](https://coveralls.io/repos/github/unicodeveloper/laravel-quotes/badge.svg?branch=master)](https://coveralls.io/github/unicodeveloper/laravel-quotes?branch=master) [![Quality Score](https://img.shields.io/scrutinizer/g/unicodeveloper/laravel-quotes.svg?style=flat-square)](https://scrutinizer-ci.com/g/unicodeveloper/laravel-quotes) [![Total Downloads](https://img.shields.io/packagist/dt/unicodeveloper/laravel-quotes.svg?style=flat-square)](https://packagist.org/packages/unicodeveloper/laravel-quotes) From 66e5980afb1c8a156f7371d7e7b1c341bd950eb6 Mon Sep 17 00:00:00 2001 From: MK Date: Sun, 13 Mar 2016 13:46:10 -0400 Subject: [PATCH 8/8] Added some more quotes --- src/Quotes/programming.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Quotes/programming.php b/src/Quotes/programming.php index 6bd0029..02404c2 100644 --- a/src/Quotes/programming.php +++ b/src/Quotes/programming.php @@ -61,4 +61,6 @@ "One of my most productive days was throwing away 1000 lines of code. - Ken Thompson", "Deleted code is debugged code. - Jeff Sickel", "Controlling complexity is the essence of computer programming. - Brian Kernighan", + "Just heard a QA \"Engineeer\" ask a customer on the phone - \"What made you wanna do THAT!??\" - Kevin Marois", + "The main purpose of multidimensional arrays in C++ is to confuse beginners and generate an endless stream of questions about how to allocate them dynamically, about how to delete them, or why they can't be converted to pointers to pointers. – R. Martinho Fernandes", ];