for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Peridot\Leo\Interfaces\Assert;
use Countable;
/**
* CollectionAssertTrait contains assertions that primarily
* deal with collections and countable values.
*
* @package Peridot\Leo\Interfaces\Assert
*/
trait CollectionAssertTrait
{
* Perform a length assertion.
* @param string|array|Countable $countable
* @param $length
* @param string $message
public function lengthOf($countable, $length, $message = '')
$this->assertion->setActual($countable);
assertion
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
return $this->assertion->to->have->length($length, $message);
}
* Perform an inclusion assertion.
* @param array|string $haystack
* @param mixed $needle
public function isIncluded($haystack, $needle, $message = '')
$this->assertion->setActual($haystack);
return $this->assertion->to->include($needle, $message);
* Perform a negated inclusion assertion.
public function notInclude($haystack, $needle, $message = '')
return $this->assertion->to->not->include($needle, $message);
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: