PHP code example of tonybogdanov / mockable-annotations

1. Go to this page and download the library: Download tonybogdanov/mockable-annotations 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/ */

    

tonybogdanov / mockable-annotations example snippets


/**
 * @TestAnnotation("hello") 
 */
class TestClass {}

/**
 * @AnotherTestAnnotation("world") 
 */
class TestClass {}

$newAnnotation = new AnotherTestAnnotation();
$newAnnotation->value = "world";

$reader = new MockableAnnotationReader( new AnnotationReader() );
$reader->addClassMockProvider( new ClassMockProvider(
                               
   [ $newAnnotation ],
   new OverrideStrategy(),
   new ClassNameFilter( TestClass::class )

) );

$reader->getClassAnnotations( TestClass::class );
// ...