Skip to content

Commit

Permalink
Fixed license issue
Browse files Browse the repository at this point in the history
  • Loading branch information
overclokk committed Nov 25, 2019
1 parent 74afb3d commit 6debb1e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 16 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,18 @@ composer require italystrap/config

## Basic Usage

> TODO
```php
use ItalyStrap\Config\Config;

$config = new Config( $configObjOrArrayOptional, $configDefaultOptional );

$value = $config->get( 'key', $optionalDefaultValue );

```

## Advanced Usage

> TODO
You can see more advanced example in the tests folder.

## Contributing

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"lucatume/wp-browser": "~2.0",
"brightnucleus/config": "*",
"wpfulcrum/config": "*",
"italystrap/debug": "^2.0"
"italystrap/debug": "^2.0",
"phpunit/php-code-coverage": "^7.0"
}
}
5 changes: 2 additions & 3 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,15 @@

require( __DIR__ . '/vendor/autoload.php' );

use \ItalyStrap\Config\Config;
use \ItalyStrap\Config\Config_Factory;
use ItalyStrap\Config\{Config, ConfigFactory};

// $config = Config_Factory::make( [ 'test' => 'value' ], [ 'test' => null ] );
//
// d( $config->test_null );
// ddd( $config->test );

add_action( 'wp_footer', function () {
$config = Config_Factory::make( [ 'test' => 'value', 'test2' => 'value2' ], [ 'test' => null ] );
$config = ConfigFactory::make( [ 'test' => 'value', 'test2' => 'value2' ], [ 'test' => null ] );

// d( $config->all() );
//
Expand Down
25 changes: 15 additions & 10 deletions tests/unit/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,29 @@ public function testFileExists()
public function it_should_be_instantiatable()
{
$config = new Config();
$this->assertInstanceOf( '\ItalyStrap\Config\Config', $config );
$this->assertInstanceOf( '\ItalyStrap\Config\Config_Interface', $config );
$this->assertInstanceOf( ItalyStrap\Config\Config::class, $config );
$this->assertInstanceOf( ItalyStrap\Config\Config_Interface::class, $config );
$this->assertInstanceOf( ItalyStrap\Config\ConfigInterface::class, $config );

$config = new Config( [] );
$this->assertInstanceOf( '\ItalyStrap\Config\Config', $config );
$this->assertInstanceOf( '\ItalyStrap\Config\Config_Interface', $config );
$this->assertInstanceOf( ItalyStrap\Config\Config::class, $config );
$this->assertInstanceOf( ItalyStrap\Config\Config_Interface::class, $config );
$this->assertInstanceOf( ItalyStrap\Config\ConfigInterface::class, $config );

$config = new Config( [], [] );
$this->assertInstanceOf( '\ItalyStrap\Config\Config', $config );
$this->assertInstanceOf( '\ItalyStrap\Config\Config_Interface', $config );
$this->assertInstanceOf( ItalyStrap\Config\Config::class, $config );
$this->assertInstanceOf( ItalyStrap\Config\Config_Interface::class, $config );
$this->assertInstanceOf( ItalyStrap\Config\ConfigInterface::class, $config );

$config = new Config( $this->config_arr );
$this->assertInstanceOf( '\ItalyStrap\Config\Config', $config );
$this->assertInstanceOf( '\ItalyStrap\Config\Config_Interface', $config );
$this->assertInstanceOf( ItalyStrap\Config\Config::class, $config );
$this->assertInstanceOf( ItalyStrap\Config\Config_Interface::class, $config );
$this->assertInstanceOf( ItalyStrap\Config\ConfigInterface::class, $config );

$config = new Config( $this->config_arr, $this->default_arr );
$this->assertInstanceOf( '\ItalyStrap\Config\Config', $config );
$this->assertInstanceOf( '\ItalyStrap\Config\Config_Interface', $config );
$this->assertInstanceOf( ItalyStrap\Config\Config::class, $config );
$this->assertInstanceOf( ItalyStrap\Config\Config_Interface::class, $config );
$this->assertInstanceOf( ItalyStrap\Config\ConfigInterface::class, $config );
}

/**
Expand Down

0 comments on commit 6debb1e

Please sign in to comment.