Beispiel #1
0
 def test_new(self):
     php = PHP()
     dt = php.new('DateTime')
     ts = dt.getTimestamp()
     php.echo(ts)
     output = str(php)
     self.assertAlmostEquals(int(output), time(), delta=10)
Beispiel #2
0
 def test_dyn_getitem(self):
     php = PHP()
     array_params = range(self.TEST_RANGE)
     array = php.array(*array_params)
     php.shuffle(array)
     php.echo(array[array[0]])
     self.assertIn(int(str(php)), array_params)
Beispiel #3
0
 def test_dict(self):
     php = PHP()
     values = php.array_values(self.TEST_DICT)
     php.sort(values)
     php.echo(php.implode(',', values))
     expected = ','.join(sorted(self.TEST_DICT.itervalues()))
     self.assertEquals(str(php), expected)
Beispiel #4
0
	def test_dyn_getitem(self):
		php = PHP()
		array_params = range(self.TEST_RANGE)
		array = php.array(*array_params)
		php.shuffle(array)
		php.echo(array[array[0]])
		self.assertIn(int(str(php)), array_params)
Beispiel #5
0
	def test_dict(self):
		php = PHP()
		values = php.array_values(self.TEST_DICT)
		php.sort(values)
		php.echo(php.implode(',', values))
		expected = ','.join(sorted(self.TEST_DICT.itervalues()))
		self.assertEquals(str(php), expected)
Beispiel #6
0
	def test_new(self):
		php = PHP()
		dt = php.new('DateTime')
		ts = dt.getTimestamp()
		php.echo(ts)
		output = str(php)
		self.assertAlmostEquals(int(output), time(), delta=10)
Beispiel #7
0
 def test_add(self):
     php = PHP()
     array = php.range(1, self.TEST_RANGE)
     php.echo(php.count(array) + self.TEST_VALUE)
     self.assertEquals(str(php), str(self.TEST_VALUE + self.TEST_RANGE))
Beispiel #8
0
 def test_getitem(self):
     php = PHP()
     array_params = range(self.TEST_RANGE)
     array = php.array(*array_params)
     php.echo(array[0])
     self.assertEquals(str(php), str(array_params[0]))
Beispiel #9
0
 def test_list(self):
     php = PHP()
     php.echo(php.count(range(self.TEST_RANGE)))
     output = str(php)
     self.assertEquals(output, str(self.TEST_RANGE))
Beispiel #10
0
 def test_deep_compose(self):
     php = PHP()
     php.echo(php.strlen(php.strrev(self.TEST_STRING)))
     output = str(php)
     self.assertEquals(output, str(len(self.TEST_STRING)))
Beispiel #11
0
 def test_echo(self):
     php = PHP()
     php.echo(self.TEST_STRING)
     self.assertEquals(str(php), self.TEST_STRING)
Beispiel #12
0
	def test_echo(self):
		php = PHP()
		php.echo(self.TEST_STRING)
		self.assertEquals(str(php), self.TEST_STRING)
Beispiel #13
0
	def test_add(self):
		php = PHP()
		array = php.range(1, self.TEST_RANGE)
		php.echo(php.count(array) + self.TEST_VALUE)
		self.assertEquals(str(php), str(self.TEST_VALUE + self.TEST_RANGE))
Beispiel #14
0
	def test_getitem(self):
		php = PHP()
		array_params = range(self.TEST_RANGE)
		array = php.array(*array_params)
		php.echo(array[0])
		self.assertEquals(str(php), str(array_params[0]))
Beispiel #15
0
	def test_list(self):
		php = PHP()
		php.echo(php.count(range(self.TEST_RANGE)))
		output = str(php)
		self.assertEquals(output, str(self.TEST_RANGE))
Beispiel #16
0
	def test_deep_compose(self):
		php = PHP()
		php.echo(php.strlen(php.strrev(self.TEST_STRING)))
		output = str(php)
		self.assertEquals(output, str(len(self.TEST_STRING)))