1
0
mirror of https://github.com/danog/amp.git synced 2024-11-27 04:24:42 +01:00
amp/test/StructTest.php

56 lines
1.7 KiB
PHP
Raw Normal View History

2016-08-18 05:25:54 +02:00
<?php declare(strict_types = 1);
namespace Amp\Test;
2016-07-19 07:05:40 +02:00
class StructTestFixture {
use \Amp\Struct;
public $callback;
}
class StructTest extends \PHPUnit_Framework_TestCase {
/**
* @expectedException \Error
2015-07-30 05:23:53 +02:00
* @expectedExceptionMessage Amp\Test\StructTestFixture property "callbac" does not exist ... did you mean "callback?"
*/
public function testSetErrorWithSuggestion() {
2015-07-30 05:23:53 +02:00
$struct = new StructTestFixture;
$struct->callbac = function(){};
}
2015-07-30 05:23:53 +02:00
/**
* @expectedException \Error
2015-07-30 05:23:53 +02:00
* @expectedExceptionMessage Amp\Test\StructTestFixture property "callbac" does not exist ... did you mean "callback?"
*/
public function testGetErrorWithSuggestion() {
2015-07-30 05:23:53 +02:00
$struct = new StructTestFixture;
$test = $struct->callbac;
}
/**
* @expectedException \Error
2015-07-30 05:23:53 +02:00
* @expectedExceptionMessage Amp\Test\StructTestFixture property "callZZZZZZZZZZZ" does not exist
*/
public function testSetErrorWithoutSuggestion() {
2015-07-30 05:23:53 +02:00
$struct = new StructTestFixture;
$struct->callZZZZZZZZZZZ = "test";
}
2015-07-30 05:23:53 +02:00
/**
* @expectedException \Error
2015-07-30 05:23:53 +02:00
* @expectedExceptionMessage Amp\Test\StructTestFixture property "callZZZZZZZZZZZ" does not exist
*/
public function testGetErrorWithoutSuggestion() {
2015-07-30 05:23:53 +02:00
$struct = new StructTestFixture;
$test = $struct->callZZZZZZZZZZZ;
}
/**
* @expectedException \Error
2015-07-30 05:23:53 +02:00
* @expectedExceptionMessage Amp\Test\StructTestFixture property "__propertySuggestThreshold" does not exist
*/
public function testSuggestionIgnoresPropertyStartingWithUnderscore() {
2015-07-30 05:23:53 +02:00
$struct = new StructTestFixture;
$test = $struct->__propertySuggestThreshold;
}
}