/** * Test the semantic() function * * @expectedException ErrorException * * @return void */ public function testSemantic() { $this->handler = new ParserPlugin('doesNotExist'); $this->handler = new ParserPlugin('Microdata'); PHPUnit_Framework_Assert::assertAttributeInstanceOf('PHPMicrodata', 'handler', $this->handler); $this->handler = new ParserPlugin('RDFa'); PHPUnit_Framework_Assert::assertAttributeInstanceOf('PHPRDFa', 'handler', $this->handler); }
/** * Asserts that an attribute is of a given type. * * @param string $expected * @param string $attributeName * @param mixed $classOrObject * @param string $message * @since Method available since Release 3.5.0 */ function assertAttributeInstanceOf($expected, $attributeName, $classOrObject, $message = '') { return PHPUnit_Framework_Assert::assertAttributeInstanceOf($expected, $attributeName, $classOrObject, $message); }
/** * @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); } } }
/** * @param ServiceProxyInterface|ServiceProxyCacheInterface $proxy */ protected function assertServiceCacheProxy($inputClass, ServiceProxyCacheInterface $proxy) { $this->assertProxy($inputClass, $proxy); Assert::assertInstanceOf('OpenClassrooms\\ServiceProxy\\ServiceProxyCacheInterface', $proxy); Assert::assertAttributeInstanceOf('OpenClassrooms\\DoctrineCacheExtension\\CacheProviderDecorator', 'proxy_cacheProvider', $proxy); }