PHP code example of sakharovmaksim / annotation-processor

1. Go to this page and download the library: Download sakharovmaksim/annotation-processor 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/ */

    

sakharovmaksim / annotation-processor example snippets


public function setUp()
{
	$this->_processAnnotations();
}

private function _processAnnotations()
{
	$class = get_class($this);
	$methodName = $this->getName(false);
	$annotationProcessor = new AnnotationProcessor($class, $methodName);
	// @domains
	if ($domainsExcept = $annotationProcessor->process(new Annotation\ArrayAnnotation(AnnotationsNames::DOMAINS_EXCEPT)))
	{
		if (Env::isRC() && in_array(Env::RC, $domainsExcept))
		{
			$this->markTestSkipped("Skip the test that is not for RC: {$class}::{$methodName}");
		}
		elseif (Env::isProduction() && in_array(Env::PROD, $domainsExcept))
		{
			$this->markTestSkipped("Skip the test that is not for Production: {$class}::{$methodName}");
		}
		elseif (Env::isStand() && in_array(Env::STAND, $domainsExcept))
		{
			$this->markTestSkipped("Skip the test that is not for stands: {$class}::{$methodName}");
		}
	}
	// @bug
	if ($annotationProcessor->process(new Annotation\BoolAnnotation(AnnotationsNames::BUG)))
	{
		$this->markTestSkipped("Skip the test {$class}::{$methodName}, because it has deactivated due to a @bug!");
	}
	// @todocase
	if ($annotationProcessor->process(new Annotation\BoolAnnotation(AnnotationsNames::TODOCASE)))
	{
		$this->markTestSkipped("Skip the test {$class}::{$methodName}, because it has @todocase, write it!");
	}
}

/**
 * @labels Labels::RELEASE
 * @todocase Проверка поиска "Только туда"
 */
public function testSearchOW() {}