コード例 #1
0
    function it_should_use_operation_name_to_define_params(Operation $operation, Parameter $param1, Parameter $param2)
    {
        $param1->getType()->willReturn('string');
        $param1->getDescription()->willReturn('This is the Name desc');
        $operation->getParam('Name')->willReturn($param1);
        $param2->getType()->willReturn('int');
        $param2->getDescription()->willReturn('This is the Container desc');
        $operation->getParam('Container')->willReturn($param2);
        $operation->getIteratorName()->willReturn(false);
        $this->description->getOperation('BarOperation')->shouldBeCalled();
        $this->description->getOperation('BarOperation')->willReturn($operation);
        $class = new \ReflectionClass(__NAMESPACE__ . '\\FixturesClass');
        $method = $class->getMethod('barOperation');
        $this->beConstructedWith($this->stream, $method, $this->description);
        $string = <<<'EOT'
.. method:: barOperation($name, $container, array $options = [])

    :param string $name: This is the Name desc
    :param int $container: This is the Container desc
    :param array $options: See Additional Parameters table
    :return: an array-like model object (like a read-only struct) that implements \ArrayAccess
    :rtype: OpenStack\Common\Model\ModelInterface
    :raises CommandException: If a HTTP or network connection error occurs
EOT;
        $this->stream->write($string)->shouldBeCalled();
        $this->write();
    }
コード例 #2
0
    function it_writes_additional_properties(Operation $operation, Parameter $param1, Parameter $param2, Parameter $param3)
    {
        $param1->getName()->willReturn('Foo');
        $param1->getType()->willReturn('string');
        $param1->getDescription()->willReturn('This is a desc of Foo');
        $param1->getStatic()->willReturn(false);
        $param1->getEnum()->willReturn(false);
        $param1->getRequired()->willReturn(false);
        $param2->getName()->willReturn('Bar');
        $param2->getType()->willReturn('string');
        $param2->getDescription()->willReturn('This is a desc of Bar');
        $param2->getStatic()->willReturn(false);
        $param2->getEnum()->willReturn(false);
        $param2->getRequired()->willReturn(false);
        $param3->getName()->willReturn('Baz');
        $param3->getType()->willReturn('string');
        $param3->getDescription()->willReturn('This is a desc of Baz');
        $param3->getStatic()->willReturn(true);
        $param3->getEnum()->willReturn(false);
        $param3->getRequired()->willReturn(false);
        $operation->getParams()->willReturn([$param1, $param2, $param3]);
        $this->description->getOperation('BarOperation')->willReturn($operation);
        $string = <<<EOT
Additional Parameters
~~~~~~~~~~~~~~~~~~~~~

+--------+----------+------------+-------------------------+
| Name   | Type     | Required   | Description             |
+========+==========+============+=========================+
| Foo    | string   | No         | This is a desc of Foo   |
+--------+----------+------------+-------------------------+
| Bar    | string   | No         | This is a desc of Bar   |
+--------+----------+------------+-------------------------+
EOT;
        $this->stream->write($string)->shouldBeCalled();
        $this->write();
    }