Вход Регистрация
Файл: src/vendor/phpspec/prophecy/spec/Prophecy/Doubler/ClassPatch/MagicCallPatchSpec.php
Строк: 88
<?php

namespace specProphecyDoublerClassPatch;

use 
PhpSpecObjectBehavior;
use 
ProphecyArgument;
use 
ProphecyDoublerGeneratorNodeMethodNode;

class 
MagicCallPatchSpec extends ObjectBehavior
{
    function 
it_is_a_patch()
    {
        
$this->shouldBeAnInstanceOf('ProphecyDoublerClassPatchClassPatchInterface');
    }

    
/**
     * @param ProphecyDoublerGeneratorNodeClassNode $node
     */
    
function it_supports_anything($node)
    {
        
$this->supports($node)->shouldReturn(true);
    }

    
/**
     * @param ProphecyDoublerGeneratorNodeClassNode $node
     */
    
function it_discovers_api_using_phpdoc($node)
    {
        
$node->getParentClass()->willReturn('specProphecyDoublerClassPatchMagicalApi');

        
$node->addMethod(new MethodNode('undefinedMethod'))->shouldBeCalled();

        
$this->apply($node);
    }

    
/**
     * @param ProphecyDoublerGeneratorNodeClassNode $node
     */
    
function it_ignores_existing_methods($node)
    {
        
$node->getParentClass()->willReturn('specProphecyDoublerClassPatchMagicalApiExtended');

        
$node->addMethod(new MethodNode('undefinedMethod'))->shouldBeCalled();
        
$node->addMethod(new MethodNode('definedMethod'))->shouldNotBeCalled();

        
$this->apply($node);
    }

    
/**
     * @param ProphecyDoublerGeneratorNodeClassNode $node
     */
    
function it_discovers_api_using_phpdoc_from_interface($node)
    {
        
$node->getParentClass()->willReturn('specProphecyDoublerClassPatchMagicalApiImplemented');

        
$node->addMethod(new MethodNode('implementedMethod'))->shouldBeCalled();

        
$this->apply($node);
    }


    function 
it_has_50_priority()
    {
        
$this->getPriority()->shouldReturn(50);
    }
}

/**
 * @method void undefinedMethod()
 */
class MagicalApi
{
    
/**
     * @return void
     */
    
public function definedMethod()
    {

    }
}

/**
 * @method void undefinedMethod()
 * @method void definedMethod()
 */
class MagicalApiExtended extends MagicalApi
{

}

/**
 */
class MagicalApiImplemented implements MagicalApiInterface
{

}

/**
 * @method void implementedMethod()
 */
interface MagicalApiInterface
{

}
Онлайн: 2
Реклама