Browse Source

Remove deprecated method.

View::addScript() has been replaced by view blocks.
mark_story 12 years ago
parent
commit
ee006fbad0
2 changed files with 0 additions and 36 deletions
  1. 0 21
      src/View/View.php
  2. 0 15
      tests/TestCase/View/ViewTest.php

+ 0 - 21
src/View/View.php

@@ -757,27 +757,6 @@ class View {
 	}
 
 /**
- * Adds a script block or other element to be inserted in $scripts_for_layout in
- * the `<head />` of a document layout
- *
- * @param string $name Either the key name for the script, or the script content. Name can be used to
- *   update/replace a script element.
- * @param string $content The content of the script being added, optional.
- * @return void
- * @deprecated Will be removed in 3.0. Superseded by blocks functionality.
- * @see View::start()
- */
-	public function addScript($name, $content = null) {
-		if (empty($content)) {
-			if (!in_array($name, array_values($this->_scripts))) {
-				$this->_scripts[] = $name;
-			}
-		} else {
-			$this->_scripts[$name] = $content;
-		}
-	}
-
-/**
  * Generates a unique, non-random DOM ID for an object, based on the object type and the target URL.
  *
  * @param string $object Type of object, i.e. 'form' or 'link'

+ 0 - 15
tests/TestCase/View/ViewTest.php

@@ -598,21 +598,6 @@ class ViewTest extends TestCase {
 	}
 
 /**
- * Test addInlineScripts method
- *
- * @return void
- */
-	public function testAddInlineScripts() {
-		$View = new TestView();
-		$View->addScript('prototype.js');
-		$View->addScript('prototype.js');
-		$this->assertEquals(array('prototype.js'), $View->scripts());
-
-		$View->addScript('mainEvent', 'Event.observe(window, "load", function() { doSomething(); }, true);');
-		$this->assertEquals(array('prototype.js', 'mainEvent' => 'Event.observe(window, "load", function() { doSomething(); }, true);'), $View->scripts());
-	}
-
-/**
  * Test elementExists method
  *
  * @return void