PHP code example of atoum / deprecated-extension

1. Go to this page and download the library: Download atoum/deprecated-extension library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

atoum / deprecated-extension example snippets




namespace fooNs
{
    class foo
    {
        public function foo()
        {
            trigger_error('Deprecated since 2.0. use ->bar instead', E_USER_DEPRECATED);
            return "foo";
        }
    }
}

namespace fooNs\tests\units
{
    use mageekguy\atoum;

    class foo extends atoum\test
    {
        public function testFoo()
        {
            $this
                ->if($testedClass = new \fooNs\foo)
                ->then
                    ->string($testedClass->foo())
                        ->isEqualTo('foo')
            ;
        }
    }
}




// .atoum.php

use mageekguy\atoum\deprecated;

$runner->removeExtension(deprecated\extension::class);

public function testError()
{
    $this
        ->if($testedClass = new \fooNs\foo)
        ->then
        ->string($testedClass->foo())
            ->error("Deprecated since 2.0. use ->bar instead", E_USER_DEPRECATED)->exists()
    ;
}