assertAttributeEquals() public static method

Asserts that a variable is equal to an attribute of an object.
public static assertAttributeEquals ( mixed $expected, string $actualAttributeName, string | object $actualClassOrObject, string $message = '', float $delta, integer $maxDepth = 10, boolean $canonicalize = false, boolean $ignoreCase = false )
$expected mixed
$actualAttributeName string
$actualClassOrObject string | object
$message string
$delta float
$maxDepth integer
$canonicalize boolean
$ignoreCase boolean
Esempio n. 1
0
/**
 * Asserts that a variable is equal to an attribute of an object.
 *
 * @param  mixed   $expected
 * @param  string  $actualAttributeName
 * @param  string  $actualClassOrObject
 * @param  string  $message
 * @param  float   $delta
 * @param  integer $maxDepth
 * @param  boolean $canonicalize
 * @param  boolean $ignoreCase
 */
function assertAttributeEquals($expected, $actualAttributeName, $actualClassOrObject, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = FALSE, $ignoreCase = FALSE)
{
    return PHPUnit_Framework_Assert::assertAttributeEquals($expected, $actualAttributeName, $actualClassOrObject, $message, $delta, $maxDepth, $canonicalize, $ignoreCase);
}
 /**
  * @Then I should have the application
  */
 public function applicationExists(TableNode $table)
 {
     /** @var ApplicationManager $applicationManager */
     $applicationManager = self::$application->getServiceManager()->get('application/application-manager');
     $data = [];
     foreach ($table->getTable() as $row) {
         $data[$row[0]] = $row[1];
     }
     $application = $applicationManager->get($data['name']);
     \PHPUnit_Framework_Assert::assertInstanceOf('Continuous\\DeployAgent\\Application\\Application', $application);
     foreach ($data as $property => $value) {
         switch ($property) {
             case 'pipeline':
                 $property = 'reference';
             case 'token':
             case 'repositoryProvider':
             case 'repository':
                 \PHPUnit_Framework_Assert::assertAttributeEquals($value, $property, $application->getProvider());
                 break;
             case 'provider':
                 $provider = self::$application->getServiceManager()->get('provider/' . $value);
                 \PHPUnit_Framework_Assert::assertAttributeInstanceOf(get_class($provider), $property, $application);
                 break;
             default:
                 \PHPUnit_Framework_Assert::assertAttributeEquals($value, $property, $application);
         }
     }
 }