fixed conflict and removed test in initializer

This commit is contained in:
Jonathan Labreuille
2015-07-29 16:56:23 +02:00
9 changed files with 192 additions and 339 deletions

217
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "5961fe00f44e01c734f498cfbdf10f48",
"hash": "ca23a0ffe44c50818331ee31a87b12d7",
"packages": [
{
"name": "cerdic/css-tidy",
@@ -39,221 +39,6 @@
"description": "CSSTidy is a CSS minifier",
"time": "2014-10-26 15:28:55"
},
{
"name": "pear-pear.php.net/Archive_Tar",
"version": "1.4.0",
"dist": {
"type": "file",
"url": "http://pear.php.net/get/Archive_Tar-1.4.0.tgz",
"reference": null,
"shasum": null
},
"require": {
"php": ">=5.2.0.0"
},
"replace": {
"pear-pear/archive_tar": "== 1.4.0.0"
},
"type": "pear-library",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"New BSD License"
],
"description": "This class provides handling of tar files in PHP.\nIt supports creating, listing, extracting and adding to tar files.\nGzip support is available if PHP has the zlib extension built-in or\nloaded. Bz2 compression is also supported with the bz2 extension loaded."
},
{
"name": "pear-pear.php.net/Console_Getopt",
"version": "1.4.1",
"dist": {
"type": "file",
"url": "http://pear.php.net/get/Console_Getopt-1.4.1.tgz",
"reference": null,
"shasum": null
},
"require": {
"php": ">=5.4.0.0"
},
"replace": {
"pear-pear/console_getopt": "== 1.4.1.0"
},
"type": "pear-library",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"BSD-2-Clause"
],
"description": "This is a PHP implementation of \"getopt\" supporting both\nshort and long options."
},
{
"name": "pear-pear.php.net/Net_POP3",
"version": "1.3.8",
"dist": {
"type": "file",
"url": "http://pear.php.net/get/Net_POP3-1.3.8.tgz",
"reference": null,
"shasum": null
},
"require": {
"pear-pear.php.net/net_socket": ">=1.0.0.0",
"php": ">=4.0.0.0"
},
"replace": {
"pear-pear/net_pop3": "== 1.3.8.0"
},
"type": "pear-library",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"BSD"
],
"description": "Provides a POP3 class to access POP3 server. Support all POP3 commands\n including UIDL listings, APOP authentication, DIGEST-MD5 and CRAM-MD5\n using optional Auth_SASL package"
},
{
"name": "pear-pear.php.net/Net_Socket",
"version": "1.0.14",
"dist": {
"type": "file",
"url": "http://pear.php.net/get/Net_Socket-1.0.14.tgz",
"reference": null,
"shasum": null
},
"require": {
"php": ">=4.3.0.0"
},
"replace": {
"pear-pear/net_socket": "== 1.0.14.0"
},
"type": "pear-library",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"PHP License"
],
"description": "Net_Socket is a class interface to TCP sockets. It provides blocking\n and non-blocking operation, with different reading and writing modes\n (byte-wise, block-wise, line-wise and special formats like network\n byte-order ip addresses)."
},
{
"name": "pear-pear.php.net/PEAR",
"version": "1.9.5",
"dist": {
"type": "file",
"url": "http://pear.php.net/get/PEAR-1.9.5.tgz",
"reference": null,
"shasum": null
},
"require": {
"ext-pcre": "*",
"ext-xml": "*",
"pear-pear.php.net/archive_tar": ">=1.3.11.0",
"pear-pear.php.net/console_getopt": ">=1.2.0.0",
"pear-pear.php.net/structures_graph": ">=1.0.2.0",
"pear-pear.php.net/xml_util": ">=1.2.0.0",
"php": ">=4.4.0.0,!=5.0.0.0,!=5.1.0.0,!=5.1.1.0,!=5.1.2.0,!=5.1.3.0,!=5.1.4.0,!=5.1.5.0"
},
"conflict": {
"pear-pear.php.net/pear_frontend_gtk": "<0.4.0.0",
"pear-pear.php.net/pear_frontend_web": "<=0.4.0.0"
},
"replace": {
"pear-pear/pear": "== 1.9.5.0"
},
"type": "pear-library",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"New BSD License"
],
"description": "The PEAR package contains:\n * the PEAR installer, for creating, distributing\n and installing packages\n * the PEAR_Exception PHP5 error handling mechanism\n * the PEAR_ErrorStack advanced error handling mechanism\n * the PEAR_Error error handling mechanism\n * the OS_Guess class for retrieving info about the OS\n where PHP is running on\n * the System class for quick handling of common operations\n with files and directories\n * the PEAR base class\n Features in a nutshell:\n * full support for channels\n * pre-download dependency validation\n * new package.xml 2.0 format allows tremendous flexibility while maintaining BC\n * support for optional dependency groups and limited support for sub-packaging\n * robust dependency support\n * full dependency validation on uninstall\n * remote install for hosts with only ftp access - no more problems with\n restricted host installation\n * full support for mirroring\n * support for bundling several packages into a single tarball\n * support for static dependencies on a url-based package\n * support for custom file roles and installation tasks"
},
{
"name": "pear-pear.php.net/Structures_Graph",
"version": "1.1.1",
"dist": {
"type": "file",
"url": "http://pear.php.net/get/Structures_Graph-1.1.1.tgz",
"reference": null,
"shasum": null
},
"require": {
"php": ">=5.3.0.0"
},
"replace": {
"pear-pear/structures_graph": "== 1.1.1.0"
},
"type": "pear-library",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"LGPL-3.0+"
],
"description": "Structures_Graph is a package for creating and manipulating graph datastructures. It allows building of directed\nand undirected graphs, with data and metadata stored in nodes. The library provides functions for graph traversing\nas well as for characteristic extraction from the graph topology."
},
{
"name": "pear-pear.php.net/XML_Util",
"version": "1.3.0",
"dist": {
"type": "file",
"url": "http://pear.php.net/get/XML_Util-1.3.0.tgz",
"reference": null,
"shasum": null
},
"require": {
"ext-pcre": "*",
"php": ">=5.3.0.0"
},
"replace": {
"pear-pear/xml_util": "== 1.3.0.0"
},
"type": "pear-library",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"BSD License"
],
"description": "Selection of methods that are often needed when working with XML documents. Functionality includes creating of attribute lists from arrays, creation of tags, validation of XML names and more."
},
{
"name": "phpmailer/phpmailer",
"version": "v5.2.10",

19
lib/config/env.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
namespace MailPoet\Config;
if(!defined('ABSPATH')) exit;
class Env {
public static $db_prefix;
public static $db_host;
public static $db_username;
public static $db_password;
public static function init() {
global $wpdb;
self::$db_prefix = $wpdb->prefix;
self::$db_host = DB_HOST;
self::$db_username = DB_USER;
self::$db_password = DB_PASSWORD;
}
}

View File

@@ -6,14 +6,6 @@ use MailPoet\WP;
if(!defined('ABSPATH')) exit;
/*
this is a comment
*/
// another comment
$var = __('super long string
that takes multiple lines
and takes 3 lines');
class Initializer {
public $version;
@@ -23,12 +15,11 @@ class Initializer {
public $assets_path;
public $assets_url;
public function __construct($params = array(
'file' => '',
'version' => '1.0.0'
)) {
Env::init();
$this->data = array();
$this->version = $params['version'];
$this->shortname = 'wysija-newsletters';

9
lib/config/migrator.php Normal file
View File

@@ -0,0 +1,9 @@
<?php
namespace MailPoet\Config;
if(!defined('ABSPATH')) exit;
class Migrator {
function __construct() {
}
}

View File

@@ -2,6 +2,8 @@
namespace MailPoet\Config;
use \MailPoet\WP;
if(!defined('ABSPATH')) exit;
class Settings {
function __construct() {

30
tests/unit/EnvCest.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
use \UnitTester;
use \MailPoet\Config\Env;
class EnvCest {
public function _before() {
Env::init();
}
public function itCanReturnTheDbPrefix() {
global $wpdb;
$db_prefix = $wpdb->prefix;
expect(Env::$db_prefix)->equals($db_prefix);
}
public function itCanReturnTheDbHost() {
expect(Env::$db_host)->equals(DB_HOST);
}
public function itCanReturnTheDbUser() {
expect(Env::$db_username)->equals(DB_USER);
}
public function itCanReturnTheDbPassword() {
expect(Env::$db_password)->equals(DB_PASSWORD);
}
public function _after() {
}
}

View File

@@ -0,0 +1,15 @@
<?php
use \UnitTester;
use \MailPoet\Config\Migrator;
class MigratorCest {
public function _before() {
$migrator = new Migrator();
}
public function itCanBeCreated() {
}
public function _after() {
}
}

View File

@@ -8,3 +8,5 @@ if($wordpress_path) {
} else {
throw new Exception("You need to specify the path to your WordPress installation\n`WP_TEST_PATH` in your .env file");
}
\MailPoet\Config\Env::init();