public function tearDown() { Container::reset(); parent::tearDown(); }
<?php /** * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This file is part of the Core Framework package. * * (c) Shalom Sam <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ use Core\Container\Container; $di = new Container(); $di->register('Cache', '\\Core\\Cache\\AppCache'); $di->register('Config', '\\Core\\Config\\Config'); $di->register('IOStream', '\\Core\\Console\\IOStream'); $di->register('CliApplication', "\\Core\\Console\\CliApplication")->setArguments(array('IOStream', 'Config')); $di->register('Core', "\\Core\\Console\\Core")->setArguments(array('IOStream', 'Config'));
/** * @covers \Core\Container\Container::register * @covers \Core\Container\Container::setArguments */ public function testGetArgumentMethod() { $container = new Container(); $container->register('stdClass', function ($id) { return (object) ['id' => $id]; }, false)->setArguments([10]); $this->assertSame(10, $container->get('stdClass')->id); $this->assertSame([10], $container->getArguments('stdClass')); }