[Pkg-owncloud-commits] [php-sabre-vobject] 291/341: Making sure everything uses the children() method and not the property.
David Prévot
taffit at moszumanska.debian.org
Tue Aug 11 13:35:58 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository php-sabre-vobject.
commit 226422c5c15bfc87987bed62c06421a4d9dd8989
Author: Evert Pot <me at evertpot.com>
Date: Fri Jul 3 18:56:43 2015 -0400
Making sure everything uses the children() method and not the property.
---
lib/Cli.php | 7 ++++---
lib/Component.php | 5 +++--
lib/VCardConverter.php | 2 +-
tests/VObject/ComponentTest.php | 4 ++--
tests/VObject/ReaderTest.php | 30 +++++++++++++++---------------
5 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/lib/Cli.php b/lib/Cli.php
index 8f9c9a8..0b54102 100644
--- a/lib/Cli.php
+++ b/lib/Cli.php
@@ -583,9 +583,10 @@ HELP
};
- $tmp = $vObj->children;
+ $children = $vObj->children();
+ $tmp = $children;
uksort(
- $vObj->children,
+ $children,
function($a, $b) use ($sortScore, $tmp) {
$sA = $sortScore($a, $tmp);
@@ -596,7 +597,7 @@ HELP
}
);
- foreach ($vObj->children as $child) {
+ foreach ($children as $child) {
if ($child instanceof Component) {
$this->serializeComponent($child);
} else {
diff --git a/lib/Component.php b/lib/Component.php
index 063538d..7d5b8bd 100644
--- a/lib/Component.php
+++ b/lib/Component.php
@@ -172,7 +172,8 @@ class Component extends Node {
}
/**
- * Returns an iterable list of children.
+ * Returns a flat list of all the properties and components in this
+ * component.
*
* @return array
*/
@@ -432,7 +433,7 @@ class Component extends Node {
if ($name==='children') {
- throw new \RuntimeException('Starting sabre/vobject 4.0 the children property is now protected. You should use the select() method instead');
+ throw new \RuntimeException('Starting sabre/vobject 4.0 the children property is now protected. You should use the children() method instead');
}
diff --git a/lib/VCardConverter.php b/lib/VCardConverter.php
index 2b0814e..37b6c03 100644
--- a/lib/VCardConverter.php
+++ b/lib/VCardConverter.php
@@ -49,7 +49,7 @@ class VCardConverter {
'VERSION' => $newVersion,
]);
- foreach ($input->children as $property) {
+ foreach ($input->children() as $property) {
$this->convertProperty($input, $output, $property, $targetVersion);
diff --git a/tests/VObject/ComponentTest.php b/tests/VObject/ComponentTest.php
index ddf5abc..b37624e 100644
--- a/tests/VObject/ComponentTest.php
+++ b/tests/VObject/ComponentTest.php
@@ -214,7 +214,7 @@ class ComponentTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals(1, count($comp->children()));
- $bla = $comp->children[0];
+ $bla = $comp->children()[0];
$this->assertTrue($bla instanceof Property);
$this->assertEquals('MYPROP', $bla->name);
@@ -230,7 +230,7 @@ class ComponentTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals(1, count($comp->children()));
- $bla = $comp->children[0];
+ $bla = $comp->children()[0];
$this->assertInstanceOf('Sabre\\VObject\\Property', $bla);
$this->assertEquals('MYPROP', $bla->name);
diff --git a/tests/VObject/ReaderTest.php b/tests/VObject/ReaderTest.php
index 6124208..a053a71 100644
--- a/tests/VObject/ReaderTest.php
+++ b/tests/VObject/ReaderTest.php
@@ -12,7 +12,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase {
$this->assertInstanceOf('Sabre\\VObject\\Component', $result);
$this->assertEquals('VCALENDAR', $result->name);
- $this->assertEquals(0, count($result->children));
+ $this->assertEquals(0, count($result->children()));
}
@@ -28,7 +28,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase {
$this->assertInstanceOf('Sabre\\VObject\\Component', $result);
$this->assertEquals('VCALENDAR', $result->name);
- $this->assertEquals(0, count($result->children));
+ $this->assertEquals(0, count($result->children()));
}
@@ -40,7 +40,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase {
$this->assertInstanceOf('Sabre\\VObject\\Component', $result);
$this->assertEquals('VCALENDAR', $result->name);
- $this->assertEquals(0, count($result->children));
+ $this->assertEquals(0, count($result->children()));
}
@@ -52,7 +52,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase {
$this->assertInstanceOf('Sabre\\VObject\\Component', $result);
$this->assertEquals('VCALENDAR', $result->name);
- $this->assertEquals(0, count($result->children));
+ $this->assertEquals(0, count($result->children()));
}
@@ -149,9 +149,9 @@ class ReaderTest extends \PHPUnit_Framework_TestCase {
$this->assertInstanceOf('Sabre\\VObject\\Component', $result);
$this->assertEquals('VCALENDAR', $result->name);
$this->assertEquals(1, count($result->children()));
- $this->assertInstanceOf('Sabre\\VObject\\Property', $result->children[0]);
- $this->assertEquals('PROPNAME', $result->children[0]->name);
- $this->assertEquals('propValue', $result->children[0]->getValue());
+ $this->assertInstanceOf('Sabre\\VObject\\Property', $result->children()[0]);
+ $this->assertEquals('PROPNAME', $result->children()[0]->name);
+ $this->assertEquals('propValue', $result->children()[0]->getValue());
}
@@ -171,11 +171,11 @@ class ReaderTest extends \PHPUnit_Framework_TestCase {
$this->assertInstanceOf('Sabre\\VObject\\Component', $result);
$this->assertEquals('VCALENDAR', $result->name);
$this->assertEquals(1, count($result->children()));
- $this->assertInstanceOf('Sabre\\VObject\\Component', $result->children[0]);
- $this->assertEquals('VTIMEZONE', $result->children[0]->name);
- $this->assertEquals(1, count($result->children[0]->children()));
- $this->assertInstanceOf('Sabre\\VObject\\Component', $result->children[0]->children[0]);
- $this->assertEquals('DAYLIGHT', $result->children[0]->children[0]->name);
+ $this->assertInstanceOf('Sabre\\VObject\\Component', $result->children()[0]);
+ $this->assertEquals('VTIMEZONE', $result->children()[0]->name);
+ $this->assertEquals(1, count($result->children()[0]->children()));
+ $this->assertInstanceOf('Sabre\\VObject\\Component', $result->children()[0]->children()[0]);
+ $this->assertEquals('DAYLIGHT', $result->children()[0]->children()[0]->name);
}
@@ -444,7 +444,7 @@ ICS;
$this->assertInstanceOf('Sabre\\VObject\\Component', $result);
$this->assertEquals('VCALENDAR', $result->name);
- $this->assertEquals(0, count($result->children));
+ $this->assertEquals(0, count($result->children()));
}
@@ -462,7 +462,7 @@ XML;
$this->assertInstanceOf('Sabre\\VObject\\Component', $result);
$this->assertEquals('VCALENDAR', $result->name);
- $this->assertEquals(0, count($result->children));
+ $this->assertEquals(0, count($result->children()));
}
@@ -484,7 +484,7 @@ XML;
$this->assertInstanceOf('Sabre\\VObject\\Component', $result);
$this->assertEquals('VCALENDAR', $result->name);
- $this->assertEquals(0, count($result->children));
+ $this->assertEquals(0, count($result->children()));
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git
More information about the Pkg-owncloud-commits
mailing list