diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/InternalController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/InternalController.php index 3807e8cc9ead..8cf747f8c42d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/InternalController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/InternalController.php @@ -34,8 +34,8 @@ public function indexAction($path, $controller) $request = $this->container->get('request'); $attributes = $request->attributes; - $attributes->delete('path'); - $attributes->delete('controller'); + $attributes->remove('path'); + $attributes->remove('controller'); if ('none' !== $path) { parse_str($path, $tmp); diff --git a/src/Symfony/Bundle/FrameworkBundle/RequestListener.php b/src/Symfony/Bundle/FrameworkBundle/RequestListener.php index 2ce31c761faa..a1f8600e9669 100644 --- a/src/Symfony/Bundle/FrameworkBundle/RequestListener.php +++ b/src/Symfony/Bundle/FrameworkBundle/RequestListener.php @@ -49,8 +49,8 @@ public function register(EventDispatcher $dispatcher, $priority = 0) public function handle(Event $event) { - $request = $event->getParameter('request'); - $master = HttpKernelInterface::MASTER_REQUEST === $event->getParameter('request_type'); + $request = $event->get('request'); + $master = HttpKernelInterface::MASTER_REQUEST === $event->get('request_type'); $this->initializeSession($request, $master); diff --git a/src/Symfony/Bundle/WebProfilerBundle/WebDebugToolbarListener.php b/src/Symfony/Bundle/WebProfilerBundle/WebDebugToolbarListener.php index 74a989008449..2f8c69aafdfe 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/WebDebugToolbarListener.php +++ b/src/Symfony/Bundle/WebProfilerBundle/WebDebugToolbarListener.php @@ -47,7 +47,7 @@ public function register(EventDispatcher $dispatcher, $priority = 0) public function handle(Event $event, Response $response) { - if (HttpKernelInterface::MASTER_REQUEST !== $event->getParameter('request_type')) { + if (HttpKernelInterface::MASTER_REQUEST !== $event->get('request_type')) { return $response; } @@ -57,10 +57,10 @@ public function handle(Event $event, Response $response) $response->headers->get('location'), $response->headers->get('location')) ); $response->setStatusCode(200); - $response->headers->delete('Location'); + $response->headers->remove('Location'); } - $request = $event->getParameter('request'); + $request = $event->get('request'); if (!$response->headers->has('X-Debug-Token') || '3' === substr($response->getStatusCode(), 0, 1) || ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html')) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 850dbee20af0..6fdb5947edce 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -37,7 +37,7 @@ * Usage: * * $app = new Application('myapp', '1.0 (stable)'); - * $app->addCommand(new SimpleCommand()); + * $app->add(new SimpleCommand()); * $app->run(); * * @author Fabien Potencier @@ -74,8 +74,8 @@ public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN') new DialogHelper(), )); - $this->addCommand(new HelpCommand()); - $this->addCommand(new ListCommand()); + $this->add(new HelpCommand()); + $this->add(new ListCommand()); $this->definition = new InputDefinition(array( new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'), @@ -181,7 +181,7 @@ public function doRun(InputInterface $input, OutputInterface $output) } // the command name MUST be the first element of the input - $command = $this->findCommand($name); + $command = $this->find($name); $this->runningCommand = $command; $statusCode = $command->run($input, $output); @@ -329,7 +329,7 @@ public function getLongVersion() */ public function register($name) { - return $this->addCommand(new Command($name)); + return $this->add(new Command($name)); } /** @@ -340,7 +340,7 @@ public function register($name) public function addCommands(array $commands) { foreach ($commands as $command) { - $this->addCommand($command); + $this->add($command); } } @@ -353,7 +353,7 @@ public function addCommands(array $commands) * * @return Command The registered command */ - public function addCommand(Command $command) + public function add(Command $command) { $command->setApplication($this); @@ -375,7 +375,7 @@ public function addCommand(Command $command) * * @throws \InvalidArgumentException When command name given does not exist */ - public function getCommand($name) + public function get($name) { if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) { throw new \InvalidArgumentException(sprintf('The command "%s" does not exist.', $name)); @@ -386,7 +386,7 @@ public function getCommand($name) if ($this->wantHelps) { $this->wantHelps = false; - $helpCommand = $this->getCommand('help'); + $helpCommand = $this->get('help'); $helpCommand->setCommand($command); return $helpCommand; @@ -402,7 +402,7 @@ public function getCommand($name) * * @return Boolean true if the command exists, false otherwise */ - public function hasCommand($name) + public function has($name) { return isset($this->commands[$name]) || isset($this->aliases[$name]); } @@ -451,7 +451,7 @@ public function findNamespace($namespace) /** * Finds a command by name or alias. * - * Contrary to getCommand, this command tries to find the best + * Contrary to get, this command tries to find the best * match if you give it an abbreviation of a name or alias. * * @param string $name A command name or a command alias @@ -460,7 +460,7 @@ public function findNamespace($namespace) * * @throws \InvalidArgumentException When command name is incorrect or ambiguous */ - public function findCommand($name) + public function find($name) { // namespace $namespace = ''; @@ -481,7 +481,7 @@ public function findCommand($name) $abbrevs = static::getAbbreviations($commands); if (isset($abbrevs[$name]) && 1 == count($abbrevs[$name])) { - return $this->getCommand($namespace ? $namespace.':'.$abbrevs[$name][0] : $abbrevs[$name][0]); + return $this->get($namespace ? $namespace.':'.$abbrevs[$name][0] : $abbrevs[$name][0]); } if (isset($abbrevs[$name]) && count($abbrevs[$name]) > 1) { @@ -500,7 +500,7 @@ public function findCommand($name) throw new \InvalidArgumentException(sprintf('Command "%s" is ambiguous (%s).', $fullName, $this->getAbbreviationSuggestions($abbrevs[$fullName]))); } - return $this->getCommand($abbrevs[$fullName][0]); + return $this->get($abbrevs[$fullName][0]); } /** @@ -512,7 +512,7 @@ public function findCommand($name) * * @return array An array of Command instances */ - public function getCommands($namespace = null) + public function all($namespace = null) { if (null === $namespace) { return $this->commands; @@ -566,7 +566,7 @@ static public function getAbbreviations($names) */ public function asText($namespace = null) { - $commands = $namespace ? $this->getCommands($this->findNamespace($namespace)) : $this->commands; + $commands = $namespace ? $this->all($this->findNamespace($namespace)) : $this->commands; $messages = array($this->getHelp(), ''); if ($namespace) { @@ -607,7 +607,7 @@ public function asText($namespace = null) */ public function asXml($namespace = null, $asDom = false) { - $commands = $namespace ? $this->getCommands($this->findNamespace($namespace)) : $this->commands; + $commands = $namespace ? $this->all($this->findNamespace($namespace)) : $this->commands; $dom = new \DOMDocument('1.0', 'UTF-8'); $dom->formatOutput = true; diff --git a/src/Symfony/Component/Console/Command/HelpCommand.php b/src/Symfony/Component/Console/Command/HelpCommand.php index 5e0c30739bf3..3c3c6d7b96ad 100644 --- a/src/Symfony/Component/Console/Command/HelpCommand.php +++ b/src/Symfony/Component/Console/Command/HelpCommand.php @@ -65,7 +65,7 @@ public function setCommand(Command $command) protected function execute(InputInterface $input, OutputInterface $output) { if (null === $this->command) { - $this->command = $this->application->getCommand($input->getArgument('command_name')); + $this->command = $this->application->get($input->getArgument('command_name')); } if ($input->getOption('xml')) { diff --git a/src/Symfony/Component/Console/Shell.php b/src/Symfony/Component/Console/Shell.php index 278572795de0..38b2fbbfe276 100644 --- a/src/Symfony/Component/Console/Shell.php +++ b/src/Symfony/Component/Console/Shell.php @@ -97,7 +97,7 @@ protected function autocompleter($text, $position) // task name? if (false === strpos($text, ' ') || !$text) { - return array_keys($this->application->getCommands()); + return array_keys($this->application->all()); } // options and arguments? diff --git a/src/Symfony/Component/DomCrawler/Form.php b/src/Symfony/Component/DomCrawler/Form.php index a4bf28205963..72e18b6aa297 100644 --- a/src/Symfony/Component/DomCrawler/Form.php +++ b/src/Symfony/Component/DomCrawler/Form.php @@ -215,7 +215,7 @@ public function getMethod() * * @return Boolean true if the field exists, false otherwise */ - public function hasField($name) + public function has($name) { return isset($this->fields[$name]); } @@ -229,9 +229,9 @@ public function hasField($name) * * @throws \InvalidArgumentException When field is not present in this form */ - public function getField($name) + public function get($name) { - if (!$this->hasField($name)) { + if (!$this->has($name)) { throw new \InvalidArgumentException(sprintf('The form has no "%s" field', $name)); } @@ -245,7 +245,7 @@ public function getField($name) * * @return FormField The field instance */ - public function setField(Field\FormField $field) + public function set(Field\FormField $field) { $this->fields[$field->getName()] = $field; } @@ -255,7 +255,7 @@ public function setField(Field\FormField $field) * * @return array An array of fields */ - public function getFields() + public function all() { return $this->fields; } @@ -280,21 +280,21 @@ protected function initialize() $nodeName = $node->nodeName; if ($node === $button) { - $this->setField(new Field\InputFormField($node)); + $this->set(new Field\InputFormField($node)); } elseif ('select' == $nodeName || 'input' == $nodeName && 'checkbox' == $node->getAttribute('type')) { - $this->setField(new Field\ChoiceFormField($node)); + $this->set(new Field\ChoiceFormField($node)); } elseif ('input' == $nodeName && 'radio' == $node->getAttribute('type')) { - if ($this->hasField($node->getAttribute('name'))) { - $this->getField($node->getAttribute('name'))->addChoice($node); + if ($this->has($node->getAttribute('name'))) { + $this->get($node->getAttribute('name'))->addChoice($node); } else { - $this->setField(new Field\ChoiceFormField($node)); + $this->set(new Field\ChoiceFormField($node)); } } elseif ('input' == $nodeName && 'file' == $node->getAttribute('type')) { - $this->setField(new Field\FileFormField($node)); + $this->set(new Field\FileFormField($node)); } elseif ('input' == $nodeName && !in_array($node->getAttribute('type'), array('submit', 'button', 'image'))) { - $this->setField(new Field\InputFormField($node)); + $this->set(new Field\InputFormField($node)); } elseif ('textarea' == $nodeName) { - $this->setField(new Field\TextareaFormField($node)); + $this->set(new Field\TextareaFormField($node)); } } } @@ -308,7 +308,7 @@ protected function initialize() */ public function offsetExists($name) { - return $this->hasField($name); + return $this->has($name); } /** @@ -322,7 +322,7 @@ public function offsetExists($name) */ public function offsetGet($name) { - if (!$this->hasField($name)) { + if (!$this->has($name)) { throw new \InvalidArgumentException(sprintf('The form field "%s" does not exist', $name)); } @@ -339,7 +339,7 @@ public function offsetGet($name) */ public function offsetSet($name, $value) { - if (!$this->hasField($name)) { + if (!$this->has($name)) { throw new \InvalidArgumentException(sprintf('The form field "%s" does not exist', $name)); } diff --git a/src/Symfony/Component/EventDispatcher/Event.php b/src/Symfony/Component/EventDispatcher/Event.php index 71d85c2659ce..63d1a2dab058 100644 --- a/src/Symfony/Component/EventDispatcher/Event.php +++ b/src/Symfony/Component/EventDispatcher/Event.php @@ -102,7 +102,7 @@ public function isProcessed() * * @return array The event parameters */ - public function getParameters() + public function all() { return $this->parameters; } @@ -114,7 +114,7 @@ public function getParameters() * * @return Boolean true if the parameter exists, false otherwise */ - public function hasParameter($name) + public function has($name) { return array_key_exists($name, $this->parameters); } @@ -128,7 +128,7 @@ public function hasParameter($name) * * @throws \InvalidArgumentException When parameter doesn't exists for this event */ - public function getParameter($name) + public function get($name) { if (!array_key_exists($name, $this->parameters)) { throw new \InvalidArgumentException(sprintf('The event "%s" has no "%s" parameter.', $this->name, $name)); @@ -143,7 +143,7 @@ public function getParameter($name) * @param string $name The parameter name * @param mixed $value The parameter value */ - public function setParameter($name, $value) + public function set($name, $value) { $this->parameters[$name] = $value; } diff --git a/src/Symfony/Component/HttpFoundation/HeaderBag.php b/src/Symfony/Component/HttpFoundation/HeaderBag.php index 475dce98759d..97ed39ed57e0 100644 --- a/src/Symfony/Component/HttpFoundation/HeaderBag.php +++ b/src/Symfony/Component/HttpFoundation/HeaderBag.php @@ -145,11 +145,11 @@ public function contains($key, $value) } /** - * Deletes a header. + * Removes a header. * * @param string $key The HTTP header name */ - public function delete($key) + public function remove($key) { $key = strtr(strtolower($key), '_', '-'); diff --git a/src/Symfony/Component/HttpFoundation/ParameterBag.php b/src/Symfony/Component/HttpFoundation/ParameterBag.php index eedf0cc63e48..0e06f37184f4 100644 --- a/src/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/src/Symfony/Component/HttpFoundation/ParameterBag.php @@ -105,11 +105,11 @@ public function has($key) } /** - * Deletes a parameter. + * Removes a parameter. * * @param string $key The key */ - public function delete($key) + public function remove($key) { unset($this->parameters[$key]); } diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php index c5b615c9fb45..566ba82057d3 100644 --- a/src/Symfony/Component/HttpFoundation/Response.php +++ b/src/Symfony/Component/HttpFoundation/Response.php @@ -369,14 +369,14 @@ public function getExpires() /** * Sets the Expires HTTP header with a \DateTime instance. * - * If passed a null value, it deletes the header. + * If passed a null value, it removes the header. * * @param \DateTime $date A \DateTime instance */ public function setExpires(\DateTime $date = null) { if (null === $date) { - $this->headers->delete('Expires'); + $this->headers->remove('Expires'); } else { $date = clone $date; $date->setTimezone(new \DateTimeZone('UTC')); @@ -490,14 +490,14 @@ public function getLastModified() /** * Sets the Last-Modified HTTP header with a \DateTime instance. * - * If passed a null value, it deletes the header. + * If passed a null value, it removes the header. * * @param \DateTime $date A \DateTime instance */ public function setLastModified(\DateTime $date = null) { if (null === $date) { - $this->headers->delete('Last-Modified'); + $this->headers->remove('Last-Modified'); } else { $date = clone $date; $date->setTimezone(new \DateTimeZone('UTC')); @@ -524,7 +524,7 @@ public function getEtag() public function setEtag($etag = null, $weak = false) { if (null === $etag) { - $this->headers->delete('Etag'); + $this->headers->remove('Etag'); } else { if (0 !== strpos($etag, '"')) { $etag = '"'.$etag.'"'; @@ -595,7 +595,7 @@ public function setNotModified() // remove headers that MUST NOT be included with 304 Not Modified responses foreach (array('Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified') as $header) { - $this->headers->delete($header); + $this->headers->remove($header); } } diff --git a/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php b/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php index 16c905468e1a..7e7cee12871f 100644 --- a/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php +++ b/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php @@ -49,9 +49,9 @@ public function set($key, $values, $replace = true) /** * {@inheritdoc} */ - public function delete($key) + public function remove($key) { - parent::delete($key); + parent::remove($key); if ('cache-control' === strtr(strtolower($key), '_', '-')) { $this->computedCacheControl = array(); diff --git a/src/Symfony/Component/HttpKernel/Cache/Cache.php b/src/Symfony/Component/HttpKernel/Cache/Cache.php index 1d9fe89eaf9d..ded1143f6299 100644 --- a/src/Symfony/Component/HttpKernel/Cache/Cache.php +++ b/src/Symfony/Component/HttpKernel/Cache/Cache.php @@ -301,7 +301,7 @@ protected function validate(Request $request, $entry) } $entry = clone $entry; - $entry->headers->delete('Date'); + $entry->headers->remove('Date'); foreach (array('Date', 'Expires', 'Cache-Control', 'ETag', 'Last-Modified') as $name) { if ($response->headers->has($name)) { @@ -338,8 +338,8 @@ protected function fetch(Request $request) $subRequest->setMethod('get'); // avoid that the backend sends no content - $subRequest->headers->delete('if_modified_since'); - $subRequest->headers->delete('if_none_match'); + $subRequest->headers->remove('if_modified_since'); + $subRequest->headers->remove('if_none_match'); $response = $this->forward($subRequest); @@ -516,14 +516,14 @@ protected function restoreResponseBody(Response $response) } $response->setContent(ob_get_clean()); - $response->headers->delete('X-Body-Eval'); + $response->headers->remove('X-Body-Eval'); } elseif ($response->headers->has('X-Body-File')) { $response->setContent(file_get_contents($response->headers->get('X-Body-File'))); } else { return; } - $response->headers->delete('X-Body-File'); + $response->headers->remove('X-Body-File'); if (!$response->headers->has('Transfer-Encoding')) { $response->headers->set('Content-Length', strlen($response->getContent())); diff --git a/src/Symfony/Component/HttpKernel/Cache/Esi.php b/src/Symfony/Component/HttpKernel/Cache/Esi.php index 49a5c61f5d75..c7f5283099c8 100644 --- a/src/Symfony/Component/HttpKernel/Cache/Esi.php +++ b/src/Symfony/Component/HttpKernel/Cache/Esi.php @@ -155,7 +155,7 @@ public function process(Request $request, Response $response) if ($response->headers->has('Surrogate-Control')) { $value = $response->headers->get('Surrogate-Control'); if ('content="ESI/1.0"' == $value) { - $response->headers->delete('Surrogate-Control'); + $response->headers->remove('Surrogate-Control'); } elseif (preg_match('#,\s*content="ESI/1.0"#', $value)) { $response->headers->set('Surrogate-Control', preg_replace('#,\s*content="ESI/1.0"#', '', $value)); } elseif (preg_match('#content="ESI/1.0",\s*#', $value)) { diff --git a/src/Symfony/Component/HttpKernel/Cache/EsiListener.php b/src/Symfony/Component/HttpKernel/Cache/EsiListener.php index 3f62d9f87999..1635c7cb5e6f 100644 --- a/src/Symfony/Component/HttpKernel/Cache/EsiListener.php +++ b/src/Symfony/Component/HttpKernel/Cache/EsiListener.php @@ -57,7 +57,7 @@ public function register(EventDispatcher $dispatcher, $priority = 0) */ public function filter($event, Response $response) { - if (HttpKernelInterface::MASTER_REQUEST !== $event->getParameter('request_type')) { + if (HttpKernelInterface::MASTER_REQUEST !== $event->get('request_type')) { return $response; } diff --git a/src/Symfony/Component/HttpKernel/Debug/ExceptionListener.php b/src/Symfony/Component/HttpKernel/Debug/ExceptionListener.php index 41a51438a7b9..86a0a495442d 100644 --- a/src/Symfony/Component/HttpKernel/Debug/ExceptionListener.php +++ b/src/Symfony/Component/HttpKernel/Debug/ExceptionListener.php @@ -48,12 +48,12 @@ public function register(EventDispatcher $dispatcher, $priority = 0) public function handle(Event $event) { - if (HttpKernelInterface::MASTER_REQUEST !== $event->getParameter('request_type')) { + if (HttpKernelInterface::MASTER_REQUEST !== $event->get('request_type')) { return false; } - $exception = $event->getParameter('exception'); - $request = $event->getParameter('request'); + $exception = $event->get('exception'); + $request = $event->get('request'); if (null !== $this->logger) { $this->logger->err(sprintf('%s: %s (uncaught exception)', get_class($exception), $exception->getMessage())); diff --git a/src/Symfony/Component/HttpKernel/Profiler/ProfilerListener.php b/src/Symfony/Component/HttpKernel/Profiler/ProfilerListener.php index dd8bf3591474..4ed8b29f9507 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/ProfilerListener.php +++ b/src/Symfony/Component/HttpKernel/Profiler/ProfilerListener.php @@ -62,11 +62,11 @@ public function register(EventDispatcher $dispatcher, $priority = 0) */ public function handleException(Event $event) { - if (HttpKernelInterface::MASTER_REQUEST !== $event->getParameter('request_type')) { + if (HttpKernelInterface::MASTER_REQUEST !== $event->get('request_type')) { return false; } - $this->exception = $event->getParameter('exception'); + $this->exception = $event->get('exception'); return false; } @@ -80,11 +80,11 @@ public function handleException(Event $event) */ public function handleResponse(Event $event, Response $response) { - if (HttpKernelInterface::MASTER_REQUEST !== $event->getParameter('request_type')) { + if (HttpKernelInterface::MASTER_REQUEST !== $event->get('request_type')) { return $response; } - if (null !== $this->matcher && !$this->matcher->matches($event->getParameter('request'))) { + if (null !== $this->matcher && !$this->matcher->matches($event->get('request'))) { return $response; } @@ -92,7 +92,7 @@ public function handleResponse(Event $event, Response $response) return $response; } - $this->profiler->collect($event->getParameter('request'), $response, $this->exception); + $this->profiler->collect($event->get('request'), $response, $this->exception); $this->exception = null; return $response; diff --git a/src/Symfony/Component/HttpKernel/ResponseListener.php b/src/Symfony/Component/HttpKernel/ResponseListener.php index 9bb58f88aedd..d271c0f8d223 100644 --- a/src/Symfony/Component/HttpKernel/ResponseListener.php +++ b/src/Symfony/Component/HttpKernel/ResponseListener.php @@ -41,11 +41,11 @@ public function register(EventDispatcher $dispatcher, $priority = 0) */ public function filter(Event $event, Response $response) { - if (HttpKernelInterface::MASTER_REQUEST !== $event->getParameter('request_type') || $response->headers->has('Content-Type')) { + if (HttpKernelInterface::MASTER_REQUEST !== $event->get('request_type') || $response->headers->has('Content-Type')) { return $response; } - $request = $event->getParameter('request'); + $request = $event->get('request'); $format = $request->getRequestFormat(); if ((null !== $format) && $mimeType = $request->getMimeType($format)) { $response->headers->set('Content-Type', $mimeType); diff --git a/src/Symfony/Component/HttpKernel/Security/Firewall.php b/src/Symfony/Component/HttpKernel/Security/Firewall.php index cd6956f70250..aa0d862f8f57 100644 --- a/src/Symfony/Component/HttpKernel/Security/Firewall.php +++ b/src/Symfony/Component/HttpKernel/Security/Firewall.php @@ -60,11 +60,11 @@ public function register(EventDispatcher $dispatcher, $priority = 0) */ public function handle(Event $event) { - if (HttpKernelInterface::MASTER_REQUEST !== $event->getParameter('request_type')) { + if (HttpKernelInterface::MASTER_REQUEST !== $event->get('request_type')) { return; } - $request = $event->getParameter('request'); + $request = $event->get('request'); $this->dispatcher->disconnect('core.security'); list($listeners, $exception) = $this->map->getListeners($request); diff --git a/src/Symfony/Component/HttpKernel/Security/Firewall/AccessListener.php b/src/Symfony/Component/HttpKernel/Security/Firewall/AccessListener.php index 3eee7eb9cca6..8931b233deb7 100644 --- a/src/Symfony/Component/HttpKernel/Security/Firewall/AccessListener.php +++ b/src/Symfony/Component/HttpKernel/Security/Firewall/AccessListener.php @@ -65,7 +65,7 @@ public function handle(Event $event) throw new AuthenticationCredentialsNotFoundException('A Token was not found in the SecurityContext.'); } - $request = $event->getParameter('request'); + $request = $event->get('request'); list($attributes, $channel) = $this->map->getPatterns($request); diff --git a/src/Symfony/Component/HttpKernel/Security/Firewall/AnonymousAuthenticationListener.php b/src/Symfony/Component/HttpKernel/Security/Firewall/AnonymousAuthenticationListener.php index e7c556dc35d6..589850f7b216 100644 --- a/src/Symfony/Component/HttpKernel/Security/Firewall/AnonymousAuthenticationListener.php +++ b/src/Symfony/Component/HttpKernel/Security/Firewall/AnonymousAuthenticationListener.php @@ -55,7 +55,7 @@ public function register(EventDispatcher $dispatcher, $priority = 0) */ public function handle(Event $event) { - $request = $event->getParameter('request'); + $request = $event->get('request'); if (null !== $this->context->getToken()) { return; diff --git a/src/Symfony/Component/HttpKernel/Security/Firewall/BasicAuthenticationListener.php b/src/Symfony/Component/HttpKernel/Security/Firewall/BasicAuthenticationListener.php index 26b6e0beb9bc..b2006bb16a3d 100644 --- a/src/Symfony/Component/HttpKernel/Security/Firewall/BasicAuthenticationListener.php +++ b/src/Symfony/Component/HttpKernel/Security/Firewall/BasicAuthenticationListener.php @@ -60,7 +60,7 @@ public function register(EventDispatcher $dispatcher, $priority = 0) */ public function handle(Event $event) { - $request = $event->getParameter('request'); + $request = $event->get('request'); if (false === $username = $request->server->get('PHP_AUTH_USER', false)) { return; diff --git a/src/Symfony/Component/HttpKernel/Security/Firewall/ChannelListener.php b/src/Symfony/Component/HttpKernel/Security/Firewall/ChannelListener.php index 745894942f65..9e9894267f55 100644 --- a/src/Symfony/Component/HttpKernel/Security/Firewall/ChannelListener.php +++ b/src/Symfony/Component/HttpKernel/Security/Firewall/ChannelListener.php @@ -54,7 +54,7 @@ public function register(EventDispatcher $dispatcher, $priority = 0) */ public function handle(Event $event) { - $request = $event->getParameter('request'); + $request = $event->get('request'); list($attributes, $channel) = $this->map->getPatterns($request); diff --git a/src/Symfony/Component/HttpKernel/Security/Firewall/ContextListener.php b/src/Symfony/Component/HttpKernel/Security/Firewall/ContextListener.php index 9b3a143b09b8..19f4cf3c120a 100644 --- a/src/Symfony/Component/HttpKernel/Security/Firewall/ContextListener.php +++ b/src/Symfony/Component/HttpKernel/Security/Firewall/ContextListener.php @@ -55,7 +55,7 @@ public function register(EventDispatcher $dispatcher, $priority = 0) */ public function read(Event $event) { - $request = $event->getParameter('request'); + $request = $event->get('request'); $session = $request->hasSession() ? $request->getSession() : null; @@ -83,7 +83,7 @@ public function read(Event $event) */ public function write(Event $event, Response $response) { - if (HttpKernelInterface::MASTER_REQUEST !== $event->getParameter('request_type')) { + if (HttpKernelInterface::MASTER_REQUEST !== $event->get('request_type')) { return $response; } @@ -99,7 +99,7 @@ public function write(Event $event, Response $response) $this->logger->debug('Write SecurityContext in the session'); } - $event->getParameter('request')->getSession()->set('_security', serialize($token)); + $event->get('request')->getSession()->set('_security', serialize($token)); return $response; } diff --git a/src/Symfony/Component/HttpKernel/Security/Firewall/DigestAuthenticationListener.php b/src/Symfony/Component/HttpKernel/Security/Firewall/DigestAuthenticationListener.php index 933f93e78519..4229891fa833 100644 --- a/src/Symfony/Component/HttpKernel/Security/Firewall/DigestAuthenticationListener.php +++ b/src/Symfony/Component/HttpKernel/Security/Firewall/DigestAuthenticationListener.php @@ -63,7 +63,7 @@ public function register(EventDispatcher $dispatcher, $priority = 0) */ public function handle(Event $event) { - $request = $event->getParameter('request'); + $request = $event->get('request'); if (!$header = $request->server->get('PHP_AUTH_DIGEST')) { return; diff --git a/src/Symfony/Component/HttpKernel/Security/Firewall/ExceptionListener.php b/src/Symfony/Component/HttpKernel/Security/Firewall/ExceptionListener.php index 7111814ee365..5688e73a7bc6 100644 --- a/src/Symfony/Component/HttpKernel/Security/Firewall/ExceptionListener.php +++ b/src/Symfony/Component/HttpKernel/Security/Firewall/ExceptionListener.php @@ -62,8 +62,8 @@ public function register(EventDispatcher $dispatcher, $priority = 0) */ public function handleException(Event $event) { - $exception = $event->getParameter('exception'); - $request = $event->getParameter('request'); + $exception = $event->get('exception'); + $request = $event->get('request'); if ($exception instanceof AuthenticationException) { if (null !== $this->logger) { @@ -73,7 +73,7 @@ public function handleException(Event $event) try { $response = $this->startAuthentication($request, $exception); } catch (\Exception $e) { - $event->setParameter('exception', $e); + $event->set('exception', $e); return; } @@ -87,7 +87,7 @@ public function handleException(Event $event) try { $response = $this->startAuthentication($request, new InsufficientAuthenticationException('Full authentication is required to access this resource.', $token, 0, $exception)); } catch (\Exception $e) { - $event->setParameter('exception', $e); + $event->set('exception', $e); return; } @@ -110,7 +110,7 @@ public function handleException(Event $event) $this->logger->err(sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $e->getMessage())); } - $event->setParameter('exception', new \RuntimeException('Exception thrown when handling an exception.', 0, $e)); + $event->set('exception', new \RuntimeException('Exception thrown when handling an exception.', 0, $e)); return; } diff --git a/src/Symfony/Component/HttpKernel/Security/Firewall/FormAuthenticationListener.php b/src/Symfony/Component/HttpKernel/Security/Firewall/FormAuthenticationListener.php index aefe83a70851..58884cd88368 100644 --- a/src/Symfony/Component/HttpKernel/Security/Firewall/FormAuthenticationListener.php +++ b/src/Symfony/Component/HttpKernel/Security/Firewall/FormAuthenticationListener.php @@ -77,7 +77,7 @@ public function register(EventDispatcher $dispatcher, $priority = 0) */ public function handle(Event $event) { - $request = $event->getParameter('request'); + $request = $event->get('request'); if ($this->options['check_path'] !== $request->getPathInfo()) { return; diff --git a/src/Symfony/Component/HttpKernel/Security/Firewall/LogoutListener.php b/src/Symfony/Component/HttpKernel/Security/Firewall/LogoutListener.php index 3284d5135ddd..f2e19ccfea6a 100644 --- a/src/Symfony/Component/HttpKernel/Security/Firewall/LogoutListener.php +++ b/src/Symfony/Component/HttpKernel/Security/Firewall/LogoutListener.php @@ -58,7 +58,7 @@ public function register(EventDispatcher $dispatcher, $priority = 0) */ public function handle(Event $event) { - $request = $event->getParameter('request'); + $request = $event->get('request'); if ($this->logoutPath !== $request->getPathInfo()) { return; diff --git a/src/Symfony/Component/HttpKernel/Security/Firewall/PreAuthenticatedListener.php b/src/Symfony/Component/HttpKernel/Security/Firewall/PreAuthenticatedListener.php index 743da924adbe..fe325cc86ab0 100644 --- a/src/Symfony/Component/HttpKernel/Security/Firewall/PreAuthenticatedListener.php +++ b/src/Symfony/Component/HttpKernel/Security/Firewall/PreAuthenticatedListener.php @@ -58,7 +58,7 @@ public function register(EventDispatcher $dispatcher, $priority = 0) */ public function handle(Event $event) { - $request = $event->getParameter('request'); + $request = $event->get('request'); if (null !== $this->logger) { $this->logger->debug(sprintf('Checking secure context token: %s', $this->securityContext->getToken())); diff --git a/src/Symfony/Component/HttpKernel/Security/Firewall/SwitchUserListener.php b/src/Symfony/Component/HttpKernel/Security/Firewall/SwitchUserListener.php index 0cb7d582dd67..0552e10e0169 100644 --- a/src/Symfony/Component/HttpKernel/Security/Firewall/SwitchUserListener.php +++ b/src/Symfony/Component/HttpKernel/Security/Firewall/SwitchUserListener.php @@ -74,7 +74,7 @@ public function register(EventDispatcher $dispatcher, $priority = 0) */ public function handle(Event $event) { - $request = $event->getParameter('request'); + $request = $event->get('request'); if (!$request->get($this->usernameParameter)) { return; diff --git a/src/Symfony/Component/Routing/Generator/UrlGenerator.php b/src/Symfony/Component/Routing/Generator/UrlGenerator.php index 2387b1fd81d3..efd0db59fcfd 100644 --- a/src/Symfony/Component/Routing/Generator/UrlGenerator.php +++ b/src/Symfony/Component/Routing/Generator/UrlGenerator.php @@ -54,7 +54,7 @@ public function __construct(RouteCollection $routes, array $context = array(), a */ public function generate($name, array $parameters, $absolute = false) { - if (null === $route = $this->routes->getRoute($name)) { + if (null === $route = $this->routes->get($name)) { throw new \InvalidArgumentException(sprintf('Route "%s" does not exist.', $name)); } diff --git a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php index 20294bbf0662..554ee3de1979 100644 --- a/src/Symfony/Component/Routing/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/XmlFileLoader.php @@ -104,7 +104,7 @@ protected function parseRoute(RouteCollection $collection, $definition, $file) $route = new Route((string) $definition->getAttribute('pattern'), $defaults, $requirements, $options); - $collection->addRoute((string) $definition->getAttribute('id'), $route); + $collection->add((string) $definition->getAttribute('id'), $route); } /** diff --git a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php index 61d9aff26bc7..c9b3a5b59ebb 100644 --- a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php @@ -83,7 +83,7 @@ protected function parseRoute(RouteCollection $collection, $name, $config, $file $route = new Route($config['pattern'], $defaults, $requirements, $options); - $collection->addRoute($name, $route); + $collection->add($name, $route); } protected function loadFile($file) diff --git a/src/Symfony/Component/Routing/RouteCollection.php b/src/Symfony/Component/Routing/RouteCollection.php index 6cd69eb756e7..804eca4a6440 100644 --- a/src/Symfony/Component/Routing/RouteCollection.php +++ b/src/Symfony/Component/Routing/RouteCollection.php @@ -40,7 +40,7 @@ public function __construct() * * @throws \InvalidArgumentException When route name contains non valid characters */ - public function addRoute($name, Route $route) + public function add($name, Route $route) { if (!preg_match('/^[a-z0-9A-Z_]+$/', $name)) { throw new \InvalidArgumentException(sprintf('Name "%s" contains non valid characters for a route name.', $name)); @@ -54,7 +54,7 @@ public function addRoute($name, Route $route) * * @return array An array of routes */ - public function getRoutes() + public function all() { return $this->routes; } @@ -66,7 +66,7 @@ public function getRoutes() * * @return Route $route A Route instance */ - public function getRoute($name) + public function get($name) { return isset($this->routes[$name]) ? $this->routes[$name] : null; } @@ -85,7 +85,7 @@ public function addCollection(RouteCollection $collection, $prefix = '') $this->addResource($resource); } - $this->routes = array_merge($this->routes, $collection->getRoutes()); + $this->routes = array_merge($this->routes, $collection->all()); } /** @@ -99,7 +99,7 @@ public function addPrefix($prefix) return; } - foreach ($this->getRoutes() as $route) { + foreach ($this->all() as $route) { $route->setPattern($prefix.$route->getPattern()); } } diff --git a/src/Symfony/Component/Security/Authentication/AuthenticationProviderManager.php b/src/Symfony/Component/Security/Authentication/AuthenticationProviderManager.php index 78d72258a1e9..9f8efbfa92a0 100644 --- a/src/Symfony/Component/Security/Authentication/AuthenticationProviderManager.php +++ b/src/Symfony/Component/Security/Authentication/AuthenticationProviderManager.php @@ -90,7 +90,7 @@ public function authenticate(TokenInterface $token) * * @return AuthenticationProviderInterface[] An array of AuthenticationProviderInterface instances */ - public function getProviders() + public function all() { return $this->providers; } @@ -104,7 +104,7 @@ public function setProviders(array $providers) { $this->providers = array(); foreach ($providers as $provider) { - $this->addProvider($provider); + $this->add($provider); } } @@ -113,7 +113,7 @@ public function setProviders(array $providers) * * @param AuthenticationProviderInterface $provider A AuthenticationProviderInterface instance */ - public function addProvider(AuthenticationProviderInterface $provider) + public function add(AuthenticationProviderInterface $provider) { $this->providers[] = $provider; } diff --git a/src/Symfony/Component/Translation/Loader/ArrayLoader.php b/src/Symfony/Component/Translation/Loader/ArrayLoader.php index 82fa686ae0ab..37ecd252091b 100644 --- a/src/Symfony/Component/Translation/Loader/ArrayLoader.php +++ b/src/Symfony/Component/Translation/Loader/ArrayLoader.php @@ -27,7 +27,7 @@ public function load($resource, $locale, $domain = 'messages') { $this->flatten($resource); $catalogue = new MessageCatalogue($locale); - $catalogue->addMessages($resource, $domain); + $catalogue->add($resource, $domain); return $catalogue; } diff --git a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php index 4fff70de2317..b53129214dd7 100644 --- a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php @@ -31,7 +31,7 @@ public function load($resource, $locale, $domain = 'messages') $catalogue = new MessageCatalogue($locale); foreach ($xml->xpath('//xliff:trans-unit') as $translation) { - $catalogue->setMessage((string) $translation->source, (string) $translation->target, $domain); + $catalogue->set((string) $translation->source, (string) $translation->target, $domain); } $catalogue->addResource(new FileResource($resource)); diff --git a/src/Symfony/Component/Translation/MessageCatalogue.php b/src/Symfony/Component/Translation/MessageCatalogue.php index 5ada3dcb897f..593fbde5bf0a 100644 --- a/src/Symfony/Component/Translation/MessageCatalogue.php +++ b/src/Symfony/Component/Translation/MessageCatalogue.php @@ -56,7 +56,7 @@ public function getDomains() /** * {@inheritdoc} */ - public function getMessages($domain = null) + public function all($domain = null) { if (null === $domain) { return $this->messages; @@ -68,15 +68,15 @@ public function getMessages($domain = null) /** * {@inheritdoc} */ - public function setMessage($id, $translation, $domain = 'messages') + public function set($id, $translation, $domain = 'messages') { - $this->addMessages(array($id => $translation), $domain); + $this->add(array($id => $translation), $domain); } /** * {@inheritdoc} */ - public function hasMessage($id, $domain = 'messages') + public function has($id, $domain = 'messages') { return isset($this->messages[$domain][$id]); } @@ -84,7 +84,7 @@ public function hasMessage($id, $domain = 'messages') /** * {@inheritdoc} */ - public function getMessage($id, $domain = 'messages') + public function get($id, $domain = 'messages') { return isset($this->messages[$domain][$id]) ? $this->messages[$domain][$id] : $id; } @@ -92,17 +92,17 @@ public function getMessage($id, $domain = 'messages') /** * {@inheritdoc} */ - public function setMessages($messages, $domain = 'messages') + public function replace($messages, $domain = 'messages') { $this->messages[$domain] = array(); - $this->addMessages($messages, $domain); + $this->add($messages, $domain); } /** * {@inheritdoc} */ - public function addMessages($messages, $domain = 'messages') + public function add($messages, $domain = 'messages') { if (!isset($this->messages[$domain])) { $this->messages[$domain] = $messages; @@ -120,8 +120,8 @@ public function addCatalogue(MessageCatalogueInterface $catalogue) throw new \LogicException(sprintf('Cannot add a catalogue for locale "%s" as the current locale for this catalogue is "%s"', $catalogue->getLocale(), $this->locale)); } - foreach ($catalogue->getMessages() as $domain => $messages) { - $this->addMessages($messages, $domain); + foreach ($catalogue->all() as $domain => $messages) { + $this->add($messages, $domain); } foreach ($catalogue->getResources() as $resource) { @@ -135,9 +135,9 @@ public function addCatalogue(MessageCatalogueInterface $catalogue) public function addFallbackCatalogue(MessageCatalogueInterface $catalogue) { foreach ($catalogue->getDomains() as $domain) { - foreach ($catalogue->getMessages($domain) as $id => $translation) { - if (false === $this->hasMessage($id, $domain)) { - $this->setMessage($id, $translation, $domain); + foreach ($catalogue->all($domain) as $id => $translation) { + if (false === $this->has($id, $domain)) { + $this->set($id, $translation, $domain); } } } diff --git a/src/Symfony/Component/Translation/MessageCatalogueInterface.php b/src/Symfony/Component/Translation/MessageCatalogueInterface.php index a67121fbaa21..bc9c2f41a078 100644 --- a/src/Symfony/Component/Translation/MessageCatalogueInterface.php +++ b/src/Symfony/Component/Translation/MessageCatalogueInterface.php @@ -43,7 +43,7 @@ function getDomains(); * * @return array An array of messages */ - function getMessages($domain = null); + function all($domain = null); /** * Sets a message translation. @@ -52,7 +52,7 @@ function getMessages($domain = null); * @param string $translation The messages translation * @param string $domain The domain name */ - function setMessage($id, $translation, $domain = 'messages'); + function set($id, $translation, $domain = 'messages'); /** * Checks if a message has a translation. @@ -62,7 +62,7 @@ function setMessage($id, $translation, $domain = 'messages'); * * @return Boolean true if the message has a translation, false otherwise */ - function hasMessage($id, $domain = 'messages'); + function has($id, $domain = 'messages'); /** * Gets a message translation. @@ -72,7 +72,7 @@ function hasMessage($id, $domain = 'messages'); * * @return string The message translation */ - function getMessage($id, $domain = 'messages'); + function get($id, $domain = 'messages'); /** * Sets translations for a given domain. @@ -80,7 +80,7 @@ function getMessage($id, $domain = 'messages'); * @param string $messages An array of translations * @param string $domain The domain name */ - function setMessages($messages, $domain = 'messages'); + function replace($messages, $domain = 'messages'); /** * Adds translations for a given domain. @@ -88,7 +88,7 @@ function setMessages($messages, $domain = 'messages'); * @param string $messages An array of translations * @param string $domain The domain name */ - function addMessages($messages, $domain = 'messages'); + function add($messages, $domain = 'messages'); /** * Merges translations from the given Catalogue into the current one. diff --git a/src/Symfony/Component/Translation/Translator.php b/src/Symfony/Component/Translation/Translator.php index 7d6421691fc5..6c03eaabf077 100644 --- a/src/Symfony/Component/Translation/Translator.php +++ b/src/Symfony/Component/Translation/Translator.php @@ -112,7 +112,7 @@ public function trans($id, array $parameters = array(), $domain = 'messages', $l $this->loadCatalogue($locale); } - return strtr($this->catalogues[$locale]->getMessage($id, $domain), $parameters); + return strtr($this->catalogues[$locale]->get($id, $domain), $parameters); } /** @@ -128,7 +128,7 @@ public function transChoice($id, $number, array $parameters = array(), $domain = $this->loadCatalogue($locale); } - return strtr($this->selector->choose($this->catalogues[$locale]->getMessage($id, $domain), (int) $number, $locale), $parameters); + return strtr($this->selector->choose($this->catalogues[$locale]->get($id, $domain), (int) $number, $locale), $parameters); } protected function loadCatalogue($locale) diff --git a/tests/Symfony/Tests/Component/Console/ApplicationTest.php b/tests/Symfony/Tests/Component/Console/ApplicationTest.php index 0893533e0e4a..73fb8d248798 100644 --- a/tests/Symfony/Tests/Component/Console/ApplicationTest.php +++ b/tests/Symfony/Tests/Component/Console/ApplicationTest.php @@ -38,7 +38,7 @@ public function testConstructor() $application = new Application('foo', 'bar'); $this->assertEquals('foo', $application->getName(), '__construct() takes the application name as its first argument'); $this->assertEquals('bar', $application->getVersion(), '__construct() takes the application version as its first argument'); - $this->assertEquals(array('help', 'list'), array_keys($application->getCommands()), '__construct() registered the help and list commands by default'); + $this->assertEquals(array('help', 'list'), array_keys($application->all()), '__construct() registered the help and list commands by default'); } public function testSetGetName() @@ -67,15 +67,15 @@ public function testHelp() $this->assertStringEqualsFile(self::$fixturesPath.'/application_gethelp.txt', $application->getHelp(), '->setHelp() returns a help message'); } - public function testGetCommands() + public function testAll() { $application = new Application(); - $commands = $application->getCommands(); - $this->assertEquals('Symfony\\Component\\Console\\Command\\HelpCommand', get_class($commands['help']), '->getCommands() returns the registered commands'); + $commands = $application->all(); + $this->assertEquals('Symfony\\Component\\Console\\Command\\HelpCommand', get_class($commands['help']), '->all() returns the registered commands'); - $application->addCommand(new \FooCommand()); - $commands = $application->getCommands('foo'); - $this->assertEquals(1, count($commands), '->getCommands() takes a namespace as its first argument'); + $application->add(new \FooCommand()); + $commands = $application->all('foo'); + $this->assertEquals(1, count($commands), '->all() takes a namespace as its first argument'); } public function testRegister() @@ -85,60 +85,60 @@ public function testRegister() $this->assertEquals('foo', $command->getName(), '->register() registers a new command'); } - public function testAddCommand() + public function testAdd() { $application = new Application(); - $application->addCommand($foo = new \FooCommand()); - $commands = $application->getCommands(); - $this->assertEquals($foo, $commands['foo:bar'], '->addCommand() registers a command'); + $application->add($foo = new \FooCommand()); + $commands = $application->all(); + $this->assertEquals($foo, $commands['foo:bar'], '->add() registers a command'); $application = new Application(); $application->addCommands(array($foo = new \FooCommand(), $foo1 = new \Foo1Command())); - $commands = $application->getCommands(); + $commands = $application->all(); $this->assertEquals(array($foo, $foo1), array($commands['foo:bar'], $commands['foo:bar1']), '->addCommands() registers an array of commands'); } - public function testHasGetCommand() + public function testHasGet() { $application = new Application(); - $this->assertTrue($application->hasCommand('list'), '->hasCommand() returns true if a named command is registered'); - $this->assertFalse($application->hasCommand('afoobar'), '->hasCommand() returns false if a named command is not registered'); + $this->assertTrue($application->has('list'), '->has() returns true if a named command is registered'); + $this->assertFalse($application->has('afoobar'), '->has() returns false if a named command is not registered'); - $application->addCommand($foo = new \FooCommand()); - $this->assertTrue($application->hasCommand('afoobar'), '->hasCommand() returns true if an alias is registered'); - $this->assertEquals($foo, $application->getCommand('foo:bar'), '->getCommand() returns a command by name'); - $this->assertEquals($foo, $application->getCommand('afoobar'), '->getCommand() returns a command by alias'); + $application->add($foo = new \FooCommand()); + $this->assertTrue($application->has('afoobar'), '->has() returns true if an alias is registered'); + $this->assertEquals($foo, $application->get('foo:bar'), '->get() returns a command by name'); + $this->assertEquals($foo, $application->get('afoobar'), '->get() returns a command by alias'); try { - $application->getCommand('foofoo'); - $this->fail('->getCommand() throws an \InvalidArgumentException if the command does not exist'); + $application->get('foofoo'); + $this->fail('->get() throws an \InvalidArgumentException if the command does not exist'); } catch (\Exception $e) { - $this->assertInstanceOf('\InvalidArgumentException', $e, '->getCommand() throws an \InvalidArgumentException if the command does not exist'); - $this->assertEquals('The command "foofoo" does not exist.', $e->getMessage(), '->getCommand() throws an \InvalidArgumentException if the command does not exist'); + $this->assertInstanceOf('\InvalidArgumentException', $e, '->get() throws an \InvalidArgumentException if the command does not exist'); + $this->assertEquals('The command "foofoo" does not exist.', $e->getMessage(), '->get() throws an \InvalidArgumentException if the command does not exist'); } $application = new TestApplication(); - $application->addCommand($foo = new \FooCommand()); + $application->add($foo = new \FooCommand()); $application->setWantHelps(); - $command = $application->getCommand('foo:bar'); - $this->assertEquals('Symfony\Component\Console\Command\HelpCommand', get_class($command), '->getCommand() returns the help command if --help is provided as the input'); + $command = $application->get('foo:bar'); + $this->assertEquals('Symfony\Component\Console\Command\HelpCommand', get_class($command), '->get() returns the help command if --help is provided as the input'); } public function testGetNamespaces() { $application = new TestApplication(); - $application->addCommand(new \FooCommand()); - $application->addCommand(new \Foo1Command()); + $application->add(new \FooCommand()); + $application->add(new \Foo1Command()); $this->assertEquals(array('foo'), $application->getNamespaces(), '->getNamespaces() returns an array of unique used namespaces'); } public function testFindNamespace() { $application = new TestApplication(); - $application->addCommand(new \FooCommand()); + $application->add(new \FooCommand()); $this->assertEquals('foo', $application->findNamespace('foo'), '->findNamespace() returns the given namespace if it exists'); $this->assertEquals('foo', $application->findNamespace('f'), '->findNamespace() finds a namespace given an abbreviation'); - $application->addCommand(new \Foo2Command()); + $application->add(new \Foo2Command()); $this->assertEquals('foo', $application->findNamespace('foo'), '->findNamespace() returns the given namespace if it exists'); try { $application->findNamespace('f'); @@ -157,41 +157,41 @@ public function testFindNamespace() } } - public function testFindCommand() + public function testFind() { $application = new TestApplication(); - $application->addCommand(new \FooCommand()); - $this->assertEquals('FooCommand', get_class($application->findCommand('foo:bar')), '->findCommand() returns a command if its name exists'); - $this->assertEquals('Symfony\Component\Console\Command\HelpCommand', get_class($application->findCommand('h')), '->findCommand() returns a command if its name exists'); - $this->assertEquals('FooCommand', get_class($application->findCommand('f:bar')), '->findCommand() returns a command if the abbreviation for the namespace exists'); - $this->assertEquals('FooCommand', get_class($application->findCommand('f:b')), '->findCommand() returns a command if the abbreviation for the namespace and the command name exist'); - $this->assertEquals('FooCommand', get_class($application->findCommand('a')), '->findCommand() returns a command if the abbreviation exists for an alias'); + $application->add(new \FooCommand()); + $this->assertEquals('FooCommand', get_class($application->find('foo:bar')), '->find() returns a command if its name exists'); + $this->assertEquals('Symfony\Component\Console\Command\HelpCommand', get_class($application->find('h')), '->find() returns a command if its name exists'); + $this->assertEquals('FooCommand', get_class($application->find('f:bar')), '->find() returns a command if the abbreviation for the namespace exists'); + $this->assertEquals('FooCommand', get_class($application->find('f:b')), '->find() returns a command if the abbreviation for the namespace and the command name exist'); + $this->assertEquals('FooCommand', get_class($application->find('a')), '->find() returns a command if the abbreviation exists for an alias'); - $application->addCommand(new \Foo1Command()); - $application->addCommand(new \Foo2Command()); + $application->add(new \Foo1Command()); + $application->add(new \Foo2Command()); try { - $application->findCommand('f'); - $this->fail('->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace'); + $application->find('f'); + $this->fail('->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace'); } catch (\Exception $e) { - $this->assertInstanceOf('\InvalidArgumentException', $e, '->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace'); - $this->assertEquals('Command "f" is not defined.', $e->getMessage(), '->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace'); + $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace'); + $this->assertEquals('Command "f" is not defined.', $e->getMessage(), '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace'); } try { - $application->findCommand('a'); - $this->fail('->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias'); + $application->find('a'); + $this->fail('->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias'); } catch (\Exception $e) { - $this->assertInstanceOf('\InvalidArgumentException', $e, '->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias'); - $this->assertEquals('Command "a" is ambiguous (afoobar, afoobar1 and 1 more).', $e->getMessage(), '->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias'); + $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias'); + $this->assertEquals('Command "a" is ambiguous (afoobar, afoobar1 and 1 more).', $e->getMessage(), '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias'); } try { - $application->findCommand('foo:b'); - $this->fail('->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command'); + $application->find('foo:b'); + $this->fail('->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command'); } catch (\Exception $e) { - $this->assertInstanceOf('\InvalidArgumentException', $e, '->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command'); - $this->assertEquals('Command "foo:b" is ambiguous (foo:bar, foo:bar1).', $e->getMessage(), '->findCommand() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command'); + $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command'); + $this->assertEquals('Command "foo:b" is ambiguous (foo:bar, foo:bar1).', $e->getMessage(), '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command'); } } @@ -218,7 +218,7 @@ public function testSetCatchExceptions() public function testAsText() { $application = new Application(); - $application->addCommand(new \FooCommand); + $application->add(new \FooCommand); $this->assertStringEqualsFile(self::$fixturesPath.'/application_astext1.txt', $application->asText(), '->asText() returns a text representation of the application'); $this->assertStringEqualsFile(self::$fixturesPath.'/application_astext2.txt', $application->asText('foo'), '->asText() returns a text representation of the application'); } @@ -226,7 +226,7 @@ public function testAsText() public function testAsXml() { $application = new Application(); - $application->addCommand(new \FooCommand); + $application->add(new \FooCommand); $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml1.txt', $application->asXml(), '->asXml() returns an XML representation of the application'); $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml2.txt', $application->asXml('foo'), '->asXml() returns an XML representation of the application'); } @@ -252,7 +252,7 @@ public function testRun() $application = new Application(); $application->setAutoExit(false); $application->setCatchExceptions(false); - $application->addCommand($command = new \Foo1Command()); + $application->add($command = new \Foo1Command()); $_SERVER['argv'] = array('cli.php', 'foo:bar1'); ob_start(); @@ -328,7 +328,7 @@ public function testRun() $application = new Application(); $application->setAutoExit(false); $application->setCatchExceptions(false); - $application->addCommand(new \FooCommand()); + $application->add(new \FooCommand()); $tester = new ApplicationTester($application); $tester->run(array('command' => 'foo:bar', '--no-interaction' => true)); $this->assertEquals("called\n", $this->normalize($tester->getDisplay()), '->run() does not called interact() if --no-interaction is passed'); diff --git a/tests/Symfony/Tests/Component/Console/Command/HelpCommandTest.php b/tests/Symfony/Tests/Component/Console/Command/HelpCommandTest.php index ec80543d3886..ebc7e32b0a1b 100644 --- a/tests/Symfony/Tests/Component/Console/Command/HelpCommandTest.php +++ b/tests/Symfony/Tests/Component/Console/Command/HelpCommandTest.php @@ -30,7 +30,7 @@ public function testExecute() $this->assertRegExp('/getDisplay(), '->execute() returns an XML help text if --xml is passed'); $application = new Application(); - $commandTester = new CommandTester($application->getCommand('help')); + $commandTester = new CommandTester($application->get('help')); $commandTester->execute(array('command_name' => 'list')); $this->assertRegExp('/list \[--xml\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); diff --git a/tests/Symfony/Tests/Component/Console/Command/ListCommandTest.php b/tests/Symfony/Tests/Component/Console/Command/ListCommandTest.php index 74a49bf0c451..466f29aa7632 100644 --- a/tests/Symfony/Tests/Component/Console/Command/ListCommandTest.php +++ b/tests/Symfony/Tests/Component/Console/Command/ListCommandTest.php @@ -19,7 +19,7 @@ public function testExecute() { $application = new Application(); - $commandTester = new CommandTester($command = $application->getCommand('list')); + $commandTester = new CommandTester($command = $application->get('list')); $commandTester->execute(array('command' => $command->getFullName())); $this->assertRegExp('/help Displays help for a command/', $commandTester->getDisplay(), '->execute() returns a list of available commands'); diff --git a/tests/Symfony/Tests/Component/DomCrawler/FormTest.php b/tests/Symfony/Tests/Component/DomCrawler/FormTest.php index eb0d8c129ca7..b98f99dfc835 100644 --- a/tests/Symfony/Tests/Component/DomCrawler/FormTest.php +++ b/tests/Symfony/Tests/Component/DomCrawler/FormTest.php @@ -60,7 +60,7 @@ public function testConstructorThrowsExceptionIfTheNodeHasNoFormAncestor() public function testConstructor($message, $form, $values) { $form = $this->createForm('
'.$form.'
'); - $this->assertEquals($values, array_map(function ($field) { return array(get_class($field), $field->getValue()); }, $form->getFields()), '->getDefaultValues() '.$message); + $this->assertEquals($values, array_map(function ($field) { return array(get_class($field), $field->getValue()); }, $form->all()), '->getDefaultValues() '.$message); } public function provideInitializeValues() @@ -336,35 +336,35 @@ public function provideGetUriValues() ); } - public function testHasField() + public function testHas() { $form = $this->createForm('
'); - $this->assertFalse($form->hasField('foo'), '->hasField() returns false if a field is not in the form'); - $this->assertTrue($form->hasField('bar'), '->hasField() returns true if a field is in the form'); + $this->assertFalse($form->has('foo'), '->has() returns false if a field is not in the form'); + $this->assertTrue($form->has('bar'), '->has() returns true if a field is in the form'); } - public function testGetField() + public function testGet() { $form = $this->createForm('
'); - $this->assertEquals('Symfony\\Component\\DomCrawler\\Field\\InputFormField', get_class($form->getField('bar')), '->getField() returns the field object associated with the given name'); + $this->assertEquals('Symfony\\Component\\DomCrawler\\Field\\InputFormField', get_class($form->get('bar')), '->get() returns the field object associated with the given name'); try { - $form->getField('foo'); - $this->fail('->getField() throws an \InvalidArgumentException if the field does not exist'); + $form->get('foo'); + $this->fail('->get() throws an \InvalidArgumentException if the field does not exist'); } catch (\InvalidArgumentException $e) { - $this->assertTrue(true, '->getField() throws an \InvalidArgumentException if the field does not exist'); + $this->assertTrue(true, '->get() throws an \InvalidArgumentException if the field does not exist'); } } - public function testGetFields() + public function testAll() { $form = $this->createForm('
'); - $fields = $form->getFields(); - $this->assertEquals(1, count($fields), '->getFields() return an array of form field objects'); - $this->assertEquals('Symfony\\Component\\DomCrawler\\Field\\InputFormField', get_class($fields['bar']), '->getFields() return an array of form field objects'); + $fields = $form->all(); + $this->assertEquals(1, count($fields), '->all() return an array of form field objects'); + $this->assertEquals('Symfony\\Component\\DomCrawler\\Field\\InputFormField', get_class($fields['bar']), '->all() return an array of form field objects'); } protected function createForm($form, $method = null, $host = null, $path = '/') diff --git a/tests/Symfony/Tests/Component/EventDispatcher/EventTest.php b/tests/Symfony/Tests/Component/EventDispatcher/EventTest.php index 5b3959081406..a6ee75180e53 100644 --- a/tests/Symfony/Tests/Component/EventDispatcher/EventTest.php +++ b/tests/Symfony/Tests/Component/EventDispatcher/EventTest.php @@ -32,19 +32,19 @@ public function testParameters() { $event = $this->createEvent(); - $this->assertEquals($this->parameters, $event->getParameters(), '->getParameters() returns the event parameters'); - $this->assertEquals('bar', $event->getParameter('foo'), '->getParameter() returns the value of a parameter'); - $event->setParameter('foo', 'foo'); - $this->assertEquals('foo', $event->getParameter('foo'), '->setParameter() changes the value of a parameter'); - $this->assertTrue($event->hasParameter('foo'), '->hasParameter() returns true if the parameter is defined'); - $this->assertFalse($event->hasParameter('oof'), '->hasParameter() returns false if the parameter is not defined'); + $this->assertEquals($this->parameters, $event->all(), '->all() returns the event parameters'); + $this->assertEquals('bar', $event->get('foo'), '->get() returns the value of a parameter'); + $event->set('foo', 'foo'); + $this->assertEquals('foo', $event->get('foo'), '->set() changes the value of a parameter'); + $this->assertTrue($event->has('foo'), '->has() returns true if the parameter is defined'); + $this->assertFalse($event->has('oof'), '->has() returns false if the parameter is not defined'); try { - $event->getParameter('foobar'); - $this->fail('->getParameter() throws an \InvalidArgumentException exception when the parameter does not exist'); + $event->get('foobar'); + $this->fail('->get() throws an \InvalidArgumentException exception when the parameter does not exist'); } catch (\Exception $e) { - $this->assertInstanceOf('\InvalidArgumentException', $e, '->getParameter() throws an \InvalidArgumentException exception when the parameter does not exist'); - $this->assertEquals('The event "name" has no "foobar" parameter.', $e->getMessage(), '->getParameter() throws an \InvalidArgumentException exception when the parameter does not exist'); + $this->assertInstanceOf('\InvalidArgumentException', $e, '->get() throws an \InvalidArgumentException exception when the parameter does not exist'); + $this->assertEquals('The event "name" has no "foobar" parameter.', $e->getMessage(), '->get() throws an \InvalidArgumentException exception when the parameter does not exist'); } $event = new Event($this->subject, 'name', $this->parameters); } diff --git a/tests/Symfony/Tests/Component/HttpKernel/BaseHttpKernelTest.php b/tests/Symfony/Tests/Component/HttpKernel/BaseHttpKernelTest.php index 10e3851c2b9f..510236354693 100644 --- a/tests/Symfony/Tests/Component/HttpKernel/BaseHttpKernelTest.php +++ b/tests/Symfony/Tests/Component/HttpKernel/BaseHttpKernelTest.php @@ -44,7 +44,7 @@ public function testHandleWhenControllerThrowsAnExceptionAndRawIsFalse() $dispatcher = new EventDispatcher(); $dispatcher->connect('core.exception', function ($event) { - $event->setReturnValue(new Response($event->getParameter('exception')->getMessage())); + $event->setReturnValue(new Response($event->get('exception')->getMessage())); return true; }); diff --git a/tests/Symfony/Tests/Component/HttpKernel/Cache/CacheTest.php b/tests/Symfony/Tests/Component/HttpKernel/Cache/CacheTest.php index 3a676514b6a0..289fc34185ae 100644 --- a/tests/Symfony/Tests/Component/HttpKernel/Cache/CacheTest.php +++ b/tests/Symfony/Tests/Component/HttpKernel/Cache/CacheTest.php @@ -769,7 +769,7 @@ public function testInvalidatesCachedResponsesOnPost() } elseif ('POST' == $request->getMethod()) { $response->setStatusCode(303); $response->headers->set('Location', '/'); - $response->headers->delete('Cache-Control'); + $response->headers->remove('Cache-Control'); $response->setContent(''); } }); diff --git a/tests/Symfony/Tests/Component/Routing/Loader/ClosureLoaderTest.php b/tests/Symfony/Tests/Component/Routing/Loader/ClosureLoaderTest.php index 19c3433f5130..90aa93f3d1e3 100644 --- a/tests/Symfony/Tests/Component/Routing/Loader/ClosureLoaderTest.php +++ b/tests/Symfony/Tests/Component/Routing/Loader/ClosureLoaderTest.php @@ -40,11 +40,11 @@ public function testLoad() { $routes = new RouteCollection(); - $routes->addRoute('foo', $route); + $routes->add('foo', $route); return $routes; }); - $this->assertEquals($route, $routes->getRoute('foo'), '->load() loads a \Closure resource'); + $this->assertEquals($route, $routes->get('foo'), '->load() loads a \Closure resource'); } } diff --git a/tests/Symfony/Tests/Component/Routing/Loader/DelegatingLoaderTest.php b/tests/Symfony/Tests/Component/Routing/Loader/DelegatingLoaderTest.php index 5e551153183e..8b0439063bba 100644 --- a/tests/Symfony/Tests/Component/Routing/Loader/DelegatingLoaderTest.php +++ b/tests/Symfony/Tests/Component/Routing/Loader/DelegatingLoaderTest.php @@ -71,12 +71,12 @@ public function testLoad() { $routes = new RouteCollection(); - $routes->addRoute('foo', $route); + $routes->add('foo', $route); return $routes; }); - $this->assertSame($route, $routes->getRoute('foo'), '->load() loads a resource using the loaders from the resolver'); + $this->assertSame($route, $routes->get('foo'), '->load() loads a resource using the loaders from the resolver'); try { $loader->load('foo.foo'); diff --git a/tests/Symfony/Tests/Component/Routing/Matcher/UrlMatcherTest.php b/tests/Symfony/Tests/Component/Routing/Matcher/UrlMatcherTest.php index e1732eb69243..6bd6749ef618 100644 --- a/tests/Symfony/Tests/Component/Routing/Matcher/UrlMatcherTest.php +++ b/tests/Symfony/Tests/Component/Routing/Matcher/UrlMatcherTest.php @@ -20,7 +20,7 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase public function testNormalizeUrl() { $collection = new RouteCollection(); - $collection->addRoute('foo', new Route('/:foo')); + $collection->add('foo', new Route('/:foo')); $matcher = new UrlMatcherForTests($collection, array(), array()); diff --git a/tests/Symfony/Tests/Component/Routing/RouteCollectionTest.php b/tests/Symfony/Tests/Component/Routing/RouteCollectionTest.php index d75d5df9dcaf..7371b76effdd 100644 --- a/tests/Symfony/Tests/Component/Routing/RouteCollectionTest.php +++ b/tests/Symfony/Tests/Component/Routing/RouteCollectionTest.php @@ -21,39 +21,39 @@ public function testRoute() { $collection = new RouteCollection(); $route = new Route('/foo'); - $collection->addRoute('foo', $route); - $this->assertEquals(array('foo' => $route), $collection->getRoutes(), '->addRoute() adds a route'); - $this->assertEquals($route, $collection->getRoute('foo'), '->getRoute() returns a route by name'); - $this->assertNull($collection->getRoute('bar'), '->getRoute() returns null if a route does not exist'); + $collection->add('foo', $route); + $this->assertEquals(array('foo' => $route), $collection->all(), '->add() adds a route'); + $this->assertEquals($route, $collection->get('foo'), '->get() returns a route by name'); + $this->assertNull($collection->get('bar'), '->get() returns null if a route does not exist'); } /** - * @covers Symfony\Component\Routing\RouteCollection::addRoute + * @covers Symfony\Component\Routing\RouteCollection::add * @expectedException InvalidArgumentException */ public function testAddInvalidRoute() { $collection = new RouteCollection(); $route = new Route('/foo'); - $collection->addRoute('f o o', $route); + $collection->add('f o o', $route); } public function testAddCollection() { $collection = new RouteCollection(); - $collection->addRoute('foo', $foo = new Route('/foo')); + $collection->add('foo', $foo = new Route('/foo')); $collection1 = new RouteCollection(); - $collection1->addRoute('foo', $foo1 = new Route('/foo1')); - $collection1->addRoute('bar', $bar1 = new Route('/bar1')); + $collection1->add('foo', $foo1 = new Route('/foo1')); + $collection1->add('bar', $bar1 = new Route('/bar1')); $collection->addCollection($collection1); - $this->assertEquals(array('foo' => $foo1, 'bar' => $bar1), $collection->getRoutes(), '->addCollection() adds routes from another collection'); + $this->assertEquals(array('foo' => $foo1, 'bar' => $bar1), $collection->all(), '->addCollection() adds routes from another collection'); $collection = new RouteCollection(); - $collection->addRoute('foo', $foo = new Route('/foo')); + $collection->add('foo', $foo = new Route('/foo')); $collection1 = new RouteCollection(); - $collection1->addRoute('foo', $foo1 = new Route('/foo1')); + $collection1->add('foo', $foo1 = new Route('/foo1')); $collection->addCollection($collection1, '/foo'); - $this->assertEquals('/foo/foo1', $collection->getRoute('foo')->getPattern(), '->addCollection() can add a prefix to all merged routes'); + $this->assertEquals('/foo/foo1', $collection->get('foo')->getPattern(), '->addCollection() can add a prefix to all merged routes'); $collection = new RouteCollection(); $collection->addResource($foo = new FileResource(__DIR__.'/Fixtures/foo.xml')); @@ -66,11 +66,11 @@ public function testAddCollection() public function testAddPrefix() { $collection = new RouteCollection(); - $collection->addRoute('foo', $foo = new Route('/foo')); - $collection->addRoute('bar', $bar = new Route('/bar')); + $collection->add('foo', $foo = new Route('/foo')); + $collection->add('bar', $bar = new Route('/bar')); $collection->addPrefix('/admin'); - $this->assertEquals('/admin/foo', $collection->getRoute('foo')->getPattern(), '->addPrefix() adds a prefix to all routes'); - $this->assertEquals('/admin/bar', $collection->getRoute('bar')->getPattern(), '->addPrefix() adds a prefix to all routes'); + $this->assertEquals('/admin/foo', $collection->get('foo')->getPattern(), '->addPrefix() adds a prefix to all routes'); + $this->assertEquals('/admin/bar', $collection->get('bar')->getPattern(), '->addPrefix() adds a prefix to all routes'); } public function testResource() diff --git a/tests/Symfony/Tests/Component/Security/Authentication/AuthenticationProviderManagerTest.php b/tests/Symfony/Tests/Component/Security/Authentication/AuthenticationProviderManagerTest.php index 8b94b758739b..9a7bbf513452 100644 --- a/tests/Symfony/Tests/Component/Security/Authentication/AuthenticationProviderManagerTest.php +++ b/tests/Symfony/Tests/Component/Security/Authentication/AuthenticationProviderManagerTest.php @@ -21,11 +21,11 @@ class AuthenticationProviderManagerTest extends \PHPUnit_Framework_TestCase public function testProviderAccessors() { $manager = new AuthenticationProviderManager(); - $manager->addProvider($provider = $this->getMock('Symfony\Component\Security\Authentication\Provider\AuthenticationProviderInterface')); - $this->assertSame(array($provider), $manager->getProviders()); + $manager->add($provider = $this->getMock('Symfony\Component\Security\Authentication\Provider\AuthenticationProviderInterface')); + $this->assertSame(array($provider), $manager->all()); $manager->setProviders($providers = array($this->getMock('Symfony\Component\Security\Authentication\Provider\AuthenticationProviderInterface'))); - $this->assertSame($providers, $manager->getProviders()); + $this->assertSame($providers, $manager->all()); } /** diff --git a/tests/Symfony/Tests/Component/Translation/Loader/PhpFileLoaderTest.php b/tests/Symfony/Tests/Component/Translation/Loader/PhpFileLoaderTest.php index e9f164c4c07a..b382472a27ee 100644 --- a/tests/Symfony/Tests/Component/Translation/Loader/PhpFileLoaderTest.php +++ b/tests/Symfony/Tests/Component/Translation/Loader/PhpFileLoaderTest.php @@ -22,7 +22,7 @@ public function testLoad() $resource = __DIR__.'/../fixtures/resources.php'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->getMessages('domain1')); + $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); } diff --git a/tests/Symfony/Tests/Component/Translation/Loader/XliffFileLoaderTest.php b/tests/Symfony/Tests/Component/Translation/Loader/XliffFileLoaderTest.php index 79f0b2be089d..2a39a2661ac2 100644 --- a/tests/Symfony/Tests/Component/Translation/Loader/XliffFileLoaderTest.php +++ b/tests/Symfony/Tests/Component/Translation/Loader/XliffFileLoaderTest.php @@ -22,7 +22,7 @@ public function testLoad() $resource = __DIR__.'/../fixtures/resources.xliff'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->getMessages('domain1')); + $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); } diff --git a/tests/Symfony/Tests/Component/Translation/Loader/YamlFileLoaderTest.php b/tests/Symfony/Tests/Component/Translation/Loader/YamlFileLoaderTest.php index 7b396f77156e..1119026df331 100644 --- a/tests/Symfony/Tests/Component/Translation/Loader/YamlFileLoaderTest.php +++ b/tests/Symfony/Tests/Component/Translation/Loader/YamlFileLoaderTest.php @@ -22,7 +22,7 @@ public function testLoad() $resource = __DIR__.'/../fixtures/resources.yml'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->getMessages('domain1')); + $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); } diff --git a/tests/Symfony/Tests/Component/Translation/MessageCatalogTest.php b/tests/Symfony/Tests/Component/Translation/MessageCatalogTest.php index 9a6d476f4a8d..182aad708ebd 100644 --- a/tests/Symfony/Tests/Component/Translation/MessageCatalogTest.php +++ b/tests/Symfony/Tests/Component/Translation/MessageCatalogTest.php @@ -29,55 +29,55 @@ public function testGetDomains() $this->assertEquals(array('domain1', 'domain2'), $catalogue->getDomains()); } - public function testGetMessages() + public function testAll() { $catalogue = new MessageCatalogue('en', $messages = array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); - $this->assertEquals(array('foo' => 'foo'), $catalogue->getMessages('domain1')); - $this->assertEquals(array(), $catalogue->getMessages('domain88')); - $this->assertEquals($messages, $catalogue->getMessages()); + $this->assertEquals(array('foo' => 'foo'), $catalogue->all('domain1')); + $this->assertEquals(array(), $catalogue->all('domain88')); + $this->assertEquals($messages, $catalogue->all()); } - public function testHasMessage() + public function testHas() { $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); - $this->assertTrue($catalogue->hasMessage('foo', 'domain1')); - $this->assertFalse($catalogue->hasMessage('bar', 'domain1')); - $this->assertFalse($catalogue->hasMessage('foo', 'domain88')); + $this->assertTrue($catalogue->has('foo', 'domain1')); + $this->assertFalse($catalogue->has('bar', 'domain1')); + $this->assertFalse($catalogue->has('foo', 'domain88')); } - public function testGetSetMessage() + public function testGetSet() { $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); - $catalogue->setMessage('foo1', 'foo1', 'domain1'); + $catalogue->set('foo1', 'foo1', 'domain1'); - $this->assertEquals('foo', $catalogue->getMessage('foo', 'domain1')); - $this->assertEquals('foo1', $catalogue->getMessage('foo1', 'domain1')); + $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); + $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); } - public function testAddMessages() + public function testAdd() { $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); - $catalogue->addMessages(array('foo1' => 'foo1'), 'domain1'); + $catalogue->add(array('foo1' => 'foo1'), 'domain1'); - $this->assertEquals('foo', $catalogue->getMessage('foo', 'domain1')); - $this->assertEquals('foo1', $catalogue->getMessage('foo1', 'domain1')); + $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); + $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); - $catalogue->addMessages(array('foo' => 'bar'), 'domain1'); - $this->assertEquals('bar', $catalogue->getMessage('foo', 'domain1')); - $this->assertEquals('foo1', $catalogue->getMessage('foo1', 'domain1')); + $catalogue->add(array('foo' => 'bar'), 'domain1'); + $this->assertEquals('bar', $catalogue->get('foo', 'domain1')); + $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); - $catalogue->addMessages(array('foo' => 'bar'), 'domain88'); - $this->assertEquals('bar', $catalogue->getMessage('foo', 'domain88')); + $catalogue->add(array('foo' => 'bar'), 'domain88'); + $this->assertEquals('bar', $catalogue->get('foo', 'domain88')); } - public function testSetMessages() + public function testReplace() { $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); - $catalogue->setMessages($messages = array('foo1' => 'foo1'), 'domain1'); + $catalogue->replace($messages = array('foo1' => 'foo1'), 'domain1'); - $this->assertEquals($messages, $catalogue->getMessages('domain1')); + $this->assertEquals($messages, $catalogue->all('domain1')); } public function testAddCatalogue() @@ -96,8 +96,8 @@ public function testAddCatalogue() $catalogue->addCatalogue($catalogue1); - $this->assertEquals('foo', $catalogue->getMessage('foo', 'domain1')); - $this->assertEquals('foo1', $catalogue->getMessage('foo1', 'domain1')); + $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); + $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); $this->assertEquals(array($r, $r1), $catalogue->getResources()); } @@ -118,8 +118,8 @@ public function testAddFallbackCatalogue() $catalogue->addFallbackCatalogue($catalogue1); - $this->assertEquals('foo', $catalogue->getMessage('foo', 'domain1')); - $this->assertEquals('foo1', $catalogue->getMessage('foo1', 'domain1')); + $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); + $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); $this->assertEquals(array($r, $r1), $catalogue->getResources()); }