1

phpspec では、クラス プロパティに特定の型の配列が含まれていることをテストした仕様はどのように見えるでしょうか?

例えば:

class MyClass
{
   private $_mySpecialTypes = array();

   // Constructor ommitted which sets the mySpecialTypes value

   public function getMySpecialTypes()
   {
      return $this->_mySpecialTypes;
   }
}

私の仕様は次のようになります。

public function it_should_have_an_array_of_myspecialtypes()
{
    $this->getMySpecialTypes()->shouldBeArray();
}

しかし、配列内の各要素が型であることを確認したいMySpecialType

phpspecでこれを行う最良の方法は何ですか?

4

2 に答える 2