diff --git a/tests/autoloader.php b/tests/autoloader.php index 611ae28..1cf4a18 100644 --- a/tests/autoloader.php +++ b/tests/autoloader.php @@ -9,10 +9,9 @@ class Autoloader /** * @param string $baseDirectory Base directory where the source files are located. */ - public function __construct($baseDirectory = __DIR__) - { + public function __construct($baseDirectory = __DIR__) { $this->directory = $baseDirectory; - $this->prefix = __NAMESPACE__.'\\'; + $this->prefix = 'Mintance\\'; $this->prefixLength = strlen($this->prefix); } @@ -21,8 +20,7 @@ public function __construct($baseDirectory = __DIR__) * * @param bool $prepend Prepend the autoloader on the stack instead of appending it. */ - public static function register($prepend = false) - { + public static function register($prepend = false) { spl_autoload_register(array(new self(), 'autoload'), true, $prepend); } @@ -31,15 +29,15 @@ public static function register($prepend = false) * * @param string $className Fully qualified name of a class. */ - public function autoload($className) - { + public function autoload($className) { if (0 === strpos($className, $this->prefix)) { $parts = explode('\\', substr($className, $this->prefixLength)); - $filepath = $this->directory.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $parts).'.php'; - + $filepath = $this->directory.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $parts).'.php'; if (is_file($filepath)) { require $filepath; } } } } + +Autoloader::register(); \ No newline at end of file diff --git a/tests/simple-event.php b/tests/simple-event.php index c2905b3..eb74db9 100644 --- a/tests/simple-event.php +++ b/tests/simple-event.php @@ -1,7 +1,11 @@ 'api.mintance.dev', + 'protocol' => 'http' +]); + +$mintance->track('Test Event'); + diff --git a/tests/track-custom-people-id.php b/tests/track-custom-people-id.php index dda9dba..24952a4 100644 --- a/tests/track-custom-people-id.php +++ b/tests/track-custom-people-id.php @@ -1,11 +1,28 @@ 'api.mintance.dev', + 'protocol' => 'http' +]); + + +$people_id = '123'; // Id from e-commerce site. $mintance->people->setIdentifier($people_id); +// +//$mintance->track('Add to Cart', [ +// 'product_id' => 1 +//]); +// +//if($mintance->people->get()['id'] != '58e0be1f48177e953b8b473d') { +// throw new \Exception('Invalid people_id'); +//} + -$mintance->track('Add to Cart', [ - 'product_id' => 1 +$mintance->people->set([ + 'email' => 'test@email.com', + 'name' => '', + 'phone' => '23' ]); \ No newline at end of file