From 5360b4bfbda55b9f181093432787f7302e37fd6b Mon Sep 17 00:00:00 2001 From: mabarroso Date: Wed, 8 May 2013 21:38:38 +0200 Subject: [PATCH 01/19] Refactoring --- {css => src/css}/github-embed.css | 0 github-api.php => src/github-api.php | 0 github-embed.php => src/github-embed.php | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename {css => src/css}/github-embed.css (100%) rename github-api.php => src/github-api.php (100%) rename github-embed.php => src/github-embed.php (100%) diff --git a/css/github-embed.css b/src/css/github-embed.css similarity index 100% rename from css/github-embed.css rename to src/css/github-embed.css diff --git a/github-api.php b/src/github-api.php similarity index 100% rename from github-api.php rename to src/github-api.php diff --git a/github-embed.php b/src/github-embed.php similarity index 100% rename from github-embed.php rename to src/github-embed.php From 056b51b73b16593887664a495187767509dfb88a Mon Sep 17 00:00:00 2001 From: mabarroso Date: Wed, 8 May 2013 21:41:02 +0200 Subject: [PATCH 02/19] Plugin packager script --- .gitignore | 1 + tools/release | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100755 .gitignore create mode 100755 tools/release diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..1b81a84 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +out/* diff --git a/tools/release b/tools/release new file mode 100755 index 0000000..476ed49 --- /dev/null +++ b/tools/release @@ -0,0 +1,11 @@ +mkdir out +mkdir out/github-embed +rm out/github-embed/* +cp readme* out/github-embed +cp banner-772x250.png out/github-embed +cp screenshot-* out/github-embed +cp -r src/* out/github-embed +cd out +zip github-embed.zip github-embed/* +tar -cvf github-embed.tar.gz github-embed/* +cd .. From 56bd5822b9fee5962749851b7d046843b2cae441 Mon Sep 17 00:00:00 2001 From: mabarroso Date: Wed, 8 May 2013 21:44:12 +0200 Subject: [PATCH 03/19] Development notes section --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) mode change 100644 => 100755 README.md diff --git a/README.md b/README.md old mode 100644 new mode 100755 index d5414e6..ac07d1f --- a/README.md +++ b/README.md @@ -38,6 +38,22 @@ Not yet, we're hoping to add templating - all contributions welcome! ## Screenshots +##Development + +###Directory structure + Versioned files +``` + -+ / + + src/ Module source files + + tools/ Automated plugin packager scripts +``` + + Not versioned files. Autogenerated. +``` + -+ / + + out/ The module package to deploy. Generated by tools/release script. +``` + ## Changelog @@ -50,4 +66,4 @@ Not yet, we're hoping to add templating - all contributions welcome! - 1.1 - Default CSS and more styling - 1.0 - - First release + - First release From d04c7373038b7085c98777285abb1b2fffc41abb Mon Sep 17 00:00:00 2001 From: mabarroso Date: Thu, 9 May 2013 21:08:17 +0200 Subject: [PATCH 04/19] Refactoring docs files --- README.md | 1 + banner-772x250.png => doc/banner-772x250.png | Bin readme.txt => doc/readme.txt | 0 tools/release | 8 ++++---- 4 files changed, 5 insertions(+), 4 deletions(-) rename banner-772x250.png => doc/banner-772x250.png (100%) rename readme.txt => doc/readme.txt (100%) diff --git a/README.md b/README.md index ac07d1f..59f6109 100755 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ Not yet, we're hoping to add templating - all contributions welcome! Versioned files ``` -+ / + + doc/ Docs files + src/ Module source files + tools/ Automated plugin packager scripts ``` diff --git a/banner-772x250.png b/doc/banner-772x250.png similarity index 100% rename from banner-772x250.png rename to doc/banner-772x250.png diff --git a/readme.txt b/doc/readme.txt similarity index 100% rename from readme.txt rename to doc/readme.txt diff --git a/tools/release b/tools/release index 476ed49..05eeaad 100755 --- a/tools/release +++ b/tools/release @@ -1,10 +1,10 @@ mkdir out mkdir out/github-embed rm out/github-embed/* -cp readme* out/github-embed -cp banner-772x250.png out/github-embed -cp screenshot-* out/github-embed -cp -r src/* out/github-embed +cp doc/readme* out/github-embed +cp doc/banner-772x250.png out/github-embed +cp screenshot-* out/github-embed +cp -r src/* out/github-embed cd out zip github-embed.zip github-embed/* tar -cvf github-embed.tar.gz github-embed/* From c75b0af8e0be99a0d27dd632bd8309f2cae16cef Mon Sep 17 00:00:00 2001 From: mabarroso Date: Thu, 9 May 2013 22:03:13 +0200 Subject: [PATCH 05/19] BDD configuration --- .gitignore | 3 + README.md | 46 + behat.yml | 7 + composer.json | 12 + composer.lock | 1177 +++++++++++++++++++++++++ features/bootstrap/FeatureContext.php | 37 + features/enviroment/homepage.feature | 12 + 7 files changed, 1294 insertions(+) create mode 100755 behat.yml create mode 100644 composer.json create mode 100644 composer.lock create mode 100755 features/bootstrap/FeatureContext.php create mode 100755 features/enviroment/homepage.feature diff --git a/.gitignore b/.gitignore index 1b81a84..0566089 100755 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ out/* +/composer.phar +/bin/ +/vendor/ diff --git a/README.md b/README.md index 59f6109..2b8f9fb 100755 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ Not yet, we're hoping to add templating - all contributions welcome! ``` -+ / + doc/ Docs files + + features/ Behat feature files and bootstrap + src/ Module source files + tools/ Automated plugin packager scripts ``` @@ -52,9 +53,54 @@ Not yet, we're hoping to add templating - all contributions welcome! Not versioned files. Autogenerated. ``` -+ / + + bin/ Behat binaries. Generated by composer. + out/ The module package to deploy. Generated by tools/release script. + + vendor/ Useful libraries. Generated by composer. ``` +###Recommended environment +####Testing server +1. Install and configure two english Wordpress sites running at http://localhost/sandbox/wordpress/simply/ and http://localhost/sandbox/wordpress/multisite/ + + If you prefer other location, change the *behat.yml* file. +```yml + base_url: http://localhost/sandbox/wordpress +``` + +**Wordpress admin must be in english for BDD tests** + +2. Create a admin user named *test* which email *test@test.test* and password *testtest*. Set Administrator profile to this user. + + If you prefer other other test user credentials, change the *features/bootstrap/FeatureContext.php*] file. +```php + define('WORDPRESS_ADMIN_USER', 'test@test.test'); + define('WORDPRESS_ADMIN_PASSWORD', 'testtest'); +``` + +3. Configure the http://localhost/sandbox/wordpress/multisite/ as multisite, check the Codex for more info on this topic: [Create_A_Network](http://codex.wordpress.org/Create_A_Network) + +4. Create a blog named *test1* in http://localhost/sandbox/wordpress/multisite/test1/ + +5. Link src project directory to your Wordperfect site plugins directory +```shell + ln -s /home/developer/projects/wp-github-oembed/src/ /var/www/sandbox/wordpress/simply/wp-content/plugins + ln -s /home/developer/projects/wp-github-oembed/src/ /var/www/sandbox/wordpress/multisite/wp-content/plugins +``` + + +####BDD +Use [Composer](http://getcomposer.org/) to install [Behat](http://behat.org) and all necesary files. +```shell + curl -s https://getcomposer.org/installer | php + ./composer.phar install +``` + +You can test development environment configuration +```shell + ./bin/behat features/enviroment/ +``` + +**Wordpress admin must be in english for BDD tests** ## Changelog diff --git a/behat.yml b/behat.yml new file mode 100755 index 0000000..2808bc5 --- /dev/null +++ b/behat.yml @@ -0,0 +1,7 @@ +default: + extensions: + Behat\MinkExtension\Extension: + base_url: http://localhost/sandbox/wordpress + goutte: ~ + selenium2: ~ + diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..37181a2 --- /dev/null +++ b/composer.json @@ -0,0 +1,12 @@ +{ + "require": { + "behat/behat": "2.4.*@stable", + "behat/mink": "1.4.*@stable", + "behat/mink-extension": "*", + "behat/mink-goutte-driver": "*", + "behat/mink-selenium2-driver": "*" + }, + "config": { + "bin-dir": "bin/" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..bbfac2e --- /dev/null +++ b/composer.lock @@ -0,0 +1,1177 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" + ], + "hash": "933d459b997a509de59153a3f870132d", + "packages": [ + { + "name": "behat/behat", + "version": "v2.4.5", + "source": { + "type": "git", + "url": "git://github.com/Behat/Behat.git", + "reference": "v2.4.5" + }, + "dist": { + "type": "zip", + "url": "https://github.com/Behat/Behat/archive/v2.4.5.zip", + "reference": "v2.4.5", + "shasum": "" + }, + "require": { + "behat/gherkin": ">=2.2.4,<2.3-dev", + "php": ">=5.3.1", + "symfony/config": ">=2.0,<2.3-dev", + "symfony/console": ">=2.0,<2.3-dev", + "symfony/dependency-injection": ">=2.0,<2.3-dev", + "symfony/event-dispatcher": ">=2.0,<2.3-dev", + "symfony/finder": ">=2.0,<2.3-dev", + "symfony/translation": ">=2.0,<2.3-dev", + "symfony/yaml": ">=2.0,<2.3-dev" + }, + "suggest": { + "behat/mink-extension": "for integration with Mink testing framework", + "behat/symfony2-extension": "for integration with Symfony2 web framework", + "behat/yii-extension": "for integration with Yii web framework" + }, + "bin": [ + "bin/behat" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "2.4-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\Behat": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Scenario-oriented BDD framework for PHP 5.3", + "homepage": "http://behat.org/", + "keywords": [ + "BDD", + "Behat", + "Symfony2" + ], + "time": "2013-01-27 14:45:41" + }, + { + "name": "behat/gherkin", + "version": "v2.2.9", + "source": { + "type": "git", + "url": "https://github.com/Behat/Gherkin.git", + "reference": "v2.2.9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/Gherkin/zipball/v2.2.9", + "reference": "v2.2.9", + "shasum": "" + }, + "require": { + "php": ">=5.3.1", + "symfony/finder": ">=2.0,<2.4-dev" + }, + "require-dev": { + "symfony/config": ">=2.0,<2.4-dev", + "symfony/translation": ">=2.0,<2.4-dev", + "symfony/yaml": ">=2.0,<2.4-dev" + }, + "suggest": { + "symfony/config": "If you want to use Config component to manage resources", + "symfony/translation": "If you want to use Symfony2 translations adapter", + "symfony/yaml": "If you want to parse features, represented in YAML files" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "2.2-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\Gherkin": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Gherkin DSL parser for PHP 5.3", + "homepage": "http://behat.org/", + "keywords": [ + "BDD", + "Behat", + "DSL", + "Symfony2", + "parser" + ], + "time": "2013-03-02 10:38:40" + }, + { + "name": "behat/mink", + "version": "v1.4.3", + "source": { + "type": "git", + "url": "https://github.com/Behat/Mink.git", + "reference": "v1.4.3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/Mink/zipball/v1.4.3", + "reference": "v1.4.3", + "shasum": "" + }, + "require": { + "php": ">=5.3.1", + "symfony/css-selector": ">=2.0,<2.4-dev" + }, + "suggest": { + "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)", + "behat/mink-goutte-driver": "fast headless driver for any app without JS emulation", + "behat/mink-selenium2-driver": "slow, but JS-enabled driver for any app (requires Selenium2)", + "behat/mink-zombie-driver": "fast and JS-enabled headless driver for any app (requires node.js)" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "1.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\Mink": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Web acceptance testing framework for PHP 5.3", + "homepage": "http://mink.behat.org/", + "keywords": [ + "browser", + "testing", + "web" + ], + "time": "2013-03-02 15:53:18" + }, + { + "name": "behat/mink-browserkit-driver", + "version": "v1.0.5", + "source": { + "type": "git", + "url": "https://github.com/Behat/MinkBrowserKitDriver.git", + "reference": "v1.0.5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/MinkBrowserKitDriver/zipball/v1.0.5", + "reference": "v1.0.5", + "shasum": "" + }, + "require": { + "behat/mink": ">=1.4.3,<1.5", + "php": ">=5.3.1", + "symfony/browser-kit": ">=2.0,<3.0", + "symfony/dom-crawler": ">=2.0,<3.0" + }, + "require-dev": { + "silex/silex": "@dev" + }, + "type": "mink-driver", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\Mink\\Driver": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Symfony2 BrowserKit driver for Mink framework", + "homepage": "http://mink.behat.org/", + "keywords": [ + "Mink", + "Symfony2", + "browser", + "testing" + ], + "time": "2013-04-13 12:17:15" + }, + { + "name": "behat/mink-extension", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/Behat/MinkExtension.git", + "reference": "v1.1.0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/MinkExtension/zipball/v1.1.0", + "reference": "v1.1.0", + "shasum": "" + }, + "require": { + "behat/behat": ">=2.4.5,<2.5", + "behat/mink": ">=1.4.3,<1.6-dev", + "php": ">=5.3.2" + }, + "require-dev": { + "behat/mink-goutte-driver": ">=1.0,<2.0" + }, + "type": "behat-extension", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\MinkExtension": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Mink extension for Behat", + "homepage": "http://mink.behat.org", + "keywords": [ + "browser", + "gui", + "test", + "web" + ], + "time": "2013-05-23 12:32:57" + }, + { + "name": "behat/mink-goutte-driver", + "version": "v1.0.8", + "source": { + "type": "git", + "url": "https://github.com/Behat/MinkGoutteDriver.git", + "reference": "v1.0.8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/MinkGoutteDriver/zipball/v1.0.8", + "reference": "v1.0.8", + "shasum": "" + }, + "require": { + "behat/mink-browserkit-driver": ">=1.0.5,<1.2.0", + "fabpot/goutte": ">=1.0.1,<1.1", + "php": ">=5.3.1" + }, + "type": "mink-driver", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\Mink\\Driver": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + } + ], + "description": "Goutte driver for Mink framework", + "homepage": "http://mink.behat.org/", + "keywords": [ + "browser", + "goutte", + "headless", + "testing" + ], + "time": "2013-04-13 23:30:23" + }, + { + "name": "behat/mink-selenium2-driver", + "version": "v1.0.6", + "source": { + "type": "git", + "url": "https://github.com/Behat/MinkSelenium2Driver.git", + "reference": "v1.0.6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/MinkSelenium2Driver/zipball/v1.0.6", + "reference": "v1.0.6", + "shasum": "" + }, + "require": { + "behat/mink": ">=1.4.3,<1.5", + "instaclick/php-webdriver": ">=1.0.12.0,<1.1", + "php": ">=5.3.1" + }, + "type": "mink-driver", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Behat\\Mink\\Driver": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Pete Otaqui", + "email": "pete@otaqui.com", + "homepage": "https://github.com/pete-otaqui" + } + ], + "description": "Selenium2 (WebDriver) driver for Mink framework", + "homepage": "http://mink.behat.org/", + "keywords": [ + "ajax", + "browser", + "javascript", + "selenium", + "testing", + "webdriver" + ], + "time": "2013-04-13 12:56:28" + }, + { + "name": "fabpot/goutte", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/fabpot/Goutte.git", + "reference": "v1.0.1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fabpot/Goutte/zipball/v1.0.1", + "reference": "v1.0.1", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "guzzle/guzzle": ">=3.0, <3.4", + "php": ">=5.3.0", + "symfony/browser-kit": ">=2.1,<3.0", + "symfony/css-selector": ">=2.1,<3.0", + "symfony/dom-crawler": ">=2.1,<3.0", + "symfony/finder": ">=2.1,<3.0", + "symfony/process": ">=2.1,<3.0" + }, + "type": "application", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-0": { + "Goutte": "." + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "A simple PHP Web Scraper", + "homepage": "https://github.com/fabpot/Goutte", + "keywords": [ + "scraper" + ], + "time": "2013-03-08 08:00:58" + }, + { + "name": "guzzle/guzzle", + "version": "v3.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "v3.3.1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/v3.3.1", + "reference": "v3.3.1", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": ">=5.3.2", + "symfony/event-dispatcher": ">=2.1" + }, + "replace": { + "guzzle/batch": "self.version", + "guzzle/cache": "self.version", + "guzzle/common": "self.version", + "guzzle/http": "self.version", + "guzzle/inflection": "self.version", + "guzzle/iterator": "self.version", + "guzzle/log": "self.version", + "guzzle/parser": "self.version", + "guzzle/plugin": "self.version", + "guzzle/plugin-async": "self.version", + "guzzle/plugin-backoff": "self.version", + "guzzle/plugin-cache": "self.version", + "guzzle/plugin-cookie": "self.version", + "guzzle/plugin-curlauth": "self.version", + "guzzle/plugin-error-response": "self.version", + "guzzle/plugin-history": "self.version", + "guzzle/plugin-log": "self.version", + "guzzle/plugin-md5": "self.version", + "guzzle/plugin-mock": "self.version", + "guzzle/plugin-oauth": "self.version", + "guzzle/service": "self.version", + "guzzle/stream": "self.version" + }, + "require-dev": { + "doctrine/cache": "*", + "monolog/monolog": "1.*", + "phpunit/phpunit": "3.7.*", + "symfony/class-loader": "*", + "zend/zend-cache1": "1.12", + "zend/zend-log1": "1.12", + "zendframework/zend-cache": "2.0.*", + "zendframework/zend-log": "2.0.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-0": { + "Guzzle\\Tests": "tests/", + "Guzzle": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Guzzle Community", + "homepage": "https://github.com/guzzle/guzzle/contributors" + } + ], + "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2013-03-10 23:05:38" + }, + { + "name": "instaclick/php-webdriver", + "version": "1.0.12", + "source": { + "type": "git", + "url": "https://github.com/instaclick/php-webdriver.git", + "reference": "1.0.12" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/instaclick/php-webdriver/zipball/1.0.12", + "reference": "1.0.12", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "WebDriver": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Justin Bishop", + "email": "jubishop@gmail.com", + "role": "Developer" + }, + { + "name": "Anthon Pang", + "email": "apang@softwaredevelopment.ca", + "role": "Fork Maintainer" + } + ], + "description": "PHP WebDriver for Selenium 2", + "homepage": "http://instaclick.com/torontotechjobs/", + "keywords": [ + "browser", + "selenium", + "webdriver", + "webtest" + ], + "time": "2013-02-19 18:37:07" + }, + { + "name": "symfony/browser-kit", + "version": "v2.2.1", + "target-dir": "Symfony/Component/BrowserKit", + "source": { + "type": "git", + "url": "https://github.com/symfony/BrowserKit.git", + "reference": "v2.2.1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/v2.2.1", + "reference": "v2.2.1", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/dom-crawler": ">=2.0,<3.0" + }, + "require-dev": { + "symfony/css-selector": ">=2.0,<3.0", + "symfony/process": ">=2.0,<3.0" + }, + "suggest": { + "symfony/process": "2.2.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\BrowserKit\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony BrowserKit Component", + "homepage": "http://symfony.com", + "time": "2013-03-15 10:14:31" + }, + { + "name": "symfony/config", + "version": "v2.2.1", + "target-dir": "Symfony/Component/Config", + "source": { + "type": "git", + "url": "https://github.com/symfony/Config.git", + "reference": "v2.2.1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Config/zipball/v2.2.1", + "reference": "v2.2.1", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Config\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony Config Component", + "homepage": "http://symfony.com", + "time": "2013-03-01 10:42:10" + }, + { + "name": "symfony/console", + "version": "v2.2.1", + "target-dir": "Symfony/Component/Console", + "source": { + "type": "git", + "url": "https://github.com/symfony/Console.git", + "reference": "v2.2.1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Console/zipball/v2.2.1", + "reference": "v2.2.1", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Console\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "http://symfony.com", + "time": "2013-03-19 20:48:08" + }, + { + "name": "symfony/css-selector", + "version": "v2.2.1", + "target-dir": "Symfony/Component/CssSelector", + "source": { + "type": "git", + "url": "https://github.com/symfony/CssSelector.git", + "reference": "v2.2.1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/CssSelector/zipball/v2.2.1", + "reference": "v2.2.1", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\CssSelector\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "http://symfony.com", + "time": "2013-01-17 15:25:59" + }, + { + "name": "symfony/dependency-injection", + "version": "v2.2.1", + "target-dir": "Symfony/Component/DependencyInjection", + "source": { + "type": "git", + "url": "https://github.com/symfony/DependencyInjection.git", + "reference": "v2.2.1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/v2.2.1", + "reference": "v2.2.1", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/config": ">=2.2,<2.3-dev", + "symfony/yaml": ">=2.0,<3.0" + }, + "suggest": { + "symfony/config": "2.2.*", + "symfony/yaml": "2.2.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\DependencyInjection\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony DependencyInjection Component", + "homepage": "http://symfony.com", + "time": "2013-03-23 07:49:54" + }, + { + "name": "symfony/dom-crawler", + "version": "v2.2.1", + "target-dir": "Symfony/Component/DomCrawler", + "source": { + "type": "git", + "url": "https://github.com/symfony/DomCrawler.git", + "reference": "v2.2.1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/v2.2.1", + "reference": "v2.2.1", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/css-selector": ">=2.0,<3.0" + }, + "suggest": { + "symfony/css-selector": "2.2.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\DomCrawler\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony DomCrawler Component", + "homepage": "http://symfony.com", + "time": "2013-04-01 08:05:23" + }, + { + "name": "symfony/event-dispatcher", + "version": "v2.2.1", + "target-dir": "Symfony/Component/EventDispatcher", + "source": { + "type": "git", + "url": "https://github.com/symfony/EventDispatcher.git", + "reference": "v2.2.1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/v2.2.1", + "reference": "v2.2.1", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/dependency-injection": ">=2.0,<3.0" + }, + "suggest": { + "symfony/dependency-injection": "2.2.*", + "symfony/http-kernel": "2.2.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "http://symfony.com", + "time": "2013-02-11 11:26:43" + }, + { + "name": "symfony/finder", + "version": "v2.2.1", + "target-dir": "Symfony/Component/Finder", + "source": { + "type": "git", + "url": "https://github.com/symfony/Finder.git", + "reference": "v2.2.1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Finder/zipball/v2.2.1", + "reference": "v2.2.1", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Finder\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "http://symfony.com", + "time": "2013-04-01 07:51:50" + }, + { + "name": "symfony/process", + "version": "v2.2.1", + "target-dir": "Symfony/Component/Process", + "source": { + "type": "git", + "url": "https://github.com/symfony/Process.git", + "reference": "v2.2.1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Process/zipball/v2.2.1", + "reference": "v2.2.1", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Process\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "http://symfony.com", + "time": "2013-03-23 07:49:54" + }, + { + "name": "symfony/translation", + "version": "v2.2.1", + "target-dir": "Symfony/Component/Translation", + "source": { + "type": "git", + "url": "https://github.com/symfony/Translation.git", + "reference": "v2.2.1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Translation/zipball/v2.2.1", + "reference": "v2.2.1", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/config": ">=2.0,<2.3-dev", + "symfony/yaml": ">=2.2,<3.0" + }, + "suggest": { + "symfony/config": "2.2.*", + "symfony/yaml": "2.2.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Translation\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony Translation Component", + "homepage": "http://symfony.com", + "time": "2013-04-01 08:06:05" + }, + { + "name": "symfony/yaml", + "version": "v2.2.1", + "target-dir": "Symfony/Component/Yaml", + "source": { + "type": "git", + "url": "https://github.com/symfony/Yaml.git", + "reference": "v2.2.1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/v2.2.1", + "reference": "v2.2.1", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Yaml\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "http://symfony.com", + "time": "2013-03-23 07:49:54" + } + ], + "packages-dev": [ + + ], + "aliases": [ + + ], + "minimum-stability": "stable", + "stability-flags": { + "behat/behat": 0, + "behat/mink": 0 + }, + "platform": [ + + ], + "platform-dev": [ + + ] +} diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php new file mode 100755 index 0000000..9470128 --- /dev/null +++ b/features/bootstrap/FeatureContext.php @@ -0,0 +1,37 @@ +getSession()->visit($this->locatePath(WORDPRESS_SIMPLY_HOME)); + } + + /** + * @Given /^I am on multisite homepage$/ + */ + public function iAmOnMultisiteHomepage() + { + $this->getSession()->visit($this->locatePath(WORDPRESS_MULTISITE_HOME)); + } +} \ No newline at end of file diff --git a/features/enviroment/homepage.feature b/features/enviroment/homepage.feature new file mode 100755 index 0000000..4f6ffec --- /dev/null +++ b/features/enviroment/homepage.feature @@ -0,0 +1,12 @@ +Feature: homepage + In order to access the site + As a website user + I need to be able to reach the homepage + + Scenario: Browsing to the simply homepage + Given I am on simply homepage + Then the response status code should be 200 + + Scenario: Browsing to the multisite homepage + Given I am on multisite homepage + Then the response status code should be 200 From 3f52ac07301f0334bf4c4521272f10fb40b9bd1f Mon Sep 17 00:00:00 2001 From: mabarroso Date: Fri, 10 May 2013 21:36:33 +0200 Subject: [PATCH 06/19] Development environment configuration tests --- features/bootstrap/FeatureContext.php | 32 ++++++++++++++++++++++++++- features/enviroment/admin.feature | 15 +++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100755 features/enviroment/admin.feature diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index 9470128..28343fd 100755 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -1,9 +1,12 @@ getSession()->visit($this->locatePath(WORDPRESS_MULTISITE_HOME)); } + + /** + * @Given /^I am on simply admin login$/ + */ + public function iAmOnSimplyAdminLogin() + { + $this->getSession()->visit($this->locatePath(WORDPRESS_SIMPLY_ADMIN)); + } + + /** + * @Given /^I am on multisite admin login$/ + */ + public function iAmOnMultisiteAdminLogin() + { + $this->getSession()->visit($this->locatePath(WORDPRESS_MULTISITE_ADMIN)); + } + + /** + * @When /^I am logged in$/ + */ + public function iAmLoggedIn() + { + $this->getSession()->getPage()->find('css', 'input[name="log"]')->setValue(WORDPRESS_ADMIN_USER); + $this->getSession()->getPage()->find('css', 'input[name="pwd"]')->setValue(WORDPRESS_ADMIN_PASSWORD); + $this->getSession()->getPage()->find('css', 'input[name="wp-submit"]')->click(); + } + } \ No newline at end of file diff --git a/features/enviroment/admin.feature b/features/enviroment/admin.feature new file mode 100755 index 0000000..4b5e294 --- /dev/null +++ b/features/enviroment/admin.feature @@ -0,0 +1,15 @@ +Feature: Admin + In order to manage plugin + As a Shop administrator + I need to be able to manage plugin + + Scenario: Browsing to the simply admin dashboard + Given I am on simply admin login + When I am logged in + Then I should see "Dashboard" + + Scenario: Browsing to the multisite admin dashboard + Given I am on multisite admin login + When I am logged in + Then I should see "Dashboard" + And I should see "Network Admin" From 2955df82d80bbe6a409aa34099163510150931e2 Mon Sep 17 00:00:00 2001 From: mabarroso Date: Fri, 10 May 2013 21:42:27 +0200 Subject: [PATCH 07/19] Development enviroment notes for BDD --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2b8f9fb..3adcf47 100755 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ Not yet, we're hoping to add templating - all contributions welcome! + tools/ Automated plugin packager scripts ``` - Not versioned files. Autogenerated. + Not versioned files (autogenerated). ``` -+ / + bin/ Behat binaries. Generated by composer. @@ -73,11 +73,11 @@ Not yet, we're hoping to add templating - all contributions welcome! If you prefer other other test user credentials, change the *features/bootstrap/FeatureContext.php*] file. ```php - define('WORDPRESS_ADMIN_USER', 'test@test.test'); + define('WORDPRESS_ADMIN_USER', 'test'); define('WORDPRESS_ADMIN_PASSWORD', 'testtest'); ``` -3. Configure the http://localhost/sandbox/wordpress/multisite/ as multisite, check the Codex for more info on this topic: [Create_A_Network](http://codex.wordpress.org/Create_A_Network) +3. Configure the http://localhost/sandbox/wordpress/multisite/ as multisite, check the Codex for more info on this topic: [Create_A_Network](http://codex.wordpress.org/Create_A_Network) 4. Create a blog named *test1* in http://localhost/sandbox/wordpress/multisite/test1/ @@ -95,7 +95,7 @@ Use [Composer](http://getcomposer.org/) to install [Behat](http://behat.org) and ./composer.phar install ``` -You can test development environment configuration +You can test the development environment configuration ```shell ./bin/behat features/enviroment/ ``` @@ -106,7 +106,6 @@ You can test development environment configuration - 1.3 - Expire the oEmbed cache daily - - 1.2 - Support for milestone summaries - Support for contributor lists From de73c119a14258b23118d8655c209cd909c65294 Mon Sep 17 00:00:00 2001 From: mabarroso Date: Fri, 10 May 2013 23:11:23 +0200 Subject: [PATCH 08/19] Development enviroment setup --- README.md | 4 ++-- features/bootstrap/FeatureContext.php | 8 ++++---- features/enviroment/admin.feature | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3adcf47..fbdf812 100755 --- a/README.md +++ b/README.md @@ -83,8 +83,8 @@ Not yet, we're hoping to add templating - all contributions welcome! 5. Link src project directory to your Wordperfect site plugins directory ```shell - ln -s /home/developer/projects/wp-github-oembed/src/ /var/www/sandbox/wordpress/simply/wp-content/plugins - ln -s /home/developer/projects/wp-github-oembed/src/ /var/www/sandbox/wordpress/multisite/wp-content/plugins + ln -s /home/developer/projects/wp-github-oembed/src/ /var/www/sandbox/wordpress/simply/wp-content/plugins/github-embed + ln -s /home/developer/projects/wp-github-oembed/src/ /var/www/sandbox/wordpress/multisite/wp-content/plugins/github-embed ``` diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index 28343fd..a2cfa28 100755 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -39,17 +39,17 @@ public function iAmOnMultisiteHomepage() } /** - * @Given /^I am on simply admin login$/ + * @Given /^I am on simply admin home$/ */ - public function iAmOnSimplyAdminLogin() + public function iAmOnSimplyAdminHome() { $this->getSession()->visit($this->locatePath(WORDPRESS_SIMPLY_ADMIN)); } /** - * @Given /^I am on multisite admin login$/ + * @Given /^I am on multisite admin home$/ */ - public function iAmOnMultisiteAdminLogin() + public function iAmOnMultisiteAdminHome() { $this->getSession()->visit($this->locatePath(WORDPRESS_MULTISITE_ADMIN)); } diff --git a/features/enviroment/admin.feature b/features/enviroment/admin.feature index 4b5e294..037c78e 100755 --- a/features/enviroment/admin.feature +++ b/features/enviroment/admin.feature @@ -4,12 +4,12 @@ Feature: Admin I need to be able to manage plugin Scenario: Browsing to the simply admin dashboard - Given I am on simply admin login + Given I am on simply admin home When I am logged in Then I should see "Dashboard" Scenario: Browsing to the multisite admin dashboard - Given I am on multisite admin login + Given I am on multisite admin home When I am logged in Then I should see "Dashboard" And I should see "Network Admin" From 5b59091aba98711412d15791ccd1757e409bfa88 Mon Sep 17 00:00:00 2001 From: mabarroso Date: Sat, 11 May 2013 16:53:37 +0200 Subject: [PATCH 09/19] Aceptance test for basic plugin features in simple wordpress --- features/bootstrap/FeatureContext.php | 142 ++++++++++++++++++++++++++ features/simply/embed.feature | 27 +++++ 2 files changed, 169 insertions(+) create mode 100755 features/simply/embed.feature diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index a2cfa28..5545606 100755 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -7,6 +7,7 @@ define('WORDPRESS_SIMPLY_ADMIN', 'simply/wp-admin/'); define('WORDPRESS_MULTISITE_HOME', 'multisite/test1/'); define('WORDPRESS_MULTISITE_ADMIN', 'multisite/test1/wp-admin/'); +define('WORDPRESS_POST_TITLE', 'test wp-github-oembed'); use Behat\Behat\Context\ClosuredContextInterface, Behat\Behat\Context\TranslatedContextInterface, @@ -22,6 +23,8 @@ */ class FeatureContext extends MinkContext { + private static $testPostURL = false; + /** * @Given /^I am on simply homepage$/ */ @@ -64,4 +67,143 @@ public function iAmLoggedIn() $this->getSession()->getPage()->find('css', 'input[name="wp-submit"]')->click(); } + /** + * @When /^I go to admin plugins page$/ + */ + public function iGoToAdminPluginsPage() + { + $this->getSession()->getPage()->find('xpath', '//a[text()="Installed Plugins"]')->click(); + } + + /** + * @Given /^plugin must be activated$/ + */ + public function pluginMustBeActivated() + { + $this->iGoToAdminPluginsPage(); + $flag = $this->getSession()->getPage()->find('css', '#github-embed .activate'); + if (!is_null($flag)) { + $this->getSession()->getPage()->find('css', '#github-embed .activate a')->click(); + } + } + + /** + * @Given /^plugin must be deactivated$/ + */ + public function pluginMustBeDeactivated() + { + $this->iGoToAdminPluginsPage(); + $flag = $this->getSession()->getPage()->find('css', '#github-embed .deactivate'); + if (!is_null($flag)) { + $this->getSession()->getPage()->find('css', '#github-embed .deactivate a')->click(); + } + } + + /** + * @Given /^test post must be created$/ + */ + public function testPostMustBeCreated() + { + if (!self::$testPostURL) { + $this->createPost(); + } + } + + /** + * Create post for tests + */ + private function createPost() + { + $this->getSession()->getPage()->find('xpath', '//a[text()="All Posts"]')->click(); + $this->getSession()->getPage()->find('css', 'input[name="s"]')->setValue(WORDPRESS_POST_TITLE); + $this->getSession()->getPage()->find('xpath', '//input[@value="Search Posts"]')->click(); + $flag = $this->getSession()->getPage()->find('xpath', '//text()[contains(.,"No posts found")]'); + if (!is_null($flag)) { + $this->getSession()->visit($this->locatePath(WORDPRESS_SIMPLY_ADMIN.'post-new.php')); + $this->getSession()->getPage()->find('css', 'input[name="post_title"]')->setValue(WORDPRESS_POST_TITLE); + $this->getSession()->getPage()->find('css', 'textarea[name="content"]')->setValue(" +
+

Repositories

+ https://github.com/leewillis77/wp-github-oembed +
+
+

User profiles

+ https://github.com/leewillis77/ +
+
+

Milestone summaries

+ https://github.com/leewillis77/wp-github-oembed/issues?milestone=1&state=open +
+
+

Repository contributors

+ https://github.com/leewillis77/wp-github-oembed/graphs/contributors +
+ + "); + $this->getSession()->getPage()->find('css', 'input[name="publish"]')->click(); + } + $this->getSession()->getPage()->find('xpath', '//a[text()="All Posts"]')->click(); + $this->getSession()->getPage()->find('css', 'input[name="s"]')->setValue(WORDPRESS_POST_TITLE); + $this->getSession()->getPage()->find('xpath', '//input[@value="Search Posts"]')->click(); + $this->getSession()->getPage()->find('xpath', '//a[text()="Edit"]')->click(); + $this->getSession()->getPage()->find('xpath', '//a[text()="View Post"]')->click(); + self::$testPostURL = $this->getSession()->getCurrentURL(); + } + + /** + * @Given /^I am on test post$/ + */ + public function iAmOnTestPost() + { + $this->getSession()->visit(self::$testPostURL); + } + + /** + * @Then /^I should see the embedded repository$/ + */ + public function iShouldSeeTheEmbeddedRepository() + { + $flagTitle = $this->getSession()->getPage()->find('xpath', '//div[@id="test-oembed-repositories"]//text()[contains(.,"WordPress Github ")]'); + $flagForks = $this->getSession()->getPage()->find('xpath', '//div[@id="test-oembed-repositories"]//text()[contains(.,"forks")]'); + $flagIssues = $this->getSession()->getPage()->find('xpath', '//div[@id="test-oembed-repositories"]//text()[contains(.,"open issues")]'); + $flagCommits = $this->getSession()->getPage()->find('xpath', '//div[@id="test-oembed-repositories"]//text()[contains(.,"Recent commits")]'); + if (is_null($flagTitle) || is_null($flagForks) || is_null($flagIssues) || is_null($flagCommits)) { + throw new Exception("Embedded repository not found in {$this->getSession()->getCurrentUrl()} page."); + } + } + + /** + * @Then /^I should see the embedded user profile$/ + */ + public function iShouldSeeTheEmbeddedUserProfile() + { + $flagRepositories = $this->getSession()->getPage()->find('xpath', '//div[@id="test-oembed-user-profiles"]//text()[contains(.,"repositories")]'); + $flagFollowers = $this->getSession()->getPage()->find('xpath', '//div[@id="test-oembed-user-profiles"]//text()[contains(.,"followers")]'); + if (is_null($flagRepositories) || is_null($flagFollowers)) { + throw new Exception("Embedded user profile not found in {$this->getSession()->getCurrentUrl()} page."); + } + } + + /** + * @Then /^I should see the embedded milestone summaries$/ + */ + public function iShouldSeeTheEmbeddedMilestoneSummaries() + { + $flag = $this->getSession()->getPage()->find('xpath', '//div[@id="test-oembed-milestone-summaries"]//text()[contains(.,"Test Milestone")]'); + if (is_null($flag)) { + throw new Exception("Embedded milestone summaries not found in {$this->getSession()->getCurrentUrl()} page."); + } + } + + /** + * @Then /^I should see the embedded repository contributors$/ + */ + public function iShouldSeeTheEmbeddedRepositoryContributors() + { + $flag = $this->getSession()->getPage()->find('xpath', '//div[@id="test-oembed-repository-contributors"]//text()[contains(.,"Contributors:")]'); + if (is_null($flag)) { + throw new Exception("Embedded repository contributors not found in {$this->getSession()->getCurrentUrl()} page."); + } + } + } \ No newline at end of file diff --git a/features/simply/embed.feature b/features/simply/embed.feature new file mode 100755 index 0000000..de77e24 --- /dev/null +++ b/features/simply/embed.feature @@ -0,0 +1,27 @@ +Feature: Embed + In order to access the site + As a visitor + I need to read embed Github data in post + + Background: + Given I am on simply admin home + When I am logged in + Then I should see "Dashboard" + And plugin must be activated + And test post must be created + + Scenario: Repositories + Given I am on test post + Then I should see the embedded repository + + Scenario: User profiles + Given I am on test post + Then I should see the embedded user profile + + Scenario: Milestone summaries + Given I am on test post + Then I should see the embedded milestone summaries + + Scenario: Repository contributors + Given I am on test post + Then I should see the embedded repository contributors From 119d62deab01242dd4f4a05bf26224679b27e2e6 Mon Sep 17 00:00:00 2001 From: mabarroso Date: Sat, 11 May 2013 17:14:16 +0200 Subject: [PATCH 10/19] Aceptance test for basic plugin features in multisite wordpress --- features/bootstrap/FeatureContext.php | 62 ++++++++++++++++++++++++--- features/multisite/embed.feature | 29 +++++++++++++ 2 files changed, 84 insertions(+), 7 deletions(-) create mode 100755 features/multisite/embed.feature diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index 5545606..7cb763c 100755 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -23,7 +23,35 @@ */ class FeatureContext extends MinkContext { - private static $testPostURL = false; + private static $testPostURLSimply = false; + private static $testPostURLMultisite = false; + + private function isMultisite() + { + if (preg_match('|'.WORDPRESS_SIMPLY_HOME.'|', $this->getSession()->getCurrentURL())) { + return false; + } else { + return true; + } + } + + private function setTestPostURL($value) + { + if ($this->isMultisite()) { + self::$testPostURLSimply = $value; + } else { + self::$testPostURLMultisite = $value; + } + } + + private function getTestPostURL() + { + if ($this->isMultisite()) { + return self::$testPostURLSimply; + } else { + return self::$testPostURLMultisite; + } + } /** * @Given /^I am on simply homepage$/ @@ -104,7 +132,7 @@ public function pluginMustBeDeactivated() */ public function testPostMustBeCreated() { - if (!self::$testPostURL) { + if (!$this->getTestPostURL()) { $this->createPost(); } } @@ -119,7 +147,7 @@ private function createPost() $this->getSession()->getPage()->find('xpath', '//input[@value="Search Posts"]')->click(); $flag = $this->getSession()->getPage()->find('xpath', '//text()[contains(.,"No posts found")]'); if (!is_null($flag)) { - $this->getSession()->visit($this->locatePath(WORDPRESS_SIMPLY_ADMIN.'post-new.php')); + $this->getSession()->getPage()->find('xpath', '//li[@id="menu-posts"]//a[text()="Add New"]')->click(); $this->getSession()->getPage()->find('css', 'input[name="post_title"]')->setValue(WORDPRESS_POST_TITLE); $this->getSession()->getPage()->find('css', 'textarea[name="content"]')->setValue("
@@ -140,14 +168,16 @@ private function createPost()
"); - $this->getSession()->getPage()->find('css', 'input[name="publish"]')->click(); + //$this->getSession()->getPage()->find('css', 'input[name="publish"]')->click(); + $this->getSession()->getPage()->find('xpath', '//input[@id="save-post"]')->click(); } $this->getSession()->getPage()->find('xpath', '//a[text()="All Posts"]')->click(); $this->getSession()->getPage()->find('css', 'input[name="s"]')->setValue(WORDPRESS_POST_TITLE); $this->getSession()->getPage()->find('xpath', '//input[@value="Search Posts"]')->click(); $this->getSession()->getPage()->find('xpath', '//a[text()="Edit"]')->click(); - $this->getSession()->getPage()->find('xpath', '//a[text()="View Post"]')->click(); - self::$testPostURL = $this->getSession()->getCurrentURL(); + //$this->getSession()->getPage()->find('xpath', '//a[text()="View Post"]')->click(); + $this->getSession()->getPage()->find('xpath', '//a[@id="post-preview"]')->click(); + $this->setTestPostURL($this->getSession()->getCurrentURL()); } /** @@ -155,7 +185,10 @@ private function createPost() */ public function iAmOnTestPost() { - $this->getSession()->visit(self::$testPostURL); + if ($this->isMultisite()) { + $this->iAmOnMultisiteHomepage(); + } + $this->getSession()->visit($this->getTestPostURL()); } /** @@ -206,4 +239,19 @@ public function iShouldSeeTheEmbeddedRepositoryContributors() } } + /** + * @Given /^I go to network admin$/ + */ + public function iGoToNetworkAdmin() + { + $this->getSession()->getPage()->find('xpath', '//a[text()="Network Admin"]')->click(); + } + + /** + * @Given /^I go to test blog$/ + */ + public function iGoToTestBlog() + { + $this->getSession()->getPage()->find('xpath', '//a[text()="test1"]')->click(); + } } \ No newline at end of file diff --git a/features/multisite/embed.feature b/features/multisite/embed.feature new file mode 100755 index 0000000..05937fd --- /dev/null +++ b/features/multisite/embed.feature @@ -0,0 +1,29 @@ +Feature: Embed + In order to access the site + As a visitor + I need to read embed Github data in post + + Background: + Given I am on multisite admin home + When I am logged in + Then I should see "Dashboard" + And I go to network admin + And plugin must be activated + And I go to test blog + And test post must be created + + Scenario: Repositories + Given I am on test post + Then I should see the embedded repository + + Scenario: User profiles + Given I am on test post + Then I should see the embedded user profile + + Scenario: Milestone summaries + Given I am on test post + Then I should see the embedded milestone summaries + + Scenario: Repository contributors + Given I am on test post + Then I should see the embedded repository contributors From 62f2f3ab4f24e6d6c6d58887ad4fd58ef895f2b7 Mon Sep 17 00:00:00 2001 From: mabarroso Date: Sat, 11 May 2013 17:28:50 +0200 Subject: [PATCH 11/19] Post for tests will be overriden --- features/bootstrap/FeatureContext.php | 56 ++++++++++++++------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index 7cb763c..74e39a8 100755 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -137,6 +137,31 @@ public function testPostMustBeCreated() } } + /** + * Fill post form + */ + private function setPostContent() { + $this->getSession()->getPage()->find('css', 'input[name="post_title"]')->setValue(WORDPRESS_POST_TITLE); + $this->getSession()->getPage()->find('css', 'textarea[name="content"]')->setValue(" +
+

Repositories

+ https://github.com/leewillis77/wp-github-oembed +
+
+

User profiles

+ https://github.com/leewillis77/ +
+
+

Milestone summaries

+ https://github.com/leewillis77/wp-github-oembed/issues?milestone=1&state=open +
+
+

Repository contributors

+ https://github.com/leewillis77/wp-github-oembed/graphs/contributors +
+ "); + } + /** * Create post for tests */ @@ -148,34 +173,13 @@ private function createPost() $flag = $this->getSession()->getPage()->find('xpath', '//text()[contains(.,"No posts found")]'); if (!is_null($flag)) { $this->getSession()->getPage()->find('xpath', '//li[@id="menu-posts"]//a[text()="Add New"]')->click(); - $this->getSession()->getPage()->find('css', 'input[name="post_title"]')->setValue(WORDPRESS_POST_TITLE); - $this->getSession()->getPage()->find('css', 'textarea[name="content"]')->setValue(" -
-

Repositories

- https://github.com/leewillis77/wp-github-oembed -
-
-

User profiles

- https://github.com/leewillis77/ -
-
-

Milestone summaries

- https://github.com/leewillis77/wp-github-oembed/issues?milestone=1&state=open -
-
-

Repository contributors

- https://github.com/leewillis77/wp-github-oembed/graphs/contributors -
- - "); - //$this->getSession()->getPage()->find('css', 'input[name="publish"]')->click(); + $this->setPostContent(); $this->getSession()->getPage()->find('xpath', '//input[@id="save-post"]')->click(); + } else { + $this->getSession()->getPage()->find('xpath', '//a[text()="Edit"]')->click(); + $this->setPostContent(); + $this->getSession()->getPage()->find('xpath', '//input[@id="save-post"]')->click(); } - $this->getSession()->getPage()->find('xpath', '//a[text()="All Posts"]')->click(); - $this->getSession()->getPage()->find('css', 'input[name="s"]')->setValue(WORDPRESS_POST_TITLE); - $this->getSession()->getPage()->find('xpath', '//input[@value="Search Posts"]')->click(); - $this->getSession()->getPage()->find('xpath', '//a[text()="Edit"]')->click(); - //$this->getSession()->getPage()->find('xpath', '//a[text()="View Post"]')->click(); $this->getSession()->getPage()->find('xpath', '//a[@id="post-preview"]')->click(); $this->setTestPostURL($this->getSession()->getCurrentURL()); } From c034da14abd09ada7cb1e062fc88fecaa7e1d425 Mon Sep 17 00:00:00 2001 From: mabarroso Date: Sun, 12 May 2013 17:28:46 +0200 Subject: [PATCH 12/19] Clear cache option in settings page --- src/github-embed.php | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) mode change 100644 => 100755 src/github-embed.php diff --git a/src/github-embed.php b/src/github-embed.php old mode 100644 new mode 100755 index 9e762f6..a218d2f --- a/src/github-embed.php +++ b/src/github-embed.php @@ -56,14 +56,47 @@ public function __construct ( $api ) { add_action ( 'init', array ( $this, 'register_oembed_handler' ) ); add_action ( 'init', array ( $this, 'maybe_handle_oembed' ) ); add_action ( 'wp_enqueue_scripts', array ( $this, 'enqueue_styles' ) ); - add_action ( 'admin_init', array ( $this, 'schedule_expiry' ) ); - add_action ( 'github_embed_cron', array ( $this, 'cron' ) ); - - // @TODO i18n + add_action ( 'admin_init', array ( $this, 'schedule_expiry' ) ); + add_action ( 'github_embed_cron', array ( $this, 'cron' ) ); + if(is_admin()){ + add_action('admin_menu', array($this, 'add_plugin_page')); + add_action('admin_init', array($this, 'page_init')); + } } + /** + * Create admin menu entry under "Settings" + */ + public function add_plugin_page() { + add_options_page('Settings Admin', 'Github Embed', 'manage_options', 'githubembed-setting-admin', array($this, 'create_admin_page')); + } + + /** + * The admin page constructor + */ + public function create_admin_page() { + ?> +
+ +

Github Embed Settings

+ +
+ + +
+
+ Date: Sun, 12 May 2013 17:37:19 +0200 Subject: [PATCH 13/19] I18n spanish files and generator tool --- src/languages/githubembed-es_ES.mo | Bin 0 -> 307 bytes src/languages/githubembed-es_ES.po | 13 +++++++++++++ tools/generate_co_files | 10 ++++++++++ 3 files changed, 23 insertions(+) create mode 100644 src/languages/githubembed-es_ES.mo create mode 100755 src/languages/githubembed-es_ES.po create mode 100755 tools/generate_co_files diff --git a/src/languages/githubembed-es_ES.mo b/src/languages/githubembed-es_ES.mo new file mode 100644 index 0000000000000000000000000000000000000000..626f449adf49a2910a14ee14c877baf38fb4d5fc GIT binary patch literal 307 zcmYk$T}lHn5C`!1g|PZ0`X(|xK-7v4WtV-iY(=mjSba8|opuAelVy^EK6?gF(j#~e z&*F3~>Yw~F2_%zz9qoQ7$&NS`*J4lHi*;VafiU7kwBmi^Q0o4cQfE?+rON2DE%Ulx zpK*hR!5Ukmx^=N$mQb`MR`7^1I$8uZy_**L896vlDGbjqld-3W6!q+_!xSRE#*3~o zjxw;d;eauJnoacR?;INnb7WnR^_4VDVN|-9JTyx-jh=XJLkiUO+mK&n@UzSb2009~ ZMBRAi-*3wEbGMMI)_txBDun+ZSKrbdOzZ#v literal 0 HcmV?d00001 diff --git a/src/languages/githubembed-es_ES.po b/src/languages/githubembed-es_ES.po new file mode 100755 index 0000000..28fdf49 --- /dev/null +++ b/src/languages/githubembed-es_ES.po @@ -0,0 +1,13 @@ +msgid "" +msgstr "" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +msgid "Github Embed Settings" +msgstr "Configuración de Github Embed" + +msgid "Clear cache" +msgstr "Borrar cache" + diff --git a/tools/generate_co_files b/tools/generate_co_files new file mode 100755 index 0000000..3c8b0ef --- /dev/null +++ b/tools/generate_co_files @@ -0,0 +1,10 @@ +#!/bin/bash +if ! msgfmt="$(type -p msgfmt)" || [ -z msgfmt ]; then + echo "I require msgfmt but gettext package it's not installed. Aborting."; + echo " Use apt-get install gettext"; + exit 1; +fi + +cd src/languages/ +for file in `find . -name "*.po"` ; do msgfmt -o `echo $file | sed s/\.po/\.mo/` $file ; done +cd ../.. From 45d1bbca488493ce02734b9d690351b4c79ed03c Mon Sep 17 00:00:00 2001 From: mabarroso Date: Sun, 12 May 2013 17:39:43 +0200 Subject: [PATCH 14/19] Refactoring --- tools/{generate_co_files => generate_mo_files} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tools/{generate_co_files => generate_mo_files} (100%) diff --git a/tools/generate_co_files b/tools/generate_mo_files similarity index 100% rename from tools/generate_co_files rename to tools/generate_mo_files From 7f270018a7e28cde349b3157fa83ef44e0994314 Mon Sep 17 00:00:00 2001 From: mabarroso Date: Sun, 12 May 2013 21:08:32 +0200 Subject: [PATCH 15/19] Locale suport for main feature --- src/github-api.php | 6 ++-- src/github-embed.php | 46 ++++++++++++++++++----------- src/languages/githubembed-es_ES.mo | Bin 307 -> 720 bytes src/languages/githubembed-es_ES.po | 30 +++++++++++++++++++ 4 files changed, 61 insertions(+), 21 deletions(-) mode change 100644 => 100755 src/github-api.php mode change 100644 => 100755 src/languages/githubembed-es_ES.mo diff --git a/src/github-api.php b/src/github-api.php old mode 100644 new mode 100755 index 1668c99..36b3835 --- a/src/github-api.php +++ b/src/github-api.php @@ -1,4 +1,4 @@ - 'WordPress Github oEmbed plugin - https://github.com/leewillis77/wp-github-oembed'); - + $this->log ( __FUNCTION__." : $url", GEDEBUG_CALL ); $results = wp_remote_get ( $url, $args ); @@ -189,7 +189,7 @@ public function get_user ( $user ) { return json_decode ( $results['body'] ); } - + private function log ( $msg, $level ) { diff --git a/src/github-embed.php b/src/github-embed.php index a218d2f..4b8dfa9 100755 --- a/src/github-embed.php +++ b/src/github-embed.php @@ -52,24 +52,34 @@ class github_embed { public function __construct ( $api ) { $this->api = $api; - add_action ( 'init', array ( $this, 'register_oembed_handler' ) ); add_action ( 'init', array ( $this, 'maybe_handle_oembed' ) ); + add_action ( 'wp_enqueue_scripts', array ( $this, 'enqueue_styles' ) ); add_action ( 'admin_init', array ( $this, 'schedule_expiry' ) ); add_action ( 'github_embed_cron', array ( $this, 'cron' ) ); - if(is_admin()){ - add_action('admin_menu', array($this, 'add_plugin_page')); - add_action('admin_init', array($this, 'page_init')); - } + add_action ( 'plugins_loaded', array ( $this, 'i18n' ) ); + //add_action ( 'init', array ( $this, 'i18n' ) ); + if(is_admin()){ + add_action('admin_menu', array($this, 'add_plugin_page')); + add_action('admin_init', array($this, 'page_init')); + } } + /** + * Init i18n files + */ + function i18n() { + $this->plugin_directory = dirname(__FILE__) . '/'; + load_plugin_textdomain('githubembed', false, 'github-embed/languages/'); + } + /** * Create admin menu entry under "Settings" */ public function add_plugin_page() { - add_options_page('Settings Admin', 'Github Embed', 'manage_options', 'githubembed-setting-admin', array($this, 'create_admin_page')); + add_options_page('Settings Admin', 'Github Embed', 'manage_options', 'githubembed-setting-admin', array($this, 'create_admin_page')); } /** @@ -79,13 +89,13 @@ public function create_admin_page() { ?>
-

Github Embed Settings

+

- +
html = '
'; $response->html .= '

'.esc_html($repo->description)."
"; - $response->html .= 'Milestone: '; + $response->html .= ''.__('Milestone', 'githubembed').': '; $response->html .= ''.esc_html($summary->title)."
"; - $response->html .= 'Issues: '; + $response->html .= ''.__('Issues', 'githubembed').': '; $response->html .= ''; - $response->html .= esc_html ( number_format_i18n ( $summary->open_issues ) )." open, "; - $response->html .= esc_html ( number_format_i18n ( $summary->closed_issues ) )." closed.
"; + $response->html .= esc_html ( number_format_i18n ( $summary->open_issues ) )." ".__('open', 'githubembed').", "; + $response->html .= esc_html ( number_format_i18n ( $summary->closed_issues ) )." ".__('closed', 'githubembed').".
"; if ( ! empty ( $summary->due_on ) ) { - $response->html .= 'Due: '; + $response->html .= ''.__('Due', 'githubembed').': '; $due_date = date_format ( date_create ( $summary->due_on ), 'jS F Y' ); $response->html .= ''.esc_html($due_date).'
'; } @@ -374,13 +384,13 @@ private function oembed_github_repo ( $owner, $repository ) { $response->html = '

'; $response->html .= '

'.esc_html($repo->description)."
"; $response->html .= ''.esc_html($repo->html_url)."
"; - $response->html .= esc_html ( number_format_i18n ( $repo->forks_count ) )." forks.
"; - $response->html .= esc_html ( number_format_i18n ( $repo->open_issues_count ) )." open issues.
"; + $response->html .= esc_html ( number_format_i18n ( $repo->forks_count ) )." ".__('forks', 'githubembed').".
"; + $response->html .= esc_html ( number_format_i18n ( $repo->open_issues_count ) )." ".__('open issues', 'githubembed').".
"; if ( count ( $commits ) ) { $cnt = 0; - $response->html .= 'Recent commits:'; + $response->html .= __('Recent commits', 'githubembed').':'; $response->html .= '

    '; foreach ( $commits as $commit ) { @@ -429,8 +439,8 @@ private function oembed_github_author ( $owner ) { // @TODO This should all be templated $response->html = '
    '; $response->html .= '

    '.esc_html($owner)."
    "; - $response->html .= esc_html ( number_format_i18n ( $owner_info->public_repos ) ).' repositories, '; - $response->html .= esc_html ( number_format_i18n ( $owner_info->followers ) ).' followers.

    '; + $response->html .= esc_html ( number_format_i18n ( $owner_info->public_repos ) ).' '.__('repositories', 'githubembed').', '; + $response->html .= esc_html ( number_format_i18n ( $owner_info->followers ) ).' '.__('followers', 'githubembed').'.

    '; $response->html .= '
    '; header ( 'Content-Type: application/json' ); diff --git a/src/languages/githubembed-es_ES.mo b/src/languages/githubembed-es_ES.mo old mode 100644 new mode 100755 index 626f449adf49a2910a14ee14c877baf38fb4d5fc..a04bc773d0dbde522e68981bf19cecc9280738b9 GIT binary patch literal 720 zcmYk2zi!k(5XKi0ARK?BAm|WU9>8!%72U}NgbQ2|2|)-Q(%yRRJi^|!cGn7NXrPD` zi3X@s(IFZhA@9Kx@DP0CGbAI8f1cUdZ)W!Qt@UpTb_0GF{t3Pb{{t5rUQp^9I0Dze z9J~WQ1}}qez^mX}@FrOH`GY?H0lb9#5x5S121V}+cpW?eKY~B{czAJjo`d(0pY?GG z%KZe&e23r$cnl7}ub}if>GR*g+lYUH(&rRJ3k7s0yU6^q_Z7I@{bw?tXo|k{l>J1b zv+asZ(ALdTv0Fwpi?OAscDbUMyd(9JEV-nuuWL?G*~&*M z)WTPlKcEot7v4qX8*<%8^GYC4<0B^@Skz{_(`+Br?A=(89t;QD-X+Lpdxs5;b)xs_ zVN)4)6KzWqBBlKG-cGi4Ru_zm3kuoPSzln%vEG_<8oa35V5)4#hdPe6Yq~Jzk0yHc zn>&3!*Q3cmJ@Fy@-+!N+<(e^pR~Ti%OUPJ0{pEB)`uxi%Mr9%8CaULH2=(1d=s;Ek ku%0DI7e1;;%a#itkPD{91v6&~2`A@N^eTzdvo}J;U$2Ly1poj5 delta 124 zcmcb>x|u2ao)F7a1|VPtVi_Pd0b*7l_5orLNC0APAWj5gQ6SC*;$|r30n+S@3=DEW nS_DV~5g0H5NsxJ9;GC11Sfr4gn4B@$o>5}*8per}J(=VI^@ Date: Sun, 12 May 2013 21:39:50 +0200 Subject: [PATCH 16/19] Fix css URL --- src/github-embed.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/github-embed.php b/src/github-embed.php index 4b8dfa9..45b51a9 100755 --- a/src/github-embed.php +++ b/src/github-embed.php @@ -148,13 +148,12 @@ function cron() { */ function enqueue_styles() { - wp_register_style ( 'github-embed', plugins_url(basename(dirname(__FILE__)).'/css/github-embed.css' ) ); + wp_register_style ( 'github-embed', plugins_url('/github-embed/css/github-embed.css' ) ); wp_enqueue_style ( 'github-embed' ); } - /** * Register the oEmbed provider, and point it at a local endpoint since github * doesn't directly support oEmbed yet. Our local endpoint will use the github From 386e05a05732cd744042b2cbd0ed505335e34276 Mon Sep 17 00:00:00 2001 From: mabarroso Date: Mon, 13 May 2013 21:17:06 +0200 Subject: [PATCH 17/19] Internationalization and deploy notes --- README.md | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fbdf812..f7113aa 100755 --- a/README.md +++ b/README.md @@ -44,20 +44,38 @@ Not yet, we're hoping to add templating - all contributions welcome! Versioned files ``` -+ / - + doc/ Docs files - + features/ Behat feature files and bootstrap - + src/ Module source files - + tools/ Automated plugin packager scripts + + doc/ Docs files + + features/ Behat feature files and bootstrap + + src/ Module source files + + css/ Styles + + languages/ Locale .mo and .po files + + tools/ Automated plugin packager scripts ``` Not versioned files (autogenerated). ``` -+ / - + bin/ Behat binaries. Generated by composer. - + out/ The module package to deploy. Generated by tools/release script. - + vendor/ Useful libraries. Generated by composer. + + bin/ Behat binaries. Generated by composer. + + out/ The module package to deploy. Generated by tools/release script. + + vendor/ Useful libraries. Generated by composer. ``` +###Internationalization + Only .po files must be updated. Filename format is **githubembed-*LANGUAGE CODE*.po**, for example: *githubembed-es_ES.po* + + To generate .mo files use +```shell + ./tools/generate_mo_files +``` + +###Deploy + Use *release* script to generate the plugin package +```shell + ./tools/release +``` + + The package files .zip and .tar.gz will be in *out/* directory + ###Recommended environment ####Testing server 1. Install and configure two english Wordpress sites running at http://localhost/sandbox/wordpress/simply/ and http://localhost/sandbox/wordpress/multisite/ From bf0d86c47351923ea4b45772b83deb4d7b3e5cdd Mon Sep 17 00:00:00 2001 From: mabarroso Date: Mon, 13 May 2013 22:05:41 +0200 Subject: [PATCH 18/19] Refactoring --- src/github-embed.php | 55 ++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/src/github-embed.php b/src/github-embed.php index 45b51a9..d755120 100755 --- a/src/github-embed.php +++ b/src/github-embed.php @@ -39,52 +39,47 @@ */ class github_embed { - - private $api; + /** + * Constructor. Registers hooks and filters + * @param class $api An instance of the github_api classs + */ + public function __construct ( $api ) { + $this->api = $api; + add_action ( 'init', array ( $this, 'register_oembed_handler' ) ); + add_action ( 'init', array ( $this, 'maybe_handle_oembed' ) ); - /** - * Constructor. Registers hooks and filters - * @param class $api An instance of the github_api classs - */ - public function __construct ( $api ) { - - $this->api = $api; - add_action ( 'init', array ( $this, 'register_oembed_handler' ) ); - add_action ( 'init', array ( $this, 'maybe_handle_oembed' ) ); - - add_action ( 'wp_enqueue_scripts', array ( $this, 'enqueue_styles' ) ); - add_action ( 'admin_init', array ( $this, 'schedule_expiry' ) ); - add_action ( 'github_embed_cron', array ( $this, 'cron' ) ); + add_action ( 'wp_enqueue_scripts', array ( $this, 'enqueue_styles' ) ); + add_action ( 'admin_init', array ( $this, 'schedule_expiry' ) ); + add_action ( 'github_embed_cron', array ( $this, 'cron' ) ); - add_action ( 'plugins_loaded', array ( $this, 'i18n' ) ); - //add_action ( 'init', array ( $this, 'i18n' ) ); - if(is_admin()){ - add_action('admin_menu', array($this, 'add_plugin_page')); - add_action('admin_init', array($this, 'page_init')); - } - } + add_action ( 'plugins_loaded', array ( $this, 'i18n' ) ); + if(is_admin()){ + add_action('admin_menu', array($this, 'add_plugin_page')); + add_action('admin_init', array($this, 'page_init')); + } + } /** - * Init i18n files - */ + * Init i18n files + */ function i18n() { $this->plugin_directory = dirname(__FILE__) . '/'; load_plugin_textdomain('githubembed', false, 'github-embed/languages/'); } /** - * Create admin menu entry under "Settings" - */ + * Create admin menu entry under "Settings" + */ public function add_plugin_page() { add_options_page('Settings Admin', 'Github Embed', 'manage_options', 'githubembed-setting-admin', array($this, 'create_admin_page')); } /** - * The admin page constructor - */ + * The admin page constructor + */ public function create_admin_page() { ?>
    @@ -102,8 +97,8 @@ public function create_admin_page() { } /** - * Create the admin page elements - */ + * Create the admin page elements + */ public function page_init() { register_setting('githubembed_cache_group', 'array_key', array($this, 'cron')); } From 2e1adebd00b0fddbfb7def0145c55dbc7bcb09be Mon Sep 17 00:00:00 2001 From: mabarroso Date: Mon, 13 May 2013 22:10:10 +0200 Subject: [PATCH 19/19] Aceptance tests notes --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index f7113aa..da930d6 100755 --- a/README.md +++ b/README.md @@ -118,6 +118,21 @@ You can test the development environment configuration ./bin/behat features/enviroment/ ``` +Run all tests +```shell + ./bin/behat +``` + +Run all tests for simply wordpress +```shell + ./bin/behat features/simply/ +``` + +Run all tests for multisite wordpress +```shell + ./bin/behat features/multisite/ +``` + **Wordpress admin must be in english for BDD tests** ## Changelog